/* Server mode, the studio's side (docs/look/system.md 3.1, 3.11, 4.10 to 4.13). Owner: the studio engineer.
   Nothing here is used in local mode: every class below belongs to an element that only server mode draws.

   .hdr__inner--sync  .syncbar  .syncbar__status (--calm --busy --warn)  .syncbar__act  .syncbar__lock
                                                      the status line and the lock in the studio header
   .acct  .acct__form  .acct__brand  .acct__mark  .acct__lead  .acct__points  .acct__actions  .acct__key
   .acct__group  .acct--wide  .acct__keep             setup and login: the form tile beside the dark tile
   .passfield  .passfield__toggle  .passtips          a passphrase field with show / hide; the four tips
   .rkey  .rkey__group  .rkey__no  .rkey__text        the recovery key: eight numbered groups
   .devices  .devices__row  .devices__text  .devices__label  .devices__err  .sec-acts  .sec-act
                                                      settings: connected devices, the three exits
   .upload-offer__actions                             the project list: the upload offer's buttons
   .mrow__state  .isheet__wait  .isheet__dot  .paste--server
                                                      one household: status with its mark, the invite being prepared
   .rp-answers                                        the report: the way into the answers dialog
   .answers  .answers__group  .answers__list  .answers__row (.is-counted)  .answers__pick (--off)
   .answers__text  .answers__tags  .answers__help  .answers__newer
                                                      the answers dialog: one group per round, one row per answer
   .trash__head  .trash__body  .trash__list  .trash__about  .trash__none  .trows  .trow  .trow__text  .trow__name
   .trow__actions                                     the trash
*/

/* ---------- the status line (3.1) ---------- */

/* Below the desk width: a second row under the brand, status at the start and the lock at the end. */
.hdr__inner--sync { flex-wrap: wrap; row-gap: 0; }
.syncbar {
  flex: 1 0 100%;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  min-height: 44px; min-width: 0;
  font: 400 14px/1.3 var(--font);
}
/* Local mode has no status to show: the way out alone closes the brand row instead of taking a row of its own. */
.syncbar--solo { flex: 0 0 auto; margin-inline-start: auto; justify-content: flex-end; }
.syncbar__status { display: inline-flex; align-items: center; gap: var(--s-2); min-width: 0; color: var(--ink-2); }
.syncbar__status::before {
  content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ok);
}
.syncbar__status--busy::before { background: var(--ink-3); animation: sync-pulse 1.2s var(--ease) infinite alternate; }
/* Not saved, no connection: said in ink with the warning icon, never by colour alone. */
.syncbar__status--warn { color: var(--ink); }
.syncbar__status--warn::before { display: none; }
.syncbar__status .icon { color: var(--danger); }
@keyframes sync-pulse { from { opacity: 1; } to { opacity: .3; } }

.syncbar__act {
  font: inherit; color: var(--accent-ink); background: none; border: 0; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; min-height: 44px;
  text-decoration: none; text-underline-offset: 4px; text-align: start;
}
.syncbar__act:hover { text-decoration: underline; }
/* The lock: a quiet pill, 34px high inside a 44px target (the bar's own pill). */
.syncbar__lock {
  position: relative; flex: none; cursor: pointer;
  display: inline-flex; align-items: center; height: 34px; padding: 0 16px; border: 0; border-radius: var(--pill);
  background: var(--wash); color: var(--ink); font: 600 14px/1 var(--font);
  text-decoration: none;   /* in local mode it is a link to the start screen */
  transition: background .3s var(--ease);
}
.syncbar__lock::before { content: ""; position: absolute; inset: -5px 0; }
.syncbar__lock:focus-visible { border-radius: var(--pill); }
@media (hover: hover) and (pointer: fine) { .syncbar__lock:hover { background: var(--wash-2); } }

/* Phone: the status and the lock close the brand row; the pills are the second row. */
@media (max-width: 599.98px) {
  .hdr__inner--sync .hdr__brand { flex: 0 0 auto; }
  .hdr__inner--sync .syncbar { order: 1; flex: 1 1 0; justify-content: flex-end; }
  .hdr__inner--sync .snav { order: 2; }
}

/* Desk: the same element closes the bar. */
@media (min-width: 1100px) {
  .hdr__inner--sync { flex-wrap: nowrap; }
  .syncbar { flex: 0 1 auto; margin-inline-start: auto; justify-content: flex-end; gap: var(--s-4); }
}

/* ---------- setup and login (4.11) ---------- */

