/* ==========================================================================
   Testbed dashboard (admins): the project table and the inspector. Loaded after app.css by
   index.html; the server pages don't need it. Built only from app.css tokens and
   primitives; the feature components follow design-planning/mockups/shared/mockup.css.

    1 Shell and list pane            7 One pane below 1024 px
    2 Project table                  8 Phones below 700 px
    3 Inspector                      9 Save instructions dialog
    4 Inspector sections            10 The key dialog's selector
    5 New project and the first run 11 The log: its section and its view
    6 Project, save and key menus
   ========================================================================== */


/* ==========================================================================
   1 Shell and list pane
   ========================================================================== */

body[data-view="dashboard"] { background: var(--surface-1); }

.workspace.is-single { grid-template-columns: minmax(0, 1fr); }
.pane, .insp-scroll { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
/* The inspector head reserves the scrollbar's gutter too, so its buttons line up with the
   sections scrolling below it. */
.insp-scroll, .insp-head { scrollbar-gutter: stable; }

.pane-head .count-badge {
  padding: 0 6px; border-radius: var(--radius-sm); background: var(--surface-3);
  color: var(--text-muted); font-size: var(--text-xs); line-height: 18px; font-variant-numeric: tabular-nums;
}
.pane-head .filter { width: 200px; }
/* The "/" hint says how to get here: not while the filter has focus or text (the project list's
   Filter, and the log's Search). */
.filter:focus-within .field-end,
.filter:has(input:not(:placeholder-shown)) .field-end { display: none; }
.when-phone { display: none; }


/* ==========================================================================
   2 Project table: Name · Status · Access · Updated · actions. Rows are 52 px; the selected
   row has the blue edge (app.css), a row with its menu open keeps the hover fill.
   ========================================================================== */

.projects { --cols: minmax(0, 1fr) 156px 176px 92px 64px; }
/* With a long list the pane's head (title, filter, New project) stays with the column header
   (not on phones, whose list has neither a filter nor a header). */
:root { --pane-head-h: 48px; } /* on :root, so html's scroll-padding below can use it */
.pane-main > .pane-head { position: sticky; top: 0; z-index: 3; background: var(--surface-1); }
.projects .thead { position: sticky; top: var(--pane-head-h); z-index: 2; }
/* A row focused from the keyboard scrolls clear of what sticks above it (WCAG 2.4.11): the
   pane head and table header in the list pane; below 1024 px the page scrolls, under the top
   bar too. */
.pane-main { scroll-padding-top: calc(var(--pane-head-h) + 32px); }
@media (max-width: 1023px) {
  html:has(> body[data-view="dashboard"]) { scroll-padding-top: calc(var(--topbar-h) + var(--pane-head-h) + 32px); }
}
@media (max-width: 699px) {
  .pane-main > .pane-head { position: static; }
  html:has(> body[data-view="dashboard"]) { scroll-padding-top: var(--topbar-h); } /* no table header */
}
@media (pointer: coarse) {
  :root { --pane-head-h: 56px; } /* the touch height of .pane-head (app.css) */
}
/* The name has priority over the alias badge: it shrinks only when it alone is wider than the
   cell. The badge takes all that is left beside it and truncates there; with less than 56 px
   left it wraps onto a second line, which the one-line box hides (never a sliver of a badge,
   never into Status or past a phone's edge). */
.tr .cell-name .text { flex: 1 1 auto; }
.tr .name-line { display: flex; flex-wrap: wrap; align-items: center; column-gap: 6px; height: 20px; min-width: 0; overflow: hidden; }
.tr .name-line .name { flex: 0 0 auto; max-width: 100%; line-height: 20px; } /* the first line fills the box */
.tr .name-line .alias { display: flex; flex: 1 1 56px; min-width: 0; }
.tr .name-line .badge { max-width: 100%; overflow: hidden; }
.tr .m-meta, .tr .m-go { display: none; }
.tr [aria-expanded="true"] { background: var(--pressed); color: var(--text-primary); opacity: 1; }
.tr.is-menu-open:not([aria-selected="true"]) { background: var(--hover); } /* a selected row stays selected */
/* As a drop target the row shows only its name and the instruction (data-drop, app.css). */
.tr.is-over > :not(.cell-name) { visibility: hidden; }

/* Loading: seven grey rows (the mockup's widths) and a grey inspector head. */
.tr.is-skeleton:hover { background: none; }
.tr.is-skeleton .text { gap: 7px; }
.sk-name { height: 10px; }
.sk-w1 { width: 110px; } .sk-w2 { width: 147px; } .sk-w3 { width: 184px; } .sk-w4 { width: 141px; }
.sk-w5 { width: 178px; } .sk-w6 { width: 135px; } .sk-w7 { width: 172px; }
.sk-host { height: 8px; width: 220px; max-width: 100%; }
.sk-status { height: 10px; width: 64px; }
.sk-access { height: 10px; width: 120px; }
.sk-updated { height: 10px; width: 56px; }
.sk-title { height: 12px; width: 160px; }
.sk-sub { height: 8px; width: 110px; }

/* The filter matched nothing: says so, with a quiet way back to every project. */
.rows-empty { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 10px 12px 10px 16px; color: var(--text-muted); overflow-wrap: anywhere; }
.rows-empty p { min-width: 0; }

/* The drop row after the table: a drop (or a choice) there starts New project with it. */
.drop-row {
  display: flex; align-items: center; gap: 12px; margin: 12px 12px 16px 16px; padding: 10px 12px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); color: var(--text-secondary);
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.drop-row .grow { display: grid; }
.drop-row .t-meta { color: var(--text-muted); }
.drop-row .dropzone-icon { width: 28px; height: 28px; }
.drop-row .zone-buttons { flex: none; gap: 12px; } /* the text wraps; the buttons never shrink */
.is-dragging .drop-row:not(.is-over) { border-color: var(--accent-border); color: var(--accent-text); }
.drop-row.is-over { border-style: solid; border-color: var(--accent); background: var(--accent-subtle); box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent-text); }
.drop-row.is-over .dropzone-icon { color: var(--accent); }
/* While files are dragged, a target's insides ignore the pointer, so enter and leave only
   fire at its edges and nothing inside it reacts. */
