/* THE SIGNED-IN PAGES: sign in, set up, the first screen, profile. Builds on
   styles.css (its color tokens and fonts); no colors are written here. Layout
   follows the approved mockup: a quiet brand panel beside the sign-in form;
   once signed in, a top bar with the place picker, apps and the profile
   menu (tabs along the bottom on a phone).

   SIZES (decided November 2026, review): made for people who aren't at ease
   with computers, and for thumbs. Text people read is about 16px, hints and
   small print 15px, only tiny badges 13px; anything you press is at least 44px
   tall (inputs and main buttons 48px). */

body.signed-in, body.auth { min-height: 100vh; display: flex; flex-direction: column; }
main.screens { flex: 1; display: flex; flex-direction: column; }
[hidden] { display: none !important; }

/* ---------- Buttons, fields, messages ---------- */
.btn { font: 600 16px var(--font); min-height: 48px; border-radius: 10px; padding: 12px 18px; border: 1px solid transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.quiet:hover { border-color: var(--accent); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--line-strong); }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }
.link-btn { background: none; border: 0; min-height: 44px; padding: 10px 4px; font: 600 16px var(--font); color: var(--accent); cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-size: 16px; font-weight: 600; }
.field .hint { font-size: 15px; color: var(--muted); }
.input { font: 17px var(--font); min-height: 48px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; padding: 11px 13px; width: 100%; }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.code-input { font: 600 24px var(--font); letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.notice { font-size: 16px; border-radius: 10px; padding: 10px 12px; background: var(--accent-soft); color: var(--ink); }
.notice.error { background: var(--danger-soft); color: var(--danger); }
.small { font-size: 15px; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 18px; }

/* ---------- Sign in: brand panel + form ---------- */
.auth-wrap { display: grid; grid-template-columns: 1fr 1fr; flex: 1; }
.auth-brand { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; gap: 32px; min-width: 0;
  padding-block: 40px; padding-left: max(40px, env(safe-area-inset-left, 0px)); padding-right: 40px; }
.lockup { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; }
.lockup img { width: 30px; height: 30px; }
.auth-brand .big { font-family: var(--font-display); font-weight: 700; font-size: clamp(32px, 3.8vw, 48px); line-height: 1.05; letter-spacing: -0.025em; margin: 0; }
.auth-brand .big span { color: var(--gold); }
.auth-brand ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; color: var(--muted); font-size: 16px; }
.auth-form { display: grid; place-items: center; min-width: 0; padding-block: 40px; padding-left: 24px; padding-right: max(24px, env(safe-area-inset-right, 0px)); }
.card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 18px; }
.card h1 { font-size: 28px; margin: 0; }
.card .lede { color: var(--muted); margin: 0; }
.mailbox { width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.mailbox svg { width: 28px; height: 28px; }

/* ---------- Signed in: top bar ---------- */
.topbar { display: flex; align-items: center; gap: 14px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
  padding-block: 10px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.topbar .lockup { font-size: 16px; }
/* "Groundwork has been updated" (js/shell.js): under the top bar, until Reload. */
.update-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--accent-soft); color: var(--ink); padding-block: 10px;
  padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.topbar .lockup img { width: 28px; height: 28px; }
.switcher { position: relative; }
.switcher select { appearance: none; font: 600 16px var(--font); min-height: 44px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 30px 9px 26px; max-width: 220px; cursor: pointer; }
.switcher::before { content: ""; position: absolute; left: 11px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 3px; background: var(--gold); pointer-events: none; }
.switcher::after { content: ""; position: absolute; right: 12px; top: 50%; width: 6px; height: 6px; margin-top: -5px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); pointer-events: none; }
.tabs { display: flex; gap: 2px; min-width: 0; overflow-x: auto; }
.tab { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 12px; border-radius: 10px; font-size: 16px; font-weight: 500; color: var(--muted); white-space: nowrap; text-decoration: none; }
.tab .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--accent)); }
.tab svg { width: 22px; height: 22px; color: var(--c, var(--accent)); }
.tab[aria-current="page"] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.spacer { flex: 1; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font: 700 14px var(--font); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); cursor: pointer; flex: none; }
.avatar.big { width: 52px; height: 52px; font-size: 18px; cursor: default; }