.acct { display: grid; gap: var(--gap-tiles); align-content: start; }
.acct__form { display: flex; flex-direction: column; gap: var(--s-5); }
.acct__form h1:focus { outline: none; }
.acct__form > p:not(.field__error), .acct__form form > p:not(.field__error) { color: var(--ink-2); text-wrap: pretty; }
.acct__head { display: grid; gap: var(--s-2); }
.acct__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); }
.acct__actions .btn--primary { min-width: 180px; }
.acct__key .field__input, .acct__group .field__input { font-family: var(--font-code); text-transform: uppercase; }
.acct__group .field__input { max-width: 9em; }
.acct__brand { display: none; }
@media (max-width: 599.98px) {
  .acct__actions { flex-direction: column; align-items: stretch; }
}
@media (min-width: 1100px) {
  /* The form in five columns, the dark tile in seven; the pair stands in the middle of the window. */
  .acct {
    grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: stretch; align-content: center;
    min-height: calc(100vh - var(--hdr-h) - var(--s-6) - var(--s-7));
    min-height: calc(100dvh - var(--hdr-h) - var(--s-6) - var(--s-7));
  }
  .acct__form { grid-column: span 5; justify-content: center; padding: var(--s-7) 40px; }
  .acct__brand {
    grid-column: span 7; min-height: 600px; padding: var(--s-7);
    display: flex; flex-direction: column; justify-content: space-between; gap: var(--s-6);
  }
  /* The tile that holds a list (the tips, or what comes next): the mark stands right over the rows and the
     two sit in the middle of the tile, so no empty band parts them. Every step has the same pair height. */
  .acct__brand--list { justify-content: center; gap: var(--s-7); }
  .acct--wide .acct__form { grid-column: 1 / -1; }
  .acct--wide .acct__brand { display: none; }
}
/* Without the tips the dark tile carries the still cards of the invite page between the mark and the sentence. */
.acct__cards { display: flex; flex-direction: column; align-items: center; --card-w: clamp(150px, calc((100vh - 620px) * .7), 220px); }
/* Below the desk that tile stands under the form (login, the key check, the last step): a short form alone
   would leave the lower half of a phone blank. The mark is already in the bar above, so it is left out. */
@media (max-width: 1099.98px) {
  .acct:not(.acct--wide) .acct__brand--cards {
    display: flex; flex-direction: column; align-items: center; gap: var(--s-5);
    padding: var(--s-6) var(--pad-tile); text-align: center;
  }
  .acct__brand--cards .acct__mark { display: none; }
  .acct__brand--cards .acct__lead { font-size: 19px; }
}
.acct__mark { display: flex; align-items: baseline; gap: var(--s-3); }
.acct__mark b { font: 700 44px/1 var(--font); letter-spacing: -.01em; }
.acct__mark span { font: 400 17px/1 var(--font); color: var(--ivory-2); }
.acct__lead { font: 600 26px/1.3 var(--font); max-width: 24em; text-wrap: balance; }
/* The four tips, as the start screen's privacy rows: soft blocks one step up inside the dark tile. */
.acct__points { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.acct__points li {
  display: flex; align-items: center; gap: var(--s-3);
  min-height: 52px; padding: var(--s-3) var(--s-4); border-radius: var(--r-sm);
  background: var(--espresso-2); color: var(--ivory-2); font: 400 16px/1.4 var(--font);
}
.acct__points .icon { width: 18px; height: 18px; color: var(--accent-soft); }
.acct__no {
  flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%;
  background: var(--wash-dark-2); color: var(--ivory); font: 600 15px/1 var(--font);
}
/* The same tips on a phone: a stone block under the lead. */
.acct__tips { border-radius: var(--r-md); padding: var(--s-4) 20px; }
@media (min-width: 1100px) { .acct__tips { display: none; } }
.acct__keep { color: var(--ink-2); }
.acct__keep .icon { flex: none; width: 20px; height: 20px; color: var(--accent-ink); }
.acct__keep > span { flex: 1 1 0; min-width: 0; }

/* A passphrase field: a capsule with the quiet show / hide button inside, at its end. */
.passfield {
  display: flex; align-items: center; gap: var(--s-1); min-width: 0;
  min-height: 52px; padding-inline-end: var(--s-3);
  border-radius: var(--pill); background: var(--tile); box-shadow: var(--ring-field);
  transition: box-shadow .3s var(--ease);
}
.tile .passfield, .modal .passfield { background: var(--ground); }
.passfield:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }
.field--error .passfield { box-shadow: inset 0 0 0 2px var(--danger); }
.passfield .field__input, .tile .passfield .field__input, .modal .passfield .field__input,
.field--error .passfield .field__input {
  flex: 1 1 0; min-width: 0; background: transparent; box-shadow: none;
}
.passfield__toggle { flex: none; min-width: 4em; font-size: 15px; }

.passtips { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); font: 400 15px/1.45 var(--font); color: var(--ink-2); }
.passtips li { position: relative; padding-inline-start: 18px; }
.passtips li::before {
  content: ""; position: absolute; inset-inline-start: 0; top: .55em;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}

