/* Beach's screens: what each one assembles out of `beach.css`'s components.
 *
 * Loaded after `beach.css` and depends on its custom properties — the two are
 * one stylesheet split at a real seam. See the header of `beach.css`.
 *
 * Phone first, at 393, and only the phone: the desktop frames and the always-on
 * wall are `wide.css`, which loads after this file. Splitting there rather than
 * at the halfway mark is what keeps a change to the Queue card in one file and a
 * change to the 1440 layout in another. */

/* Moving between the four tabs is a cross-fade rather than a white flash. One
 * at-rule, no script, no router: the browser does it for same-origin
 * navigations and simply ignores the rule where it is not supported. */
@view-transition { navigation: auto; }

/* --- the live tracker --------------------------------------------------- */

.live {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--ok);
  font-size: var(--t-small);
  font-weight: 600;
}
.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.28; } }

.tracker { display: grid; gap: 10px; }

.tracker-line {
  display: grid;
  grid-template-columns: 36px 8px 1fr;
  gap: 11px;
  align-items: stretch;
}

.tracker-time {
  font-size: var(--t-small);
  font-weight: 500;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

/* The rail: a dot per line, joined by a hairline that stops at the last one.
 *
 * The dot and the line are both pseudo-elements of a cell that stretches to the
 * row's full height, so the connector can be anchored top-and-bottom. Sizing it
 * as a percentage of the dot instead — which is the obvious way to write this —
 * makes the rail a fixed few pixels long, and it visibly falls apart the moment
 * the rows get taller, which is exactly what the always-on screen does. */
.tracker-dot { position: relative; width: 7px; }
.tracker-dot::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line);
}
.tracker-line:not(:last-child) .tracker-dot::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 16px;
  /* Into the next row's gap, so the rail is continuous between dots. */
  bottom: -12px;
  width: 1px;
  background: var(--line);
}
/* The newest line is the one still happening, so it is the one in accent and
 * the only one at full ink. Everything behind it has already been dealt with. */
.tracker-line:first-child .tracker-dot::before { background: var(--accent); }
.tracker-line:first-child .tracker-headline { color: var(--ink); font-weight: 600; }
.kind-approval .tracker-dot::before { background: var(--warn); }

.tracker-body { display: grid; gap: 1px; min-width: 0; }
.tracker-headline { font-size: var(--t-body); color: var(--muted); line-height: 1.45; }
.tracker-headline a { color: var(--accent); font-weight: 600; }
.tracker-detail { font-size: var(--t-small); color: var(--faint); }
.kind-approval .tracker-headline { color: var(--warn); }

/* Arrived over the stream rather than in the server-rendered page. It has to be
 * visible that a line *arrived* — a live feed that redraws silently is a static
 * list as far as anyone watching it is concerned. */
.tracker-line.is-new { animation: land 0.55s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes land {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: none; }
}
.tracker-line.is-new .tracker-dot::before { animation: ping 1.1s ease-out; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 var(--accent-soft); } 100% { box-shadow: 0 0 0 9px transparent; } }

/* --- Today -------------------------------------------------------------- */

/* Frame 01 puts the tracker on the page itself, not in a box: a label, a rail
 * and the lines. The card only becomes a card at 1440, where D1 draws one. */
.screen-today .card-live { background: none; border: 0; border-radius: 0; overflow: visible; }
.screen-today .card-live .card-head { padding: 0 0 11px; }
.screen-today .tracker-foot { display: none; }

.screen-today .top { padding-bottom: 0; }
.screen-today .top h1 { order: 2; }
.screen-today .top .mark { order: 1; }
.screen-today .top .eyebrow { order: 3; }

.attention:active { transform: scale(0.995); }

.stats { display: flex; gap: 4px; }
.stat { flex: 1; min-width: 0; display: grid; gap: 2px; }
.stat-number { font-size: 21px; font-weight: 600; letter-spacing: -0.024em; line-height: 1.1; }
.stat-label { font-size: var(--t-small); color: var(--muted); }

.tracker-foot { display: grid; gap: 14px; }
.rule { height: 1px; background: var(--line); }
.foot-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.event { display: flex; gap: 12px; }
.event .row-time { color: var(--ink); }

