  /* ---- controls: the dialog, fields, buttons, focus, cards, pills, hints, the pages' own boxes ---- */
  /* the app's own OK/Cancel dialog (the browser's confirm box can be switched off) */
  #askScrim { position: fixed; inset: 0; background: var(--scrim-strong); z-index: 40; }
  #askDialog { position: fixed; z-index: 41; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; background: var(--paper); color: var(--ink); border: var(--bw) var(--bs) var(--line); border-radius: var(--r-lg); box-shadow: var(--titlebar-paper), var(--shadow-dialog); padding: 20px 22px; }
  #askScrim[hidden], #askDialog[hidden] { display: none; }
  #askTitle { font-size: 17px; margin: 0 0 10px; }
  #askBody p { margin: 0 0 10px; font-size: 14px; line-height: 1.5; }
  .ask-changes { list-style: none; margin: 0 0 12px; padding: 0; font-size: 13.5px; line-height: 1.45; }
  .ask-changes li { padding: 8px 10px; border: var(--bw) var(--bs) var(--line); border-radius: var(--r); margin-bottom: 6px; background: var(--card); overflow-wrap: anywhere; }
  .ask-changes .ask-old { color: var(--ink-soft); }
  .ask-changes .ask-arrow { color: var(--muted); margin: 0 6px; }
  .ask-changes li.removed { border-color: var(--accent); }
  .ask-changes .ask-tag { font-weight: 600; color: var(--accent-text); margin-right: 6px; }
  .ask-buttons { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
  .ask-buttons button { min-height: 44px; min-width: 96px; }
  #profilePanel { display: none; } /* a page under You, not a panel */
  body.profile-open #profilePanel { display: block; }
  #profilePanel .section { padding: 18px 0; }
  #profilePanel .pr-rows { margin: 6px 0 4px; }
  #profilePanel textarea { width: 100%; padding: 8px 10px; background: var(--card); border: var(--bw) var(--bs) var(--field-border); border-radius: var(--r); color: var(--ink); font-size: 13px; font-family: var(--sans); resize: vertical; }
  .close-x { background: none; border: none; font-size: 24px; line-height: 1; color: var(--muted); min-width: 44px; min-height: 44px; border-radius: var(--r-md); }
  .close-x:hover { color: var(--ink); background: var(--hover-wash-strong); }
  .section { border-bottom: var(--bw) var(--bs) var(--line); padding: 18px 22px; }
  .section h2 { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-soft); margin: 0 0 12px; }
  label { display: block; font-size: 12px; color: var(--muted); margin-top: 10px; margin-bottom: 4px; }
  input[type=file]::file-selector-button { margin-right: 10px; padding: 8px 12px; min-height: 40px; background: var(--card); color: var(--ink); border: var(--bw) var(--bs) var(--line); border-radius: var(--r); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; } /* a picture's Choose file, as a secondary button */
  input[type=file]::file-selector-button:hover { background: var(--card-hover); border-color: var(--line-strong); }
  input[type=email], input[type=text], input[type=password], select, .you-page textarea, .sh-search { width: 100%; padding: 8px 10px; background: var(--card); border: var(--bw) var(--bs) var(--field-border); border-radius: var(--r); color: var(--ink); }
  input[type=email], input[type=text], input[type=password], select, .sh-search { font-size: 13px; font-family: var(--sans); } /* .you-page textarea's own is below */
  /* every select draws its own chevron (theme tokens), 12px in from the right, with room so text never runs under it. */
  select { -webkit-appearance: none; -moz-appearance: none; appearance: none; padding-right: 32px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
    background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
    background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
  select:disabled { opacity: .55; cursor: default; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); }
  select::-ms-expand { display: none; }
  /* a visible focus ring on everything (WCAG 2.4.7). */
  :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
  input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
  .sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
  .skip-link { position: absolute; left: 12px; top: -80px; z-index: 60; background: var(--ink); color: var(--on-ink); padding: 12px 16px; border-radius: var(--r-md); text-decoration: none; font-size: 14px; }
  .skip-link:focus { top: 12px; }
  .link-btn { background: none; border: none; padding: 0 2px; color: var(--accent-text); text-decoration: underline; font-size: inherit; min-height: 24px; }
  @media (pointer: coarse) { .link-btn { min-height: 44px; } } /* a touch screen of any width; after the base rule, at its weight */
  .you-page textarea { resize: vertical; font-family: var(--mono); font-size: 12px; }
  .section button { border-radius: var(--r); padding: 8px 12px; font-size: 13px; font-weight: 500; }
  .btn-primary { background: var(--accent); color: var(--on-accent); border: var(--bw) var(--bs) var(--accent); border-radius: var(--r); padding: 9px 16px; font-size: 13px; font-weight: 500; }
  .btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
  .btn-primary:disabled { opacity: .5; cursor: default; }
  /* a button that is working; a scrolling panel doesn't hand its scroll to the page behind. */
  button.is-busy { cursor: progress; }
  button.is-busy::after { content: " …"; }
  .btn-secondary, #ccRoot button:not([class]) { background: var(--card); color: var(--ink); border: var(--bw) var(--bs) var(--line); } /* a module's plain button looks like the app's */
  .btn-secondary:hover, #ccRoot button:not([class]):hover { background: var(--card-hover); border-color: var(--line-strong); }
  /* the cards: answer chips and the edit form. */
  .cc-card .card-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
  .cc-card .card-hint { margin: 8px 0 0; font-size: 12px; }
  .cc-card .card-undo { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; } /* Undo under an added item */
  .cc-card .chip, #pcChanged .chip { border-radius: var(--r-pill); padding: 8px 16px; font-size: 14px; min-height: 44px; font-family: var(--sans); cursor: pointer; }
  .cc-card .card-edit { margin-top: 10px; max-width: 420px; }
  .cc-card .card-edit textarea.card-textarea { width: 100%; min-height: 120px; padding: 10px 12px; background: var(--card); border: var(--bw) var(--bs) var(--field-border); border-radius: var(--r); color: var(--ink); font-family: var(--serif); font-size: 16px; line-height: 1.5; resize: vertical; }
  .cc-card .card-edit input:not([type=checkbox]), .cc-card .card-edit textarea.card-notes { width: 100%; padding: 8px 10px; background: var(--card); border: var(--bw) var(--bs) var(--field-border); border-radius: var(--r); color: var(--ink); font-size: 14px; font-family: var(--sans); }
  .cc-card .card-err { color: var(--danger); font-size: 13px; margin-top: 6px; }
  .cc-card .card-err:empty { display: none; }
  /* the morning sync's tick boxes. */
  .cc-card .card-tick-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
  .cc-card .card-tick { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; color: var(--ink); cursor: pointer; }
  .cc-card .card-tick-why { color: var(--muted); }
  .cc-card .card-tick-head { font-size: 13px; font-weight: 600; color: var(--ink-soft); margin: 6px 0 2px; }
  .cc-card .card-tick input { width: 20px; height: 20px; flex: none; margin: 0; accent-color: var(--accent); }
  .cc-card .card-ticks > label:not(.card-tick) { display: block; font-size: 13px; color: var(--ink-soft); margin: 4px 0 4px; }
  .btn-danger { background: transparent; color: var(--danger); border: var(--bw) var(--bs) var(--danger-border); }
  .row { display: flex; gap: 8px; margin-top: 12px; }
  .row > * { flex: 1; }
  #status { font-size: 12px; padding: 6px 0 0; }
  .ok, #status.ok { color: var(--ok-text); }
  .err, #status.err { color: var(--danger); }
  .pending, #status.pending { color: var(--muted); }
  .pill { display: inline-block; font-size: 10px; padding: 1px 7px; border-radius: var(--r-pill); margin-left: 6px; }
  .pill.pass { background: var(--ok-bg); color: var(--ok-text); border: var(--bw) var(--bs) var(--ok-line); }
  .pill.fail { background: var(--danger-bg); color: var(--danger); border: var(--bw) var(--bs) var(--danger-line); }
  .pill.wait { background: var(--rail); color: var(--muted); border: var(--bw) var(--bs) var(--line); }
  details summary { cursor: pointer; }
  .check-list { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); margin-top: 4px; }
  .check-list label { display: flex; gap: 6px; align-items: center; margin: 0; color: var(--ink); }
  .check-row { display: flex; gap: 8px; align-items: center; margin-top: 12px; color: var(--ink); font-size: 12.5px; }
  .check-row[hidden], .nav-item[hidden], .nav-label[hidden] { display: none; } /* a switched-off module's rows */
  .hint { font-size: 11.5px; color: var(--muted); line-height: 1.45; margin-bottom: 8px; }
  @media (max-width: 820px) {
    input[type=email], input[type=text], input[type=password], select, textarea, .sh-search { font-size: 16px !important; }
    .link-btn { min-height: 44px; }
  }
  /* the chats as bubbles, yours on the right: the group's and a module's in Chat, and a project's */
  #chatGroupHost .gp-chat, #chatModuleHost .gp-chat { max-height: none; overflow: visible; display: flex; flex-direction: column; gap: 8px; }
  #chatGroupHost .gp-msg, #chatModuleHost .gp-msg, .pc-msg { max-width: 82%; align-self: flex-start; background: var(--card); border: var(--bw) var(--bs) var(--line); border-radius: var(--r-lg); padding: 8px 12px; color: var(--ink); overflow-wrap: anywhere; }
  #chatGroupHost .gp-msg.mine, #chatModuleHost .gp-msg.mine, .pc-msg.mine { align-self: flex-end; background: var(--accent-soft); border-color: var(--accent); }
  #chatGroupHost .gp-msg .hint, #chatModuleHost .gp-msg .hint { color: var(--ink-soft); }
  #gpChat.gp-switching { visibility: hidden; } /* another group's chat on its way: the room kept, no jump */
  #chatGroupHost li.hint, #chatModuleHost li.hint { border: 0; }
  #chatGroupState:empty { display: none; }
  /* the Journal's and a project page's own boxes */
  .page-box { display: flex; align-items: flex-end; gap: 10px; background: var(--card); border: var(--bw) var(--bs) var(--field-border); border-radius: var(--r-lg); padding: 10px 10px 10px 18px; box-shadow: var(--shadow-field); } /* Chat's box */
  .page-box:focus-within { box-shadow: 0 0 0 3px var(--focus); }
  .page-box input, .page-box textarea { -webkit-appearance: none; appearance: none; flex: 1 1 auto; width: auto; min-width: 0; border: 0; background: none; resize: none; outline: none; font-family: var(--serif); font-size: 17px; line-height: 1.5; color: var(--ink); padding: 9px 0; min-height: 44px; max-height: 200px; } /* level with the buttons */
  .page-box input::placeholder, .page-box textarea::placeholder { color: var(--muted); }
  .page-box-send { flex: none; width: 44px; height: 44px; border-radius: var(--r-round); border: none; background: var(--accent); color: var(--on-accent); font-size: 16px; display: grid; place-items: center; padding: 0; cursor: pointer; box-shadow: var(--bevel); }
  .page-box-send:hover:not(:disabled) { background: var(--accent-hover); }
  .page-box-send:disabled { opacity: .45; cursor: default; }
  .page-box-mic { flex: none; width: 44px; height: 44px; border-radius: var(--r-round); border: var(--bw) var(--bs) var(--field-border); background: var(--card); color: var(--ink-soft); display: grid; place-items: center; padding: 0; cursor: pointer; }
  .page-box-mic[hidden] { display: none; }
  .page-box-mic.on { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent); }
  .page-box-send svg, #sendBtn svg { display: block; } /* the drawn arrow, centered */
  .gp-chat-send.page-box { margin-top: 12px; }
  @media (max-width: 820px) {
    .page-box-send, .page-box-mic { width: 44px; height: 44px; }
    .page-box input, .page-box textarea { min-height: 44px; padding: 10px 0; }
  }
