/* 1BB Reach · members interface
   Light, quiet, one blue accent. Brand tokens follow pilot.css. */

:root {
  --canvas: #f5f5f7;
  --surface: #fff;
  --tint: #f2f2f5;
  --ink: #1d1d1f;
  --muted: #5f5f66;
  --line: #e1e1e6;
  --edge: #8e8e96;
  --accent: #0060c7;
  --accent-ink: #fff;
  --accent-tint: #e8f1fc;
  --ok: #1a7435;
  --warn: #b3261e;
  --warn-tint: #fdeceb;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Helvetica, Arial, sans-serif;
  --bar: 56px;
  --tabs: 60px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--bar) + 80px);
  scroll-padding-bottom: calc(var(--tabs) + 24px);
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  overflow-wrap: break-word;
}

h1, h2, h3, h4, p, ul, dl, dd, fieldset { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: var(--accent); text-underline-offset: 3px; }
h1 { font: 700 clamp(26px, 6vw, 32px)/1.15 var(--sans); letter-spacing: -.025em; }
h3 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
h4 { font-size: 16px; font-weight: 600; }
h1:focus, h2:focus, h3:focus, main:focus { outline: none; }

.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: fixed; left: 12px; top: -80px; z-index: 60;
  padding: 10px 16px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
}
.skip:focus { top: 12px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Controls ---------- */

button, input, select, textarea { font: inherit; color: inherit; }

button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 8px 20px;
  border: 0; border-radius: 999px;
  background: var(--tint); color: var(--ink);
  font-size: 15px; font-weight: 500; line-height: 1.2;
  cursor: pointer;
  transition: background-color .12s ease;
}
button:hover:not(:disabled) { background: #e7e7ec; }
button:active:not(:disabled) { transform: scale(.98); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.solid { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.solid:hover:not(:disabled) { background: #004fa6; }
button.quiet { background: transparent; color: var(--accent); }
button.quiet:hover:not(:disabled) { background: var(--accent-tint); }
button.danger { color: var(--warn); }

label { font-size: 14px; font-weight: 600; }

input:not([type=radio]):not([type=checkbox]), select, textarea {
  width: 100%; max-width: 100%; min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--edge); border-radius: 10px;
  background-color: var(--surface); color: var(--ink);
}
input:not([type=radio]):not([type=checkbox]):focus-visible, select:focus-visible, textarea:focus-visible {
  outline-offset: 0; border-color: var(--accent);
}
input[type=radio], input[type=checkbox] { width: 20px; height: 20px; flex: none; margin: 2px 0 0; accent-color: var(--accent); }
input[type=file] { padding: 8px 12px; }
textarea { display: block; min-height: 120px; resize: vertical; line-height: 1.55; }
::placeholder { color: #6e6e76; opacity: 1; }
select {
  appearance: none; cursor: pointer; padding-right: 36px; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231d1d1f' stroke-width='1.8'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
select:disabled { opacity: .5; cursor: not-allowed; }
progress { width: 100%; height: 12px; accent-color: var(--accent); }

.field { display: grid; gap: 8px; min-width: 0; align-content: start; }
.check, .choice { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; font-size: 15px; min-height: 44px; padding: 8px 0; }
fieldset.choices { border: 0; display: grid; gap: 0; min-width: 0; }
fieldset.choices legend { font-size: 14px; font-weight: 600; padding: 0; margin-bottom: 4px; }

/* ---------- Shared pieces ---------- */

.subtle { color: var(--muted); font-size: 13px; }
.hint { color: var(--muted); font-size: 14px; }
.alert { color: var(--warn); }
.draft { white-space: pre-wrap; overflow-wrap: anywhere; }
.lede { color: var(--muted); max-width: 60ch; margin-top: 8px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.empty { padding: 16px 0; color: var(--muted); }
.listtitle { margin: 32px 0 12px; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 10px; border-radius: 999px; background: var(--tint);
  font-size: 13px; font-weight: 500; line-height: 1.4; white-space: nowrap;
}
.pill::before { content: ""; width: 8px; height: 8px; flex: none; border: 1.5px solid currentColor; border-radius: 50%; }
.pill.on { color: var(--ok); background: #e8f5ec; }
.pill.on::before { background: currentColor; }
.pill.off { color: var(--muted); }

.notice {
  padding: 12px 16px; border-radius: 12px;
  background: var(--accent-tint); font-size: 15px; overflow-wrap: anywhere;
}
#update { margin-bottom: 20px; max-width: 1040px; margin-inline: auto; }
.notice-row { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; }
.notice-row > div { flex: 1 1 260px; min-width: 0; }

/* ---------- Header and shell ---------- */

.top {
  position: sticky; top: 0; z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.top-bar {
  display: flex; align-items: center; gap: 12px;
  min-height: var(--bar); max-width: 1200px; margin: 0 auto;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
}
.word {
  display: inline-flex; align-items: center; flex: none;
  font-size: 18px; font-weight: 600; letter-spacing: -.02em;
  text-decoration: none; white-space: nowrap; color: var(--ink);
}
.word b { font-weight: 700; margin-left: .25em; color: var(--accent); }
.who { display: flex; align-items: center; gap: 8px; margin-left: auto; min-width: 0; }
.member-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 14px; display: none; }

/* Mobile: bottom tab bar */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabs button {
  min-width: 0; min-height: var(--tabs); padding: 6px 2px;
  border-radius: 0; background: none;
  color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap;
  position: relative;
}
.tabs button:hover:not(:disabled) { background: none; color: var(--ink); }
.tabs button[aria-current] { color: var(--accent); font-weight: 700; }
.tabs button[aria-current]::after {
  content: ""; position: absolute; left: 20%; right: 20%; top: 0; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent);
}
.tabs button:focus-visible { outline-offset: -4px; }

.main {
  min-width: 0; max-width: 1200px; margin: 0 auto;
  padding: 20px max(16px, env(safe-area-inset-right)) calc(var(--tabs) + 48px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.statuswrap { position: sticky; top: calc(var(--bar) + 8px); z-index: 20; max-width: 1040px; margin: 0 auto; }
.status {
  position: relative; margin-bottom: 12px; padding: 14px 16px 14px 44px;
  background: var(--surface); border-radius: 14px;
  box-shadow: 0 0 0 2px var(--accent), 0 8px 24px rgba(0, 0, 0, .12);
  font-weight: 500; overflow-wrap: anywhere;
}
.status::before {
  content: "✓"; position: absolute; left: 14px; top: 13px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  font-size: 13px; line-height: 22px; text-align: center; font-weight: 700;
}
.status.alert { color: var(--warn); box-shadow: 0 0 0 2px var(--warn), 0 8px 24px rgba(0, 0, 0, .12); }
.status.alert::before { content: "!"; background: var(--warn); }
.status:empty { display: none; }

/* ---------- Views ---------- */

.view, #app > .tool { max-width: 1040px; margin: 0 auto; }
.viewhead { margin-bottom: 24px; }
.viewhead h2 { font: 700 clamp(28px, 6vw, 36px)/1.1 var(--sans); letter-spacing: -.025em; }

.sheet, .sheet-form { background: var(--surface); border-radius: 18px; padding: 20px 16px; min-width: 0; }
.sheet-form { display: grid; gap: 18px; margin-bottom: 20px; }
.sheet.narrow { max-width: 460px; margin: 24px auto; display: grid; gap: 16px; }
.sheet form { display: grid; gap: 16px; }

.progress-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.vid { display: block; width: 100%; max-width: 480px; border-radius: 12px; background: #000; max-height: 50vh; }

/* Lists */
.rows { background: var(--surface); border-radius: 18px; padding: 0 16px; }
.rows:empty { display: none; }
.row { display: grid; gap: 10px; padding: 16px 0; border-top: 1px solid var(--line); min-width: 0; }
.row:first-child { border-top: 0; }
.row-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }
.row-title strong { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.row .vid { margin-top: 4px; }
.sharelink { font-size: 14px; overflow-wrap: anywhere; }

/* Inbox */
.live-tools { margin-bottom: 16px; }
.desk { display: grid; align-items: start; background: var(--surface); border-radius: 18px; overflow: hidden; }
.desk > * { min-width: 0; }
.desk-list { padding: 16px; }
.desk-detail { padding: 20px 16px 24px; }
.desk-detail > div { display: grid; gap: 20px; }
.threads { display: none; max-height: 70vh; overflow: auto; }
.thread-row {
  display: grid; width: 100%; gap: 2px; justify-items: start; text-align: left;
  min-height: 64px; padding: 10px 14px; border-radius: 12px; background: none; font-weight: 400;
}
.thread-row strong { font-weight: 600; }
.thread-row .handle, .thread-row .snip { color: var(--muted); font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-row:hover:not(:disabled) { background: var(--tint); }
.thread-row[aria-pressed=true] { background: var(--accent-tint); }
.detailhead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.detailhead h3 { font-size: 20px; overflow-wrap: anywhere; }
.bubbles { display: grid; gap: 10px; max-height: 48vh; overflow: auto; padding: 4px; }
.bubble { max-width: min(92%, 46ch); padding: 10px 16px; border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.in { justify-self: start; background: var(--tint); }
.bubble.out { justify-self: end; background: var(--accent); color: var(--accent-ink); }
.delivery { display: grid; gap: 8px; justify-items: start; padding: 12px 14px; border-inline-start: 3px solid var(--accent); background: var(--accent-tint); border-radius: 4px 12px 12px 4px; }
.composer-form { display: grid; gap: 16px; padding-top: 20px; border-top: 1px solid var(--line); }

/* Connections */
.conn { display: grid; gap: 12px; padding: 20px 0; border-top: 1px solid var(--line); min-width: 0; }
.conn:first-child { border-top: 0; }
.conn form { display: grid; gap: 12px; max-width: 460px; }

/* Help */
details.tool { border-top: 1px solid var(--line); margin-top: 32px; }
details.tool > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 48px; padding: 8px 0; list-style: none; cursor: pointer; font-weight: 500;
}
details.tool > summary::-webkit-details-marker { display: none; }
details.tool > summary::after {
  content: ""; width: 8px; height: 8px; flex: none; margin-right: 4px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
}
details.tool[open] > summary::after { transform: rotate(-135deg); }
details.tool > div { display: grid; gap: 10px; max-width: 60ch; color: var(--muted); font-size: 15px; padding-bottom: 16px; }

/* Dialogs */
dialog {
  width: min(560px, calc(100vw - 24px)); max-height: 90dvh; overflow: auto;
  background: var(--surface); color: var(--ink);
  border: 0; border-radius: 20px; padding: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .3);
}
dialog::backdrop { background: rgba(0, 0, 0, .4); }
dialog[open] { display: grid; gap: 14px; }
dialog h2 { font-size: 22px; letter-spacing: -.02em; }
.facts { display: grid; gap: 12px; }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin-top: 2px; overflow-wrap: anywhere; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

/* ---------- Breakpoints ---------- */

@media (max-width: 359px) {
  .tabs button { font-size: 11px; letter-spacing: -.01em; }
  .word { font-size: 16px; }
  .top-bar { gap: 8px; }
  button { padding-inline: 14px; }
  dialog { padding: 18px; }
}

@media (min-width: 620px) {
  .sheet, .sheet-form { padding: 28px; }
  .desk-detail { padding: 28px; }
  .rows { padding: 0 28px; }
  .member-name { display: block; max-width: 220px; }
}

/* Desktop: list and detail side by side; only the list is the picker */
@media (min-width: 760px) {
  .desk { grid-template-columns: minmax(240px, 3fr) minmax(0, 7fr); min-height: 460px; }
  .desk-list { padding: 12px; border-right: 1px solid var(--line); }
  .threads { display: block; }
  .threadselect { display: none; }
}

/* Desktop navigation moves into the header bar */
@media (min-width: 900px) {
  :root { --bar: 60px; --tabs: 0px; }
  html { scroll-padding-top: 90px; scroll-padding-bottom: 24px; }
  .tabs {
    position: static; display: flex; gap: 2px; margin-left: 20px; padding: 0;
    background: none; border: 0;
  }
  .tabs button { min-height: 40px; padding: 6px 14px; border-radius: 999px; font-size: 15px; }
  .tabs button:hover:not(:disabled) { background: var(--tint); }
  .tabs button[aria-current] { background: var(--accent-tint); color: var(--accent); }
  .tabs button[aria-current]::after { display: none; }
  .tabs button:focus-visible { outline-offset: 2px; }
  .main { padding: 40px 32px 72px; }
  .statuswrap { top: calc(var(--bar) + 12px); }
}

/* ---------- Motion and contrast ---------- */

@media (prefers-reduced-motion: no-preference) {
  .view:not([hidden]) { animation: view-in .18s ease-out both; }
  @keyframes view-in { from { opacity: .5; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media (forced-colors: active) {
  .tabs button[aria-current], .thread-row[aria-pressed=true] { outline: 2px solid Highlight; outline-offset: -2px; }
  .pill.on::before { background: CanvasText; }
  button { border: 1px solid ButtonText; }
  .status { border: 2px solid CanvasText; }
}