/* The recovery key: 4 x 2 on a phone, one row of eight on desk. Each group reads left to right. */
.rkey {
  list-style: none; margin: 0; padding: var(--s-3);
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-2);
  background: var(--stone); border-radius: var(--r-md);
}
.rkey__group {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0;
  padding: 10px 6px; border-radius: var(--r-sm); background: var(--tile);
}
.rkey__no { font: 400 14px/1.4 var(--font); color: var(--ink-3); }
.rkey__text { font: 600 17px/1.4 var(--font-code); user-select: all; }
@media (max-width: 359.98px) { .rkey__text { font-size: 15px; } }
@media (min-width: 1100px) {
  .rkey { grid-template-columns: repeat(8, minmax(0, 1fr)); padding: var(--s-4); gap: var(--s-3); }
  .rkey__group { padding: var(--s-4) var(--s-2); }
  .rkey__text { font-size: 22px; }
}

/* ---------- settings: security and backup (4.10) ---------- */

.devices { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.devices__row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  min-height: 56px; padding: var(--s-3) var(--s-4); border-radius: var(--r-sm); background: var(--ground);
}
.devices__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.devices__label { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); font: 600 16px/1.3 var(--font); }
.devices__err { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); color: var(--ink-2); }

/* The three exits: a soft row each, the button at the start and what it does beside it. */
.sec-acts { display: grid; gap: var(--s-2); }
.sec-act {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-4);
  min-height: 56px; padding: var(--s-2) var(--s-4); border-radius: var(--r-sm); background: var(--ground);
}
.sec-act .btn { flex: none; }
.sec-act p { flex: 1 1 200px; min-width: 0; }

/* ---------- the project list ---------- */

.upload-offer__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
@media (max-width: 599.98px) {
  .upload-offer__actions { flex-direction: column; align-items: stretch; flex: 1 1 100%; }
}

/* ---------- one household ---------- */

.mrow__state { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
/* The invite while its link is prepared, or when it could not be: the height of a short message, so the sheet does not jump. */
.isheet__wait { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-3); min-height: 88px; justify-content: center; }
.isheet__wait .t-cap { display: inline-flex; align-items: center; gap: var(--s-2); }
.isheet__dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--ink-3); animation: sync-pulse 1.2s var(--ease) infinite alternate; }
/* A whole WhatsApp message is pasted: the field is a few lines, the button sits under it. */
.paste--server { grid-template-columns: minmax(0, 1fr); row-gap: var(--s-3); }
.paste--server .paste__add { margin-block-start: 0; justify-self: start; }
.paste--server .field__input { min-height: 88px; resize: vertical; overflow-wrap: anywhere; }
@media (max-width: 599.98px) {
  .paste--server .paste__add { justify-self: stretch; }
}

/* ---------- the report ---------- */

.rp-answers { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin-block-start: var(--s-3); }

/* ---------- the answers dialog (4.13) ---------- */

.answers__group { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.answers__group legend { padding: 0; margin-block-end: var(--s-2); }
.answers__list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.answers__row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: var(--s-3); row-gap: 2px;
  min-height: 56px; padding: var(--s-2) var(--s-4); border-radius: var(--r-sm); background: var(--ground);
  transition: background .3s var(--ease);
}
.answers__row.is-counted { background: var(--accent-wash); }
.answers__pick { display: flex; align-items: center; gap: var(--s-3); min-width: 0; min-height: 40px; cursor: pointer; }
.answers__pick input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
/* An answer that cannot be chosen keeps the column of the radio buttons, empty. */
.answers__pick--off { cursor: default; padding-inline-start: calc(20px + var(--s-3)); color: var(--ink-2); }
.answers__text { display: flex; flex-direction: column; min-width: 0; font: 600 16px/1.3 var(--font); }
.answers__text .t-cap { color: var(--ink-2); }
.answers__tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s-1); }
.answers__help { grid-column: 1 / -1; padding-inline-start: calc(20px + var(--s-3)); color: var(--ink-2); }
.answers__newer { color: var(--ink); }

/* ---------- the trash (4.12) ---------- */

.trash__head { margin-block: var(--s-3) 0; }
.trash .crumb { margin: 0; }
/* The list and, beside it, what the trash means and the way back: neither is stretched. */
.trash__body { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap-tiles); align-items: start; }
.trash__about { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-4); }
.trash__about .passtips { color: var(--ink-2); }
.trash__none p { color: var(--ink-2); }
/* A row notice like the others (the result's "more photos" row): the words at the start, the way back at the end.
   A button parked in the middle of the row left its far half empty. */
.trash__none { padding: var(--pad-tile); border-radius: var(--r-lg); gap: var(--s-4) var(--s-6); }
.trash__none > .stack { flex: 1 1 auto; min-width: 0; }
@media (min-width: 1100px) {
  .trash__body { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  /* Six and six: a row is then about as wide as its name and its two buttons need. */
  .trash__list, .trash__about { grid-column: span 6; }
}
.trows { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.trow {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3) var(--s-4);
  min-height: 56px; padding: var(--s-3) var(--s-4); border-radius: var(--r-sm); background: var(--ground);
}
.trow__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.trow__name { font: 600 17px/1.3 var(--font); }
.trow__text .t-cap { color: var(--ink-2); }
.trow__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); flex: none; }
@media (max-width: 599.98px) {
  /* Phone: the two buttons sit under the text. */
  .trow { flex-direction: column; align-items: stretch; }
}
