/* The screens — specs/ux.md §4, from specs/design/grouped.html.
 *
 * The arrangement is the platform's grouped list, and it is four rules:
 *
 *  · the page is sunk and the content floats on it, as cards with a gutter
 *    rather than bands running edge to edge;
 *  · the section label sits above its card, in the page — that is what makes a
 *    list read as a group instead of as a banded table;
 *  · separators start where the text starts, not at the edge of the card;
 *  · one tint, on anything that can be touched. Everything else is ink and grey.
 *
 * The palette is tokens.css and is not restated here. What this file owns is
 * density, which is the thing that deliberately did not travel from the Mac:
 * 44 px is the floor for anything tappable, and titles get the full width
 * because they are what is actually read.
 */

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
}

/* ── Navigation bar ─────────────────────────────────────────────────────── */

.navbar {
  padding: 8px 17px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  flex: none;
}
.navrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 32px;
}
.navback {
  font-size: var(--t-body);
  color: var(--ac);
  background: none;
  border: 0;
  padding: 6px 8px 6px 0;
  cursor: pointer;
}
.navtitle {
  font-size: var(--t-title);
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--tx);
}
.navtools { display: flex; align-items: center; gap: 12px; }
.navgear {
  background: none;
  border: 0;
  color: var(--ac);
  font-size: 19px;
  line-height: 1;
  padding: 10px 0 10px 4px;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
}

.personhead {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-top: 2px;
}
.personhead .who {
  flex: 1;
  min-width: 0;
}
.personhead .name {
  display: block;
  font-size: var(--t-person);
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--tx);
}
.personhead .sub {
  display: block;
  font-family: var(--mono);
  font-size: var(--t-meta);
  color: var(--tx3);
}

/* The sync pill: three states and no others — specs/ux.md §6. */
.sync {
  font-family: var(--mono);
  font-size: var(--t-meta);
  color: var(--tx3);
  display: flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.sync .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tx4);
}
.sync[data-state="up-to-date"] .dot { background: var(--ok); }
.sync[data-state="pending"] { color: var(--warn); }
.sync[data-state="pending"] .dot { background: var(--warn); }

/* ── The page and its cards ─────────────────────────────────────────────── */

.scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0 13px 8px;
  background: var(--bg);
}

.sechead {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 16px 4px 6px;
}
.sechead .lbl {
  font-size: var(--t-label);
  color: var(--tx3);
  letter-spacing: 0.09em;
  font-weight: 600;
  flex: 1;
  text-transform: uppercase;
}
.sechead .ct {
  font-family: var(--mono);
  font-size: var(--t-meta);
  color: var(--tx3);
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
}

/* ── People ─────────────────────────────────────────────────────────────── */

.row {
  display: flex;
  gap: 12px;
  padding: 9px 14px;
  align-items: center;
  min-height: 52px;
  background: transparent;
  width: 100%;
  text-align: left;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  position: relative;
}
/* Past the avatar, which is where the text starts. */
.row + .row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 58px;
  right: 0;
  border-top: 1px solid var(--hair);
}
.row:active { background: var(--hover); }
.row .body { flex: 1; min-width: 0; }
.row .ttl {
  display: block;
  font-size: var(--t-body);
  color: var(--tx);
  letter-spacing: -0.1px;
}
.row .meta {
  display: block;
  font-family: var(--mono);
  font-size: var(--t-meta);
  color: var(--tx3);
}
.row .meta.old { color: var(--warn); }
.row .chev { color: var(--tx4); font-size: var(--t-task); flex: none; }

/* ── Topics ─────────────────────────────────────────────────────────────── */
/* Title, age and co-participants are one flowing block rather than two lines.
 * The age reads as part of the sentence — "…for FY26 plan, 6 d" — and the row
 * loses the line it used to spend on a meta strip. */

.item {
  padding: 11px 14px;
  min-height: 44px;
  position: relative;
}
.item + .item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  right: 0;
  border-top: 1px solid var(--hair);
}
/* A dormant row owns its full width, so the separator either side runs edge to
 * edge — otherwise the amber stripe would start below a hairline that stops
 * short of it. */
.item.dormant + .item::before,
.item + .item.dormant::before { left: 0; }

.item .ttl {
  font-size: var(--t-body);
  line-height: 1.4;
  color: var(--tx);
  letter-spacing: -0.1px;
}
.item .age {
  font-family: var(--mono);
  font-size: var(--t-meta);
  color: var(--tx4);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  margin-left: 6px;
}
.item .age.old { color: var(--warn); }

/* Dormancy: more than thirty days since last raised, and the only colour-coded
 * state on the phone. It is also the only thing that argues with the order the
 * person chose — the app flags, they decide. */
.item.dormant {
  border-left: 3px solid var(--warn);
  padding-left: 11px;
}

/* ── Who else is on a topic ─────────────────────────────────────────────── */
/* A name if it fits on the line the title already occupies, and initials if it
 * does not. Which one applies is measured after layout, in app.js: a name is
 * worth more than an avatar, and an extra line is worth less than either. */

.with { display: inline; margin-left: 6px; }
.with .avs { display: none; }
.with[data-mode="avatars"] .pills { display: none; }
.with[data-mode="avatars"] .avs { display: inline-flex; vertical-align: -4px; }

.chip {
  display: inline-block;
  font-size: 11px;
  line-height: 1.5;
  color: var(--ac-lite);
  background: var(--ac-bg);
  border-radius: 9px;
  padding: 0 7px;
  white-space: nowrap;
  vertical-align: 1px;
}
.chip + .chip { margin-left: 4px; }