/* The profile menu (top right) */
.menu { position: absolute; right: max(16px, env(safe-area-inset-right, 0px)); top: 60px; width: 300px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 10; display: flex; flex-direction: column; }
.menu .who { display: flex; gap: 10px; align-items: center; padding: 10px; min-width: 0; }
.menu .who div { min-width: 0; }
.menu .who b { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; }
.menu .who span { font-size: 15px; color: var(--muted); overflow-wrap: anywhere; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.menu .item { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 12px; border-radius: 9px; font: 16px var(--font); color: var(--ink); text-decoration: none; background: none; border: 0; cursor: pointer; text-align: left; width: 100%; }
.menu .item:hover { background: var(--bg); }
.menu .item .r { margin-left: auto; font-size: 14px; color: var(--muted); }
.menu .item.danger { color: var(--danger); }
.menu .label { font-size: 15px; font-weight: 600; padding: 6px 10px 4px; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 3px; background: var(--bg); border-radius: 10px; margin: 0 10px 8px; }
.modes button { border: 0; background: none; color: var(--muted); font: 500 15px var(--font); min-height: 44px; padding: 8px; border-radius: 8px; cursor: pointer; }
.modes button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.ops { display: flex; flex-direction: column; gap: 2px; padding: 0 6px 6px; }
.op { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 10px; border-radius: 8px; font: 16px var(--font); color: var(--ink); background: none; border: 0; cursor: pointer; text-align: left; width: 100%; }
.op.current { background: var(--accent-soft); font-weight: 600; }
.op .role { margin-left: auto; font-size: 14px; color: var(--muted); }

/* ---------- Page body ---------- */
.page-body { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px;
  padding-block: 28px 40px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.date { font-size: 16px; color: var(--muted); }
.hello { font-family: var(--font-display); font-weight: 700; font-size: 32px; letter-spacing: -0.02em; margin: 0; }
.grid2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; }
.grid2:has(> .panel[hidden]) { grid-template-columns: 1fr; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel h2 { font: 700 19px var(--font-display); color: var(--ink); margin: 0; }
.panel p { margin: 0; color: var(--muted); font-size: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 16px; font-weight: 600; padding: 8px 14px; border-radius: 99px; border: 1px solid var(--line-strong); color: var(--ink); text-decoration: none; }
button.chip { background: transparent; font-family: var(--font); cursor: pointer; }
a.chip:hover { border-color: var(--accent); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.coming { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.coming a { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 12px; min-height: 44px; padding: 6px 0; color: var(--ink); text-decoration: none; font-size: 16px; }
.coming a:hover .what { text-decoration: underline; }
.coming .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.coming .what { min-width: 0; overflow-wrap: anywhere; }
.coming .when { color: var(--muted); font-size: 15px; white-space: nowrap; }
.coming .late .when { color: var(--danger); }
.coming .more a { display: flex; color: var(--accent); text-decoration: underline; }
.checklist { display: flex; flex-direction: column; gap: 10px; font-size: 16px; list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 12px; align-items: center; min-height: 44px; }
.box { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--line-strong); flex: none; display: grid; place-items: center; }
.box.done { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.box svg { width: 14px; height: 14px; }
.done-text { color: var(--muted); text-decoration: line-through; }

/* ---------- Setting up an operation ---------- */
.setup { flex: 1; display: flex; justify-content: center; padding-block: 36px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.setup .card { max-width: 560px; }
.steps { display: flex; gap: 6px; }
.steps i { height: 4px; flex: 1; border-radius: 4px; background: var(--line); }
.steps i.on { background: var(--accent); }
.apps-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.apps-pick label { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); cursor: pointer; font-weight: 600; font-size: 16px; min-width: 0; }
.apps-pick input { accent-color: var(--accent); width: 22px; height: 22px; margin: 0 0 0 auto; order: 3; }
.apps-pick label:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.app-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 15%, var(--surface)); flex: none; }
.app-icon svg { width: 18px; height: 18px; }
.qr { width: 180px; height: 180px; background: var(--on-accent); border-radius: 12px; padding: 8px; border: 1px solid var(--line); }
.secret { font: 600 16px ui-monospace, Consolas, monospace; letter-spacing: .08em; overflow-wrap: anywhere; background: var(--bg); padding: 8px 10px; border-radius: 8px; }
.invite { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); }
.invite .what { flex: 1; min-width: 180px; }
.invite .actions { display: flex; gap: 8px; }

/* ---------- Profile ---------- */
.profile-wrap { display: grid; grid-template-columns: 220px 1fr; flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; }
.pnav { padding: 24px 14px; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--line); }
.pnav a { display: flex; align-items: center; min-height: 44px; padding: 8px 12px; border-radius: 9px; font-size: 16px; white-space: nowrap; color: var(--ink); text-decoration: none; }
.pnav a:hover { background: var(--surface); }
.pbody { padding-block: 28px 48px; padding-left: 32px; padding-right: max(32px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.pbody h1 { font-size: 30px; margin: 0; }
.sect { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; scroll-margin-top: 80px; }
.sect > header { padding: 16px 18px 6px; }
.sect > header h2 { font-size: 19px; margin: 0; }
.sect > header p { font-size: 15px; color: var(--muted); margin: 2px 0 0; }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.sect > header + .row { border-top: 0; }
.row .k { width: 170px; font-size: 16px; font-weight: 600; flex: none; }
.row .v { flex: 1; min-width: 180px; font-size: 16px; overflow-wrap: anywhere; }
.row .v .small { display: block; }
.row form { display: flex; gap: 8px; flex: 1; min-width: 220px; flex-wrap: wrap; }
.row form .input { flex: 1; min-width: 160px; }
.pill { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.pill.warn { background: var(--warn-soft); color: var(--warn-ink); }
.pill.plain { background: var(--bg); color: var(--muted); }
.mode-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 150px)); gap: 10px; }
.mode-card { border: 1px solid var(--line-strong); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; background: none; color: var(--ink); font: 600 15px var(--font); text-align: left; }
.mode-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.mode-card .pv { height: 52px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); position: relative; overflow: hidden; }
.mode-card .pv::before { content: ""; position: absolute; inset: 0 0 66% 0; background: var(--surface); }