/* --- the Queue ---------------------------------------------------------- */

.queue-head { display: grid; gap: 13px; }
.queue-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.queue-title h1 { font-size: var(--t-title); font-weight: 600; letter-spacing: -0.028em; }
.queue-count { font-size: var(--t-title); font-weight: 600; letter-spacing: -0.028em; color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }

.cards { display: grid; gap: 11px; }
.card-flag {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: var(--t-tiny);
  font-weight: 600;
}
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-who { display: flex; align-items: center; gap: 6px; min-width: 0; }
.card-who span {
  font-size: var(--t-small);
  font-weight: 600;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-subject {
  font-size: var(--t-subject);
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  display: block;
}
.card-preview {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-actions { display: flex; gap: 8px; padding-top: 3px; }
.card-actions form { display: contents; }
.card-actions .button { flex: 1; }

.queue-read { display: none; }

/* --- draft review ------------------------------------------------------- */

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top) + 18px) var(--pad) 12px;
}
.navbar .back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: var(--tap);
  font-size: 14.5px;
  font-weight: 500;
}
.navbar .pos { font-size: 12px; color: var(--faint); }

.addr { display: grid; gap: 6px; }
.addr div { display: flex; align-items: baseline; gap: 8px; }
.addr dt { width: 34px; flex: none; color: var(--faint); font-size: 11.5px; }
.addr dd { margin: 0; font-size: var(--t-body); font-weight: 500; overflow-wrap: anywhere; }

.thread-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: var(--tap);
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.thread-link summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; }
.thread-link summary::-webkit-details-marker { display: none; }
details.thread { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
details.thread > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 11px 13px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}
details.thread > summary::-webkit-details-marker { display: none; }
details.thread[open] > summary { border-bottom: 1px solid var(--line); }

.message { padding: 12px 14px; border-top: 1px solid var(--line); }
.message:first-of-type { border-top: 0; }
.message-head { display: flex; align-items: center; gap: 8px; }
.message-who { font-size: var(--t-body); font-weight: 600; flex: 1; }
.message-subject { font-size: 12px; color: var(--muted); margin-top: 6px; }
.message-body, .draft-body, .transcript { white-space: pre-wrap; }
.message-body { font-size: 12.5px; line-height: 1.5; margin-top: 6px; color: var(--muted); }
.attachments { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }

.draft-card { display: grid; gap: 10px; padding: 15px; }
.draft-card .draft-subject { font-size: var(--t-subject); font-weight: 600; line-height: 1.35; }
.draft-body { font-size: var(--t-body); line-height: 1.6; }

.sources { display: flex; flex-wrap: wrap; gap: 7px; }
.source {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: var(--t-small);
  font-weight: 500;
}
.source code { color: var(--faint); }

/* The one irreversible control in Beach. Held at the bottom of the phone screen
 * so it is reachable, and never adjacent to reject by accident: reject and edit
 * are 46px icon squares, approve is everything else. */