.av {
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.3px;
  background: var(--ac-bg);
  color: var(--ac-lite);
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  font-size: var(--t-task);
}
.av.sm {
  width: 19px;
  height: 19px;
  font-size: 7.5px;
  border: 1.5px solid var(--card);
}
/* Each in front of the next rather than behind it: stacked the other way the
 * leftmost initials are the ones clipped, and initials are all an avatar has. */
.avs { display: inline-flex; align-items: center; }
.avs .av.sm { position: relative; }
.avs .av.sm + .av.sm { margin-left: -6px; }

/* ── Tasks ──────────────────────────────────────────────────────────────── */
/* Their own section, in their own order. Tasks belong to contacts and not to
 * topics, so neither group nests in the other — specs/ux.md §4. */

.task {
  display: flex;
  gap: 10px;
  padding: 11px 14px;
  align-items: center;
  min-height: 44px;
  position: relative;
}
.task + .task::before {
  content: "";
  position: absolute;
  top: 0;
  left: 38px;
  right: 0;
  border-top: 1px solid var(--hair);
}
.task .box {
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--line-hard);
  border-radius: 4px;
  flex-shrink: 0;
}
.task .tt {
  font-size: var(--t-task);
  color: var(--tx2);
  flex: 1;
  min-width: 0;
}
.task .due {
  font-family: var(--mono);
  font-size: var(--t-meta);
  color: var(--tx4);
}
.task .due.over { color: var(--bad); }

/* ── Nothing there ──────────────────────────────────────────────────────── */

.empty {
  padding: 18px 14px;
  color: var(--tx3);
  font-size: var(--t-task);
  background: var(--card);
  border-radius: var(--radius);
}

/* A rejected change surfaces here, with the server's reason. The optimistic
 * interface showed it saved, so it has to be told — specs/ux.md §6. */
.banner {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--card);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius);
  color: var(--tx);
  font-size: var(--t-task);
  line-height: 1.4;
}
.banner .reason {
  font-family: var(--mono);
  font-size: var(--t-meta);
  color: var(--warn);
  display: block;
}

.footer {
  padding: 14px 4px 22px;
  font-family: var(--mono);
  font-size: var(--t-meta);
  color: var(--tx4);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

:focus-visible {
  outline: 2px solid var(--ac);
  outline-offset: -2px;
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ── Settings ───────────────────────────────────────────────────────────── */
/* One control in the navigation bar, and what is behind it belongs to the
 * installation rather than to the screen you were on — the arrangement comes
 * from garciadoral-ops. Sections are folded because this is a list of things
 * almost nobody touches. */

.sheet {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
}
.sheethead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 17px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.sheettitle {
  font-size: var(--t-person);
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--tx);
}
.sheetbody {
  flex: 1;
  overflow-y: auto;
  padding: 0 13px 24px;
}

.group {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 14px;
}
.group > summary {
  padding: 13px 14px;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: var(--t-body);
  color: var(--tx);
  cursor: pointer;
  list-style: none;
}
.group > summary::-webkit-details-marker { display: none; }
.group > summary::after {
  content: "›";
  margin-left: auto;
  color: var(--tx3);
  transform: rotate(90deg);
}
.group[open] > summary::after { transform: rotate(-90deg); }
.groupbody {
  padding: 4px 14px 16px;
  border-top: 1px solid var(--hair);
}

.stack { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding-top: 12px; }

.hint {
  margin: 0;
  font-size: var(--t-task);
  color: var(--tx2);
  line-height: 1.5;
}
.hint.problem {
  font-family: var(--mono);
  font-size: var(--t-meta);
  color: var(--warn);
}

/* Each phase closes the one before it, so this reads as what has happened and
 * not as a promise of what will. */
.progress {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
}
.progress li {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: var(--t-task);
  color: var(--tx2);
}
.progress .mark {
  font-family: var(--mono);
  font-size: var(--t-meta);
  color: var(--tx4);
  width: 1em;
  flex: none;
}
.progress li[data-step="done"] .mark { color: var(--ok); }
.progress li[data-step="failed"] { color: var(--bad); }
.progress li[data-step="failed"] .mark { color: var(--bad); }

.action {
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line-hard);
  background: var(--bg);
  color: var(--ac);
  font-family: var(--ios);
  font-size: var(--t-body);
  cursor: pointer;
}
.action:disabled { color: var(--tx4); }
.action.danger { color: var(--bad); }

.sheetbody > .hint { padding: 16px 4px 0; }

/* ── The gate ───────────────────────────────────────────────────────────── */

.gate {
  padding: 48px 11px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: flex-start;
}
.action.apple {
  align-self: stretch;
  background: var(--tx);
  color: var(--bg);
  border-color: var(--tx);
  font-weight: 600;
}

/* ── On a screen that is not a phone ─────────────────────────────────────── */
/* The layout is designed at 390 pt and stays that way. What a wide window gets
 * is the same application drawn as a surface on a page, which is the device the
 * design documents already use for exactly this. */

@media (min-width: 700px) {
  /* `:root body` on purpose: index.html sets `body { background: var(--bg) }` in
   * a style block that comes after this file, so a bare `body` here loses. */
  :root body { padding: 0; }

  #app {
    max-width: 460px;
    margin: 0 auto;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    box-shadow: var(--shadow);
  }
}

/* A mouse can hover and a finger cannot, so the feedback each one gets is
 * different: `:active` is the whole story on the phone, and on a Mac a row that
 * does not answer the pointer reads as not being a control at all. */
@media (hover: hover) and (pointer: fine) {
  .row:hover,
  .task:hover { background: var(--hover); }
  .navback:hover,
  .navgear:hover { color: var(--ac-lite); }
  .action:hover:not(:disabled) { background: var(--hover); }
  .action.apple:hover:not(:disabled) { background: var(--tx2); }
  .group > summary:hover { background: var(--hover); }
}