.is-dragging [data-drop-target] * { pointer-events: none; }
.is-dragging .staged:not(.is-over) { border-color: var(--accent-border); }

/* 1024 to 1179 px: two panes, with too little room for every column. Access steps aside (the
   inspector shows it), in the grey rows of the loading list too, and the names keep room:
   244 px or more. */
@media (min-width: 1024px) and (max-width: 1179px) {
  .projects { --cols: minmax(0, 1fr) 156px 92px 64px; }
  .projects .col-access, .projects .cell-access, .projects .tr.is-skeleton .sk-access { display: none; }
}

.cell-status { position: relative; display: flex; align-items: center; min-width: 0; }
.cell-status .progress-track { position: absolute; left: 14px; top: calc(50% + 12px); width: 104px; }
.cell-access { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text-secondary); }
.cell-access .more { flex: none; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.cell-access .i { flex: none; }
.cell-updated { color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }


/* ==========================================================================
   3 Inspector: the selected project (or New project) beside the table. Its head is 80 px,
   the list pane's head (48) plus the table header (32), so the panes share their lines.
   ========================================================================== */

.inspector { display: flex; flex-direction: column; }
.insp-head {
  display: flex; align-items: center; flex: none; height: 80px; padding: 0 16px; overflow: hidden;
  border-bottom: 1px solid var(--border-subtle); background: var(--surface-2);
}
.insp-title { display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0; }
.insp-title .text { display: grid; gap: 2px; min-width: 0; flex: 1; }
/* The heading takes focus to move the reading position: a ring only when that came from the
   keyboard (a new project published from it, for one). */
.insp-title h2:focus:not(:focus-visible) { outline: none; }
.insp-title .btn { flex: none; }
.insp-title .status { font-size: var(--text-xs); white-space: normal; align-items: flex-start; }
.insp-title .status .dot { margin-top: 5px; }
/* One line: the muted detail ("· works in a moment") steps aside, onto a second line the box
   hides, when it doesn't fit, rather than leave a word below. */
.insp-title .status > span:last-child { display: flex; flex-wrap: wrap; column-gap: 0.3em; max-height: 18px; overflow: hidden; white-space: nowrap; }
.insp-scroll { flex: 1; min-height: 0; overflow: auto; }


/* ==========================================================================
   4 Inspector sections: address, update, access, keys, history, saves
   ========================================================================== */

.addr { display: flex; align-items: center; gap: 6px; min-height: 28px; min-width: 0; }
.addr .t-mono { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addr .i { color: var(--text-muted); }
.addr .end { margin-left: auto; flex: none; display: inline-flex; gap: 2px; }
.addr-alias { color: var(--text-muted); }
.addr-note { margin: 10px 0 2px; }

/* The Update zone: compact (one row of text, one of buttons); it never changes size. Its text
   is two lines high at least (a one-sentence error has no second line), and the busy label
   stays on one line. */
.dropzone-compact .dz-text { display: grid; min-width: 0; min-height: calc(var(--lh-sm) + var(--lh-xs)); }
.dropzone-compact.is-busy .dropzone-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Touch: busy in the idle layout's rows. */
.zone-touch .dz-progress { min-height: var(--control-lg); }
.zone-touch .dz-progress [data-label] { flex: 0 1 auto; max-width: 55%; }
/* New's busy zone on touch: its rows lie over the idle layout, which stays underneath unseen
   and so keeps the zone its size (on a phone two lines of text and two buttons). */
.zone-hold { display: grid; }
.zone-hold > * { grid-area: 1 / 1; align-self: start; min-width: 0; }
.zone-ghost { visibility: hidden; }
.zone-buttons { gap: 6px; }
/* Drop zones hold both texts; a file dragged over one switches them without new markup. */
.dz-over { display: none; }
.dropzone.is-over .dz-idle { display: none; }
.dropzone.is-over .dz-over { display: inline; }
.dropzone-compact.is-over .dz-over { display: block; }
/* A zone that shows the last error is still a drop target. While files are dragged over the
   page it is a plain one again (upload icon, the drop text, no danger fill); over it, the
   release text, as any zone. Its icons and texts for each moment are stacked in one grid cell
   and switched by visibility, so the zone never changes size. */
.dropzone.is-error .dz-stack { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.dropzone.is-error .dz-stack > * { grid-area: 1 / 1; display: block; visibility: hidden; }
.dropzone.is-error .dz-stack > .dz-idle { visibility: visible; }
.is-dragging .dropzone.is-error .dz-stack > .dz-idle,
.dropzone.is-error.is-over .dz-stack > .dz-idle { visibility: hidden; }
.is-dragging .dropzone.is-error:not(.is-over) .dz-stack > .dz-drag,
.dropzone.is-error.is-over .dz-stack > .dz-over { visibility: visible; }
.is-dragging .dropzone.is-error:not(.is-over) { background: var(--surface-1); }
.dropzone.is-error.is-over { border-color: var(--accent); background: var(--accent-subtle); }
.dropzone.is-error.is-over .dropzone-icon { color: var(--accent); }
/* Busy: the progress row takes the buttons' place, so the zone keeps its height. */
.dz-progress { display: flex; align-items: center; gap: 10px; width: 100%; min-height: var(--control-sm); }
.dz-progress .progress-track { flex: 1 1 auto; }
.dz-progress .tnum { font-size: var(--text-xs); color: var(--text-muted); }

/* Link sharing, at the top of Access: the switch with its help under the label; while it is on,
   the link and its password, each a row like the Address section's (.addr): its icon, the link
   (mono) or the password's state (muted), its actions at the end. */
.link-share { margin-bottom: 16px; }
.link-switch .switch { font-weight: var(--weight-medium); }
.link-help, .link-error { margin-top: 2px; padding-left: 38px; } /* under the label: track 28 + gap 10 */
/* On touch the switch is 40 px tall, its label in the middle: the help comes up by the 8 px it
   grew below the label, so it sits as close under it as on a desktop (5 px). The switch stays
   on top of the help's first line, so all of its 40 px still take the tap. */
@media (pointer: coarse) {
  .link-help { margin-top: -6px; }
  .link-switch .switch { position: relative; }
}
.link-url { margin-top: 8px; }
.link-state { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
/* The password: masked (mono dots), or while Show shows it the password itself. Its row's items
   sit at the top, each lowered to the middle of the first line (28 px, or a touch control's
   40), so the buttons are in the same place whether it shows or not: the eye stays under the
   pointer. */
.link-pw { --ctl: var(--control-xs); --line: max(28px, var(--ctl)); align-items: flex-start; }
@media (pointer: coarse) {
  .link-pw { --ctl: var(--control-lg); }
}
.link-pw > .i { margin-top: calc((var(--line) - var(--icon-sm)) / 2); }
.link-pw > .link-secret { margin-top: calc((var(--line) - var(--lh-xs)) / 2); }
.link-pw > .link-state { margin-top: calc((var(--line) - var(--lh-sm)) / 2); }
.link-pw > .end { margin-top: calc((var(--line) - var(--ctl)) / 2); }
/* Shown, the password is whole, never cut: it wraps (anywhere, its spaces kept) around its
   buttons, which float where they were, its first lines beside them and the rest under them; on
   a phone, whose buttons fill the line, it starts under them. One click selects all of it. */
.link-pw.is-shown { display: flow-root; }
.link-pw.is-shown > .i { float: left; }
.link-pw.is-shown > .end { float: right; margin-left: 6px; }
.addr .link-secret.is-shown { display: block; margin-left: 20px; overflow: visible; text-overflow: clip; white-space: pre-wrap; overflow-wrap: anywhere; user-select: all; }
@media (max-width: 699px) {
  .link-pw.is-shown > .link-secret { clear: right; margin-top: 0; padding-top: 4px; }
}
/* Under the row's text (icon 14 + gap 6): why there is no Show. */
.link-pw-note { margin-top: 2px; padding-left: 20px; }

.access-form { display: flex; gap: 8px; }
.access-form .field { flex: 1; }
.access-empty { margin-top: 10px; }
.access-note { margin-top: 8px; }
.entries { margin: 8px -8px 0; }
.entry { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 8px; border-radius: var(--radius-md); }
@media (hover: hover) {
  .entry:hover { background: var(--hover); }
}
.entry .i { color: var(--text-muted); }
.entry .v { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry .note { color: var(--text-muted); font-size: var(--text-xs); white-space: nowrap; }
.entry .btn { margin-left: auto; }
.entry.is-removing { opacity: 0.45; text-decoration: line-through; }

.versions { margin: 4px -8px 0; }
.version {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; column-gap: 8px;
  min-height: 44px; padding: 4px 8px; border-radius: var(--radius-md);
}
/* Focused after a Restore from the keyboard: an inset ring, as rows and menu items have. */
.version:focus-visible { outline-offset: -2px; }
@media (hover: hover) {
  .version:hover { background: var(--hover); }
}
.version .rail-dot { width: 7px; height: 7px; border-radius: 50%; justify-self: center; background: var(--border-strong); }
.version.is-live .rail-dot { background: var(--success); box-shadow: 0 0 0 3px var(--success-subtle); }
.version .text { display: grid; min-width: 0; }
.version .when { font-variant-numeric: tabular-nums; }
.version .meta { font-size: var(--text-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
/* Restore shows on hover and keyboard focus (always on touch screens, below). */
.version .btn { opacity: 0; transition: opacity var(--dur-fast) var(--ease); }
.version:hover .btn, .version:focus-within .btn { opacity: 1; }
@media (hover: none) {
  .version .btn { opacity: 1; }
}

/* Saves: the shared ones, then one group per person (their email). Each save is a row like a
   version: its name, "size · time", and a ⋯ menu that is always there (Download, Replace…,
   Delete…). A group's pictures follow its saves, each with its thumbnail just before the ⋯,
   so every name starts on the same edge. The title takes focus when the last save goes.
   Keys (after Access) look the same: the project's keys, then each person's own under their
   email; a key's row is its name over "service · set <time>" and its ⋯ (Replace…, Delete…). */
.saves .section-head h3:focus:not(:focus-visible),
.keys .section-head h3:focus:not(:focus-visible) { outline: none; }
.saves-group + .saves-group, .keys-group + .keys-group { margin-top: 12px; }
.saves-owner, .keys-owner {
  display: flex; align-items: center; gap: 6px; min-width: 0; min-height: 20px;
  font-size: var(--text-xs); line-height: var(--lh-xs); font-weight: var(--weight-medium); color: var(--text-secondary);
}
.saves-owner .i, .keys-owner .i { flex: none; color: var(--text-muted); }
.saves-owner .note, .keys-owner .note { flex: none; font-weight: var(--weight-regular); color: var(--text-muted); }
.saves-list, .keys-list { margin: 2px -8px 0; }
.save-line, .key-line {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 8px;
  min-height: 44px; padding: 4px 4px 4px 8px; border-radius: var(--radius-md);
}
@media (hover: hover) {
  .save-line:hover, .key-line:hover { background: var(--hover); }
}
.save-line:has(> [aria-expanded="true"]), .key-line:has(> [aria-expanded="true"]) { background: var(--hover); } /* its menu is open */
.save-line [aria-expanded="true"], .key-line [aria-expanded="true"] { background: var(--pressed); color: var(--text-primary); }
.save-line .text, .key-line .text { display: grid; min-width: 0; }
.save-line .name, .key-line .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-line .meta, .key-line .meta { font-size: var(--text-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
/* A key the server can't open anymore (another session secret, a damaged file): to set again. */
.key-line .meta.is-error { color: var(--danger-text); }
/* On touch screens there is no pointer to show a name's title: a long one wraps instead, an
   owner's email too (its icon then stays by the first line). */
@media (hover: none) {
  .save-line .name, .menu-save .menu-label.is-title,
  .key-line .name, .menu-key .menu-label.is-title { white-space: normal; overflow-wrap: anywhere; }
  .keys-owner, .saves-owner { align-items: flex-start; }
  .keys-owner .truncate, .saves-owner .truncate { white-space: normal; overflow-wrap: anywhere; }
}
.keys-none { margin: 2px 0 4px; }
.keys-empty .help { margin-top: 4px; }
.keys-empty .row-actions { margin-top: 12px; }
.keys-failed { align-items: center; margin-bottom: 8px; }
.keys-failed .btn { flex: none; margin: -2px -4px -2px auto; color: inherit; }
/* Under the keys, as Access's rows are: where keys stay, and the way to the instructions. */
.keys-note { margin-top: 12px; }
/* A picture's thumbnail: a 32 px square of the picture, cut to fit (never stretched), with the
   small tiles' radius and a translucent edge drawn over it, as the avatar's, so a picture as
   light or as dark as the pane keeps its outline. Its plain tile shows while it loads; one
   that can't be shown gets an icon that says so (app.js). */
.save.is-picture .save-line { grid-template-columns: minmax(0, 1fr) 32px auto; column-gap: 10px; }
.save-thumb {
  position: relative; display: grid; place-items: center; width: 32px; height: 32px; overflow: hidden;
  border-radius: var(--radius-sm); background: var(--surface-3); color: var(--text-muted);
}
.save-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.save-thumb::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px var(--media-edge); pointer-events: none; }
.save-error { margin: 0 8px 6px; }
.saves-failed { align-items: center; margin-bottom: 8px; }
.saves-failed .btn { flex: none; margin: -2px -4px -2px auto; color: inherit; }
.saves-empty .help { margin-top: 4px; }
.saves-empty .row-actions { margin-top: 12px; }
.saves-loading { display: grid; gap: 7px; padding: 8px 0 6px; }
.sk-save { height: 10px; width: 96px; }
.sk-save-meta { height: 8px; width: 132px; }


/* ==========================================================================
   5 New project (in the inspector) and the first run (no projects yet)
   ========================================================================== */

.inspector .dropzone:not(.dropzone-compact), .first-run .dropzone { min-height: 196px; }
.new-zone { display: grid; gap: 16px; }
.dz-actions { margin-top: 4px; }
.new-progress { max-width: 280px; }
.help b { font-weight: var(--weight-semibold); }
.help.is-block { display: block; }

.next { display: grid; gap: 6px; margin-top: 8px; }
.next li { display: flex; gap: 8px; align-items: flex-start; color: var(--text-secondary); }
.next .i { margin-top: 1px; color: var(--text-muted); }

/* A build dropped before the name was valid, kept until Publish. */
.new-staged { display: grid; gap: 16px; }
.staged {
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface-1);
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.staged .text { display: grid; min-width: 0; flex: 1; }
.staged.is-over { border-color: var(--accent); background: var(--accent-subtle); box-shadow: inset 0 0 0 1px var(--accent); }
.staged-actions { justify-content: flex-end; }

.first-run { display: grid; place-items: center; padding: 48px 16px; }
.first-run .card { width: min(480px, 100%); display: grid; gap: 16px; }


/* ==========================================================================
   6 Project, save and key menus: one element each for every row and the inspector, fixed to
   the viewport and placed next to its trigger through the CSSOM.
   ========================================================================== */

.menu-project, .menu-save, .menu-key { position: fixed; z-index: 30; width: 212px; animation: pop-in var(--dur-fast) var(--ease); }


/* ==========================================================================
   7 One pane below 1024 px: the list, or a project (or New) in its place with "Projects"
   in the top bar to go back (#app[data-view] is list, detail or new). The page scrolls
   instead of the panes; the top bar stays.
   ========================================================================== */

.topbar .back { display: none; gap: 2px; max-width: min(60vw, 320px); margin-left: -6px; }

@media (max-width: 1023px) {
  .app { height: auto; min-height: 100vh; min-height: 100dvh; }
  .app > .topbar { position: sticky; top: 0; z-index: 20; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .pane, .insp-scroll { overflow: visible; }
  .insp-scroll, .insp-head { scrollbar-gutter: auto; }
  .pane-main > .pane-head { top: var(--topbar-h); }
  .projects .thead { top: calc(var(--topbar-h) + var(--pane-head-h)); }
  .app[data-view="list"] .pane-side { display: none; }
  .app:not([data-view="list"]) .pane-main { display: none; }
  .app:not([data-view="list"]) .topbar { padding-left: 8px; }
  .app:not([data-view="list"]) .topbar .back { display: inline-flex; }
  .app:not([data-view="list"]) .topbar .brand { display: none; }
  /* A project on its own: one surface, no pane edge. */
  .pane-side { border-left: 0; background: var(--surface-1); }
  .insp-head { background: var(--surface-1); }
}


/* ==========================================================================
   8 Phones below 700 px: no domain addon, "New" instead of "New project", the account
   shows only its avatar; New is one column with its title.
   ========================================================================== */

@media (max-width: 699px) {
  .field-addon.hide-phone { display: none; }
  .when-wide { display: none; }
  .when-phone { display: inline; }
  .app .account-email { display: none; }
  .pane-head .filter { display: none; }

  /* The same rows, as a list: name and a meta line (first access entry, +N, when), the
     status and a chevron on the right. The table header, the address and the row actions
     step aside; the inspector has them. */
  .projects .thead { display: none; }
  .tr { grid-template-columns: minmax(0, 1fr) auto auto; column-gap: 12px; min-height: 60px; padding: 8px 12px 8px 16px; }
  .tr .sub, .tr .cell-access, .tr .cell-updated, .tr .actions { display: none; }
  .tr .cell-name .text { gap: 1px; }
  .tr .m-meta { display: flex; gap: 0.3em; min-width: 0; }
  .tr .m-meta > :not(.truncate) { flex: none; white-space: nowrap; }
  .tr .m-meta .i { align-self: center; } /* link sharing's link and key */
  .tr .m-go { display: block; margin-left: -8px; color: var(--text-muted); }
  .tr .cell-status .status { font-size: var(--text-xs); }
  .tr .cell-status .progress-track { display: none; }

  .tr.is-skeleton .sk-access, .tr.is-skeleton .sk-updated, .tr.is-skeleton > span:empty:not(.skeleton) { display: none; }
  .drop-row { flex-wrap: wrap; }
  .drop-row .zone-buttons { width: 100%; }
  .app:not([data-view="list"]) .account > .i { display: none; }
  /* No tooltips on a phone: the project's name shows whole (40 characters at most), on as many
     lines as it takes, and the head grows. */
  .insp-head { height: auto; min-height: 80px; padding-block: 12px; }
  .insp-title h2.truncate { white-space: normal; overflow-wrap: anywhere; }
  .new-phone { display: grid; align-content: start; gap: 16px; padding: 20px 16px 32px; }
  .new-phone .section { padding: 0; border: 0; }
}

/* Touch screens have no drop targets: choosing is how builds arrive (New project, Update). */
@media (pointer: coarse) {
  .drop-row { display: none; }
}


/* ==========================================================================
   9 Save instructions dialog: wider than the others, for lines of about 90 characters, with
   the text in a read-only block that scrolls (and takes focus, to scroll from the keyboard).
   The text keeps its own lines (it is pasted as it is); narrower screens scroll sideways.
   ========================================================================== */

.dialog-wide { width: min(720px, calc(100vw - 32px)); }
.prompt-text {
  display: block; width: 100%; height: min(440px, calc(100dvh - 248px)); min-height: 160px; margin-top: 8px;
  padding: 10px 12px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  background: var(--surface-2); color: var(--text-primary);
  font-family: var(--font-mono); font-size: var(--text-xs); line-height: var(--lh-xs);
  white-space: pre; overflow-wrap: normal; overflow: auto; resize: none; tab-size: 2;
}
.prompt-text:focus-visible { outline-offset: -1px; }
.prompt-text[aria-busy="true"] { background: var(--surface-3); }


/* ==========================================================================
   10 The key dialog's selector (the design system's Selector): a field-shaped button, the
   chosen service in it, that opens a listbox under it, as wide as it; the chosen option has
   the tick. No browser-native select (design system, selection controls).
   ========================================================================== */

.select { width: 100%; justify-content: space-between; padding: 0 8px 0 10px; font-weight: var(--weight-regular); }
.select .i { color: var(--text-muted); }
.select-wrap > .menu { left: 0; right: auto; width: 100%; min-width: 0; }
.menu-listbox .menu-item[aria-selected="false"] .tick { visibility: hidden; }


/* ==========================================================================
   11 The log (no mockup). The Log section in the inspector, between History and Saves: the
   latest few entries as rows like a save's, and Open log. The log view (#/p/<name>/log) takes the
   workspace's place on every width: a head (the project to go back to, the title, Download and
   Clear…; below 700 px those two in a ⋯ menu), the filters, and the entries, newest first in
   groups by day; from 1024 px in columns (time, level, person, page, message, Details), below
   that stacked. Every piece of an entry is text an app sent: the message keeps its lines and
   breaks anywhere; the data shows on demand. An empty log is an empty pane, as elsewhere.
   ========================================================================== */

/* An entry's level: its icon, of its own shape, then its word, so colour is never all that tells
   them apart. Errors take the danger red, a little heavier; a warning's icon is amber ("needs
   attention, nothing failed", as "HTTPS delayed" is), its word grey, so that in dark mode warnings
   never outshine errors; info stays grey. Only the level is coloured, never the message. The
   word is the cell's baseline (an inline flex box whose first child is an icon would take the
   icon's bottom, 2 px above the row's). */
.log-level { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--text-muted); }
.log-level > span { align-self: baseline; }
.log-level.is-warn { color: var(--text-secondary); }
.log-level.is-warn .i { color: var(--warning-text); }
.log-level.is-error { color: var(--danger-text); font-weight: var(--weight-medium); }

/* The Log section: each entry as a save's row, the message over "level · who · time". */
.log .section-head h3:focus:not(:focus-visible) { outline: none; }
.log-latest { margin: 2px -8px 0; }
.log-line { display: grid; align-content: center; min-height: 44px; padding: 4px 8px; }
.log-line-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-line .meta { display: flex; gap: 0.3em; min-width: 0; font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.log-line .meta > :not(.truncate) { flex: none; white-space: nowrap; }
.log-line .log-level { gap: 4px; }
.log-empty .help { margin-top: 4px; }
.log-empty .row-actions { margin-top: 12px; }
.logs-failed { align-items: center; margin-bottom: 8px; }
.logs-failed .btn, .log-banner .btn { flex: none; margin: -2px -4px -2px auto; color: inherit; }
/* On touch screens there is no pointer to show a title: a message wraps (two lines here, the
   rest in the log view), and the line under it flows as text, a long email breaking anywhere. */
@media (hover: none) {
  .log-line-msg { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: normal; overflow-wrap: anywhere; }
  .log-line .meta { display: block; overflow-wrap: anywhere; }
  .log-line .meta .log-level { display: inline; }
  .log-line .meta .log-level .i { vertical-align: -1px; margin-right: 4px; }
  .log-line .meta .truncate { white-space: normal; }
}

/* The level filter: the design system's segmented control (components.css), the one in force
   pressed. */
.segmented {
  display: inline-flex; align-items: center; gap: 2px; height: var(--control-sm); padding: 2px;
  border-radius: var(--radius-md); background: var(--surface-3);
}
.segmented button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 24px; padding: 0 10px;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-secondary);
  font-size: var(--text-sm); font-weight: var(--weight-medium); white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
@media (hover: hover) {
  .segmented button:hover { color: var(--text-primary); }
}
.segmented button[aria-pressed="true"] {
  background: var(--segment-on); color: var(--text-primary);
  box-shadow: 0 0 0 1px var(--border-subtle), 0 1px 2px rgba(0, 0, 0, 0.06);
}
.segmented button:focus-visible { outline-offset: 0; }

/* The view: head, filters, then the entries, which scroll under them. */
.log-view {
  --log-cols: 64px 84px minmax(0, 200px) minmax(0, 160px) minmax(0, 1fr) auto;
  display: grid; grid-template-rows: auto auto minmax(0, 1fr); min-height: 0; background: var(--surface-1);
}
.log-view:has(> .log-body:nth-child(2)) { grid-template-rows: auto minmax(0, 1fr); } /* (no filters: the empty log) */
.log-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 12px; padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); }
.log-back { flex: none; max-width: 280px; margin: -4px 0 0 -6px; gap: 2px; }
.log-title { display: grid; justify-items: start; gap: 2px; flex: 1 1 200px; min-width: 0; }
.log-title h1:focus:not(:focus-visible) { outline: none; }
.log-stale { align-items: center; margin-top: 0; }
.log-stale .btn { flex: none; margin: -4px 0; }
.log-actions { display: flex; flex: none; align-self: center; gap: 8px; }
.log-menu-wrap { display: none; flex: none; }
.log-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 16px; border-bottom: 1px solid var(--border-subtle); }
.log-filter { width: 220px; }
.log-forget-slot { display: contents; }
.log-forget { max-width: 100%; min-width: 0; }
.log-body { overflow: auto; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
/* A fresh load (another filter) dims what shows until its answer comes. */
.log-body.is-loading > * { opacity: 0.55; transition: opacity var(--dur) var(--ease); }
.log-banner { align-items: center; max-width: 720px; margin: 12px 16px 0; }
.log-body > .empty { padding: 64px 24px; }
.log-body > .rows-empty { padding: 14px 16px; }

/* The columns' names stay over the entries as they scroll, as the project table's header does,
   and each day's title under them while its entries go by. */
.log-columns {
  position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: var(--log-cols); column-gap: 16px; align-items: center;
  height: 32px; padding: 0 16px; border-bottom: 1px solid var(--border-subtle); background: var(--surface-2);
  color: var(--text-muted); font-size: var(--text-xs); font-weight: var(--weight-medium);
}
.log-day-title {
  position: sticky; top: 32px; z-index: 1; padding: 14px 16px 6px; border-bottom: 1px solid var(--border-subtle); background: var(--surface-1);
  font-size: var(--text-xs); line-height: var(--lh-xs); font-weight: var(--weight-semibold); color: var(--text-secondary);
}
.log-day + .log-day .log-day-title { padding-top: 20px; }
/* An entry: one row of columns, each on the message's first line; its details under the message. */
.log-entry {
  display: grid; grid-template-columns: var(--log-cols); column-gap: 16px; align-items: baseline;
  padding: 8px 16px; border-bottom: 1px solid var(--border-subtle);
}
.log-meta { display: contents; }
.log-time { color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.log-who, .log-page { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-who { color: var(--text-secondary); }
.log-page { color: var(--text-muted); }
.log-msg { min-width: 0; max-width: 110ch; white-space: pre-wrap; overflow-wrap: anywhere; }
/* Details: a disclosure (a chevron that turns), never a menu's trigger with its pressed fill. */
.log-toggle { margin: -4px 0; gap: 2px; }
.log-toggle .i { transition: transform var(--dur-fast) var(--ease); }
.log-toggle[aria-expanded="true"] { background-color: transparent; color: var(--text-primary); }
.log-toggle[aria-expanded="true"] .i { transform: rotate(90deg); }
.log-data-wrap { grid-column: 5 / -1; position: relative; min-width: 0; margin: 8px 0 2px; }
.log-copy { position: absolute; top: 4px; right: 4px; }
.log-data {
  max-height: 320px; padding: 8px 40px 8px 10px; overflow: auto;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface-2); color: var(--text-primary);
  font-family: var(--font-mono); font-size: var(--text-xs); line-height: var(--lh-xs); white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2;
}
.log-data:focus-visible { outline-offset: -1px; }
.log-foot { display: flex; justify-content: flex-start; padding: 16px; }

/* Grey rows while the log loads the first time, in the entries' columns. */
.log-sk-row { display: grid; grid-template-columns: var(--log-cols); column-gap: 16px; align-items: center; height: 44px; padding: 0 16px; border-bottom: 1px solid var(--border-subtle); }
.log-sk-row .skeleton { height: 10px; }
.sk-time { width: 56px; }
.sk-level { width: 52px; }
.sk-who { width: 70%; }
.sk-page { width: 50%; }

/* Below 1024 px: the page scrolls, the top bar's Back goes back to the project, and each entry is
   stacked: when, level, who and page on one line (wrapping), the message under it, Details at the
   end of the first line. */
@media (max-width: 1023px) {
  .log-view { display: block; }
  .log-back { display: none; }
  .log-body { overflow: visible; }
  .log-columns { display: none; }
  .log-day-title { top: var(--topbar-h); }
  .log-entry { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "meta toggle" "msg msg" "data data"; row-gap: 4px; align-items: center; }
  .log-meta { grid-area: meta; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; min-width: 0; font-size: var(--text-xs); line-height: var(--lh-xs); }
  .log-who, .log-page { white-space: normal; overflow-wrap: anywhere; }
  .log-page:empty { display: none; }
  .log-msg { grid-area: msg; }
  .log-toggle { grid-area: toggle; margin: 0; }
  .log-data-wrap { grid-area: data; margin-top: 4px; }
  .log-sk-row { display: flex; gap: 16px; }
  .log-sk-row .sk-who, .log-sk-row .sk-page { display: none; }
}

/* Touch screens (no pointer to show a title), however wide: a long email or page wraps, and so
   does the name in Delete entries by …. */
@media (hover: none) {
  .log-who, .log-page { white-space: normal; overflow-wrap: anywhere; }
  .log-forget { height: auto; min-height: var(--control-sm); padding-block: 6px; line-height: 1.4; text-align: left; }
  .log-forget .truncate { white-space: normal; overflow-wrap: anywhere; }
}

@media (pointer: coarse) {
  .segmented { height: var(--control-lg); }
  .segmented button { height: 34px; }
}

/* Phones: Download and Clear… in the ⋯ menu on the title's row; the level over the person and
   the text, side by side. */
@media (max-width: 699px) {
  .log-actions { display: none; }
  .log-menu-wrap { display: block; align-self: center; }
  .log-filters { display: grid; grid-template-columns: 1fr 1fr; }
  .segmented { display: flex; grid-column: 1 / -1; }
  .segmented button { flex: 1 1 0; padding: 0 6px; }
  .log-filter { width: auto; min-width: 0; }
  .log-forget { grid-column: 1 / -1; justify-self: start; }
}