.screen-draft .actions {
  display: block;
  position: sticky;
  bottom: calc(env(safe-area-inset-bottom) + var(--tabs-h) + 20px);
  padding: 12px 0 0;
  background: linear-gradient(to bottom, rgba(246, 243, 238, 0), var(--bg) 30%);
}
.action-panel { display: grid; gap: 10px; }
.action-panel > form > .button, .action-panel > details > summary { width: 100%; }
.field-label { font-size: 11.5px; color: var(--faint); }
.screen-draft textarea, .screen-draft input[type="text"] {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.screen-draft textarea { line-height: 1.5; resize: vertical; }
.action-edit[open] summary, .action-reject[open] summary { margin-bottom: 8px; }
.action-edit summary, .action-reject summary { cursor: pointer; list-style: none; }
.action-edit summary::-webkit-details-marker,
.action-reject summary::-webkit-details-marker { display: none; }
.action-edit form, .action-reject form { display: grid; gap: 8px; }

/* --- voice -------------------------------------------------------------- */

.mic-wrap { display: grid; justify-items: center; gap: 10px; padding: 8px 0 0; }
.mic {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  box-shadow: 0 0 0 10px var(--accent-soft);
  cursor: pointer;
  color: #fff;
  display: grid;
  place-items: center;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.mic:active, .mic.is-held { transform: scale(0.94); box-shadow: 0 0 0 18px var(--accent-soft); }
.mic-hint { font-size: var(--t-body); font-weight: 600; color: var(--muted); }

/* The waveform from frame 04: bars behind the playhead in accent, ahead of it
 * in line. Drawn from a repeating set rather than thirty elements of markup. */
.wave { display: flex; align-items: center; justify-content: center; gap: 3px; height: 44px; }
.wave i { width: 4px; border-radius: 2px; background: var(--accent); }
.wave i:nth-child(3n) { height: 38px; }
.wave i:nth-child(3n + 1) { height: 22px; }
.wave i:nth-child(3n + 2) { height: 30px; }
.wave i:nth-child(4n) { height: 44px; }
.wave i:nth-child(5n) { height: 16px; }
.wave i.ahead { background: var(--line); }

.quote { display: grid; grid-template-columns: 3px 1fr; gap: 11px; }
.quote .bar { border-radius: 2px; background: var(--accent); }
.quote p { font-size: var(--t-lead); font-weight: 500; line-height: 1.45; }

.readback-top {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.026em;
}
.readback-task { font-size: var(--t-head); font-weight: 600; line-height: 1.35; }
.meta-line { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.meta-line .ic { color: var(--faint); }
.readback-match {
  display: flex;
  gap: 8px;
  padding: 11px 15px 12px;
  background: var(--bg);
  color: var(--muted);
  font-size: var(--t-small);
  line-height: 1.4;
}
.readback-match .ic { color: var(--ok); }
.keyterms { display: flex; flex-wrap: wrap; gap: 6px; }
.transcript { font-size: var(--t-lead); line-height: 1.45; }

/* --- the Log ------------------------------------------------------------ */

.kill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}
.kill-left { display: flex; align-items: center; gap: 9px; }
.kill-title { font-size: var(--t-body); font-weight: 600; }
.kill-note { font-size: var(--t-small); color: var(--muted); }

.search { display: flex; gap: 8px; align-items: center; }
.search input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 16px;
  min-height: var(--tap);
  padding: 11px 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
.search input::placeholder { color: var(--faint); }

.day-sep { display: flex; align-items: center; gap: 10px; padding-top: 4px; }
.day-sep .rule { flex: 1; }

.audit { display: grid; grid-template-columns: 38px 26px 1fr; gap: 11px; }
.audit-time {
  font-size: var(--t-small);
  font-weight: 500;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  line-height: 1.6;
}
.audit-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}
.outcome-blocked .audit-icon, .outcome-failed .audit-icon { background: var(--warn-soft); color: var(--warn); }
.outcome-failed .audit-icon { color: var(--danger); }
.audit-body { display: grid; gap: 3px; min-width: 0; }
.audit-head { font-size: var(--t-body); font-weight: 500; line-height: 1.4; }
.audit-sub { font-size: var(--t-small); color: var(--muted); line-height: 1.4; }
.cite {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  padding-top: 2px;
  color: var(--accent);
  font-size: var(--t-tiny);
  font-weight: 500;
}
.cite .ic { color: var(--faint); margin-top: 1px; }

/* --- login and offline -------------------------------------------------- */

.screen-login .shell { padding: 0; display: grid; place-items: center; min-height: 100vh; }
.login { width: min(360px, 88vw); display: grid; gap: 10px; padding: var(--pad); }
.login h1 { font-size: 34px; font-weight: 600; letter-spacing: -0.035em; }
/* The real mark, not a CSS approximation of it. `icon.svg` is already in the
 * shell cache for the manifest's sake, so this costs nothing. */
.login .mark-img { width: 46px; height: 46px; display: block; }
.login-form { display: grid; gap: 6px; margin-top: 8px; }
.login-form label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.login-form input {
  font: inherit;
  font-size: 16px;
  min-height: var(--tap);
  padding: 12px 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.login-form .button { margin-top: 10px; }
.offline-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--warn-soft);
  color: var(--warn);
}