.not-connected { max-width: 520px; margin: 80px auto; text-align: center; display: flex; flex-direction: column; gap: 12px; padding-inline: 20px; }

/* ---------- Operation settings ---------- */
.person-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.role-select { width: auto; min-width: 190px; }
.activity { list-style: none; margin: 0; padding: 4px 18px 14px; display: flex; flex-direction: column; }
.activity li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; flex-wrap: wrap; }
.activity li:first-child { border-top: 0; }
#archive .btn.danger { border-color: var(--danger); }
input[readonly], select:disabled { color: var(--muted); }

/* ---------- Phones ---------- */
@media (max-width: 860px) {
  .auth-wrap, .grid2, .profile-wrap { grid-template-columns: 1fr; }
  .auth-brand { border-right: 0; border-bottom: 1px solid var(--line); padding: 24px max(20px, env(safe-area-inset-left, 0px)); }
  .auth-brand ul, .auth-brand .big { display: none; }
  .pnav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 14px; }
  .pbody { padding: 20px max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px)); }
  .row .k { width: 100%; }
  .apps-pick { grid-template-columns: repeat(2, 1fr); }
  /* The app switcher becomes tabs along the bottom. */
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--line); justify-content: space-around;
    padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
  .tab { flex-direction: column; gap: 3px; font-size: 13px; min-height: 52px; min-width: 64px; padding: 6px 8px; justify-content: center; }
  body.signed-in .page-body { padding-bottom: 96px; }
  .topbar .lockup span { display: none; }
}
@media (max-width: 460px) {
  .switcher select { max-width: 150px; }
  .apps-pick { grid-template-columns: 1fr; }
  .mode-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .tab, .item { transition: background-color .12s, border-color .12s, color .12s; }
}

/* ---------- What's New: the button left of the profile picture, and its window ---------- */
.whats-new { position: relative; display: inline-flex; align-items: center; gap: 7px; min-height: 44px; min-width: 44px; justify-content: center; font: 600 15px var(--font); color: var(--muted); background: none; border: 1px solid transparent; border-radius: 10px; padding: 8px 10px; cursor: pointer; flex: none; }
.whats-new:hover { color: var(--ink); border-color: var(--line-strong); }
.whats-new svg { width: 18px; height: 18px; }
.whats-new[hidden] { display: none; }
/* The gold spark: something you haven't seen yet. */
.wn-dot { position: absolute; top: 6px; left: 24px; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); border: 2px solid var(--surface); }
.wn-dot[hidden] { display: none; }

.wn { width: min(620px, calc(100vw - 32px)); max-height: min(720px, calc(100vh - 48px)); padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
.wn[open] { display: flex; flex-direction: column; }
.wn::backdrop { background: var(--ink); opacity: .35; }
.wn-head { display: flex; align-items: flex-start; gap: 12px; padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.wn-head > div { flex: 1; min-width: 0; }
.wn-head h2 { font: 700 22px var(--font-display); margin: 0 0 6px; }
.wn-versions { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; font-size: 15px; color: var(--muted); }
.wn-versions b { color: var(--ink); }
.wn-versions code { font: 14px ui-monospace, "Cascadia Mono", Consolas, monospace; }
/* The close button: an X drawn with two bars. */
.wn-close { position: relative; width: 44px; height: 44px; border-radius: 9px; border: 0; background: none; cursor: pointer; flex: none; color: var(--muted); }
.wn-close:hover { background: var(--bg); color: var(--ink); }
.wn-close::before, .wn-close::after { content: ""; position: absolute; left: 14px; top: 21px; width: 16px; height: 2px; border-radius: 2px; background: currentColor; transform: rotate(45deg); }
.wn-close::after { transform: rotate(-45deg); }
.wn-body { overflow-y: auto; padding: 8px 24px 24px; }
.wn-release { padding: 18px 0; }
.wn-release + .wn-release { border-top: 1px solid var(--line); }
.wn-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wn .pill { text-transform: none; }
.wn-release h3 { font: 700 19px var(--font-display); margin: 10px 0 8px; }
.wn-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.wn-notes li { display: flex; gap: 10px; align-items: baseline; font-size: 16px; line-height: 1.5; }
.wn-tag { flex: none; width: 84px; text-align: center; font-size: 13px; font-weight: 700; padding: 2px 0; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.wn-tag.improved { background: var(--bg); color: var(--ink); }
.wn-tag.fixed { background: var(--warn-soft); color: var(--warn-ink); }
@media (max-width: 860px) {
  .wn-label { display: none; }
  .whats-new { padding: 7px; }
  .wn-dot { left: 19px; }
  .wn-head { padding: 18px 16px 14px; }
  .wn-body { padding: 4px 16px 20px; }
  .wn-notes li { flex-direction: column; gap: 4px; }
  .wn-tag { width: auto; padding: 2px 8px; }
}
