/* Earful app. Same tokens as the site (/design/tokens.css), turned down for daily use: white ground, grey-50 panels,
   flat field colours only where they mean something, Roundo throughout, black pill buttons. */
:root {
  --ui-body: 1rem;
  --ui-title: clamp(2.25rem, 1.5rem + 2.6vw, 3.5rem);
  --ui-head: 1.375rem;
  --ui-gap: var(--space-4);
  --input-bg: var(--surface);
  --page-max: 76rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: var(--weight-text) var(--ui-body) / var(--leading-text) var(--font);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}
h1,
h2,
h3 {
  margin: 0;
  font-weight: var(--weight-display);
  letter-spacing: var(--tracking-head);
  line-height: var(--leading-head);
  text-wrap: balance;
}
h1 {
  font-size: var(--ui-title);
  letter-spacing: var(--tracking-display);
  line-height: 0.95;
}
h2 {
  font-size: var(--ui-head);
}
p {
  margin: 0;
  text-wrap: pretty;
}
a {
  color: inherit;
  text-underline-offset: 0.18em;
}
code {
  font-family: inherit;
  font-weight: var(--weight-strong);
  overflow-wrap: anywhere;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: var(--gutter);
  top: var(--space-2);
  z-index: 10;
  background: var(--action);
  color: var(--action-ink);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
}
.small,
.muted {
  font-size: var(--step-small);
}
.muted {
  color: var(--muted);
}
.bad {
  color: var(--bad);
}
.inline {
  display: inline;
}
[hidden] {
  display: none !important;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
}
.narrow {
  max-width: 40rem;
}

/* ---- Bar: the wordmark on ear pink, tabs as pills ---- */
.demo-band {
  margin: 0;
  padding: var(--space-2) var(--gutter);
  background: var(--field-dark);
  color: var(--field-dark-ink);
  font-size: var(--step-small);
  text-align: center;
}
.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-6);
  padding: var(--space-3) var(--gutter);
  background: var(--field-pink);
  color: var(--field-pink-ink);
}
.wordmark {
  font-weight: var(--weight-display);
  font-size: 1.75rem;
  letter-spacing: -0.04em;
  line-height: 1;
  text-decoration: none;
}
.tabs {
  display: flex;
  gap: var(--space-1);
}
.tabs a {
  white-space: nowrap;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  font-weight: var(--weight-strong);
  font-size: var(--step-small);
  text-decoration: none;
  transition: background-color var(--dur-fast);
}
.tabs a:hover {
  background: color-mix(in srgb, var(--field-pink-ink) 8%, transparent);
}
.tabs a[aria-current='page'] {
  background: var(--action);
  color: var(--action-ink);
}
.who {
  margin-left: auto;
  display: flex;
  gap: var(--space-3);
  align-items: center;
  font-size: var(--step-small);
}
.who-ws {
  font-weight: var(--weight-strong);
}
.who select {
  background: transparent;
  font-weight: var(--weight-strong);
  padding-block: var(--space-1);
}

/* ---- Page ---- */
.page {
  flex: 1;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--space-6) var(--gutter) var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-5);
  padding-top: var(--space-2);
}
.head-meta {
  font-size: var(--step-small);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}
.lede {
  max-width: 46rem;
  font-size: var(--step-small);
}
.back {
  font-size: var(--step-small);
  font-weight: var(--weight-strong);
}
.back a {
  text-decoration: none;
}
.notice {
  align-self: flex-start;
  background: var(--field-cyan);
  color: var(--field-cyan-ink);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-small);
  font-weight: var(--weight-strong);
  font-size: var(--step-small);
  max-width: 100%;
}
.foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  justify-content: center;
  padding: var(--space-6) var(--gutter);
  font-size: var(--step-small);
  color: var(--muted);
}
.foot a {
  text-decoration: none;
}
.foot a:hover {
  text-decoration: underline;
}

/* ---- Surfaces: panels are a tone step, fields are flat brand colour ---- */
.panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  --input-bg: var(--bg);
}
.field {
  border-radius: var(--radius);
  padding: var(--space-6) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: flex-start;
  --input-bg: var(--bg);
}
.field h1,
.field h2 {
  font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem);
  letter-spacing: var(--tracking-display);
  line-height: 0.95;
}
.field p {
  max-width: 36rem;
}
.field-pink {
  background: var(--field-pink);
  color: var(--field-pink-ink);
}
.field-cyan {
  background: var(--field-cyan);
  color: var(--field-cyan-ink);
}
.field-surface {
  background: var(--surface);
}
.lone {
  padding-block: var(--space-8);
}
.grid2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: var(--space-4);
}

/* ---- Controls ---- */
input,
select,
textarea {
  font: inherit;
  font-size: var(--ui-body);
  color: var(--ink);
  background: var(--input-bg);
  border: 2px solid transparent;
  border-radius: var(--radius-small);
  padding: 0.625rem 0.875rem;
  min-height: 2.75rem;
  max-width: 100%;
  transition: border-color var(--dur-fast);
}
input:hover,
select:hover,
textarea:hover {
  border-color: color-mix(in srgb, var(--ink) 14%, transparent);
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--focus);
}
input:disabled {
  opacity: 0.5;
}
input[type='file'] {
  background: none;
  padding-inline: 0;
  font-size: var(--step-small);
}
textarea {
  width: 100%;
  line-height: var(--leading-text);
  resize: vertical;
}
label,
legend {
  font-weight: var(--weight-strong);
  font-size: var(--step-small);
}
fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}
::placeholder {
  color: var(--muted);
  opacity: 1;
}

.btn,
.btn-link,
.tag {
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 2.75rem;
  padding: 0 1.5rem;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--action);
  color: var(--action-ink);
  font-weight: var(--weight-strong);
  white-space: nowrap;
  transition:
    transform var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast);
}
.btn:hover {
  background: var(--action-hover);
}
.btn:active {
  transform: scale(0.97);
}
.btn-quiet {
  background: var(--input-bg);
  color: var(--ink);
}
.btn-quiet:hover {
  background: color-mix(in srgb, var(--ink) 10%, var(--input-bg));
}
.btn-small {
  min-height: 2.5rem;
  padding: 0 1.125rem;
  font-size: var(--step-small);
}
.btn-block {
  width: 100%;
}
.btn-link {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: var(--step-small);
  font-weight: var(--weight-strong);
  text-decoration: underline;
}
.btn-link.danger {
  color: var(--bad);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* Chips say how a site's replies get back: cyan straight from Earful, pink on the site, plain copied in */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.625rem;
  border-radius: var(--radius-small);
  font-size: var(--step-small);
  font-weight: var(--weight-strong);
  white-space: nowrap;
  background: var(--bg);
  color: var(--ink);
}
.chip[data-path='direct'] {
  background: var(--field-cyan);
  color: var(--field-cyan-ink);
}
.chip[data-path='site'] {
  background: var(--field-pink);
  color: var(--field-pink-ink);
}
.stars {
  color: var(--star);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.stars-off {
  color: color-mix(in srgb, var(--ink) 14%, transparent);
}
.flag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: var(--step-small);
  color: var(--muted);
}
.flag-open {
  color: var(--ink);
  font-weight: var(--weight-strong);
}
.flag-open::before {
  content: '';
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background: var(--unread);
}
.flag-done {
  color: var(--ok);
  font-weight: var(--weight-strong);
}
.flag-bad {
  color: var(--bad);
}
.tag {
  display: inline-flex;
  align-items: center;
  border: 0;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-small);
  background: var(--input-bg);
  color: var(--ink);
  font-size: var(--step-small);
}
.tag:hover {
  background: color-mix(in srgb, var(--ink) 10%, var(--input-bg));
}

/* Segmented pills: inbox status, settings sections */
.seg {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-1);
  background: var(--surface);
  border-radius: var(--radius-pill);
  align-self: flex-start;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.seg a {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  font-weight: var(--weight-strong);
  font-size: var(--step-small);
  text-decoration: none;
  white-space: nowrap;
}
.seg a:hover {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
}
.seg a[aria-current] {
  background: var(--action);
  color: var(--action-ink);
}
.count {
  background: var(--unread);
  color: var(--black);
  border-radius: var(--radius-pill);
  padding: 0 0.5rem;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

/* ---- Inbox ---- */
/* Filters sit open on wide screens; on a phone app.js folds them behind one button */
.filterbox {
  background: none;
  padding: 0;
}
.filterbox > summary {
  display: none;
  list-style: none;
}
.filterbox > summary::-webkit-details-marker {
  display: none;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}
.filters input[type='search'] {
  flex: 1 1 16rem;
}
.more {
  display: contents;
}
.more summary {
  cursor: pointer;
  font-size: var(--step-small);
  font-weight: var(--weight-strong);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  list-style: none;
}
.more summary::-webkit-details-marker {
  display: none;
}
.more summary::after {
  content: ' +';
}
.more[open] summary::after {
  content: ' −';
}
.more-body {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  order: 10;
  padding: var(--space-3);
  background: var(--surface);
  border-radius: var(--radius-small);
  --input-bg: var(--bg);
}
.more-body label {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
  font-weight: var(--weight-text);
}

.rv-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.rv {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border-radius: 20px;
  transition: background-color var(--dur-fast);
}
.rv:hover {
  background: color-mix(in srgb, var(--ink) 6%, var(--surface));
}
.rv-top {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  align-items: center;
}
.rv-when {
  margin-left: auto;
  font-size: var(--step-small);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.rv-who {
  font-size: 1.0625rem;
  font-weight: var(--weight-strong);
  letter-spacing: 0;
  margin-top: var(--space-1);
}
.rv-who a {
  text-decoration: none;
}
/* The whole row opens the review; tags stay their own links */
.rv-who a::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.rv-where {
  font-weight: var(--weight-text);
  font-size: var(--step-small);
  color: var(--muted);
}
.rv-title {
  font-weight: var(--weight-strong);
}
.rv-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 62rem;
}
.rv-foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  align-items: center;
  margin-top: var(--space-1);
  --input-bg: var(--bg);
}
.rv-foot .tag {
  position: relative;
  z-index: 1;
}
.rv.is-open {
  background: var(--bg);
  box-shadow: inset 0 0 0 2px var(--surface);
}
.rv.is-open:hover {
  background: var(--surface);
}
.pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-3);
}
.pager > :last-child {
  justify-self: end;
}

/* ---- Review and reply ---- */
.detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 30rem);
  gap: var(--space-5);
  align-items: start;
}
.review {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5) 0;
}
.review-who {
  font-size: clamp(2rem, 1.5rem + 2vw, 3rem);
}
.review-where {
  color: var(--muted);
  font-size: var(--step-small);
  margin-top: calc(-1 * var(--space-2));
}
.review-title {
  font-weight: var(--weight-strong);
  font-size: 1.25rem;
}
.review-text {
  font-size: 1.125rem;
  white-space: pre-line;
  max-width: 40rem;
}
.owner-reply,
.translation {
  margin: 0;
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border-radius: 20px;
  white-space: pre-line;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.tools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  align-items: center;
}
.add-tag {
  display: inline-flex;
  gap: var(--space-2);
}
.add-tag input {
  width: 10rem;
  min-height: 2.5rem;
  padding-block: 0.375rem;
}
.reply {
  position: sticky;
  top: var(--space-4);
  background: var(--field-pink);
  color: var(--field-pink-ink);
  border-radius: var(--radius);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  --input-bg: var(--bg);
}
.reply h2 {
  font-size: 2rem;
  letter-spacing: var(--tracking-display);
}
.how {
  font-size: var(--step-small);
  display: flex;
  gap: var(--space-2);
  align-items: baseline;
}
.how .chip {
  background: var(--bg);
  color: var(--ink);
}
.reply textarea {
  min-height: 14rem;
}
.reply .btn-quiet {
  background: var(--bg);
}
.send {
  padding-top: var(--space-2);
}

/* ---- Locations ---- */
.loc-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  align-items: baseline;
}
.pr-list,
.al-list,
.keys,
.check-list,
.bars {
  list-style: none;
  margin: 0;
  padding: 0;
}
.pr-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.pr {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7rem 6rem 13rem 7.5rem;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--bg);
  border-radius: var(--radius-small);
  font-size: var(--step-small);
  --input-bg: var(--surface);
}
.pr-name {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  align-items: center;
  font-size: var(--ui-body);
  font-weight: var(--weight-strong);
}
.pr-name a {
  text-decoration: none;
}
.pr-name a:hover {
  text-decoration: underline;
}
.pr-name .bad {
  flex-basis: 100%;
  font-weight: var(--weight-text);
}
.pr-name .chip {
  background: var(--surface);
}
.pr-name .chip[data-path='direct'] {
  background: var(--field-cyan);
}
.pr-name .chip[data-path='site'] {
  background: var(--field-pink);
}
.pr-stat {
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.pr-stat strong {
  font-size: var(--ui-body);
}
.pr-how {
  color: var(--muted);
}
.pr-act {
  justify-self: end;
}
.add {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}
.add input[type='url'],
.add input[name='email'],
.add input[name='key'],
.add input[name='label'] {
  flex: 2 1 16rem;
}
.add input[name='name'] {
  flex: 1 1 10rem;
}
.add-loc {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius);
  background: var(--surface);
  --input-bg: var(--bg);
}
.loc-foot {
  display: flex;
  justify-content: flex-end;
}
.checks {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
}
.check-list li {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr) auto 5rem;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  align-items: baseline;
  border-radius: var(--radius-small);
}
.check-list li:nth-child(odd) {
  background: var(--surface);
}

/* ---- Alerts ---- */
.al-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.al {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 9rem auto;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border-radius: 20px;
  --input-bg: var(--bg);
}
.al > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.al-to {
  font-size: var(--step-small);
  overflow-wrap: anywhere;
}
.al-act {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  justify-content: flex-end;
}
.alert-form {
  max-width: 48rem;
}
.picks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.picks legend {
  margin-bottom: var(--space-2);
}
.pick {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0 var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--input-bg);
  cursor: pointer;
  font-weight: var(--weight-strong);
}
.pick input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.pick:has(:checked) {
  background: var(--action);
  color: var(--action-ink);
}
.pick:has(:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---- Reports ---- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  background: var(--field-pink);
  color: var(--field-pink-ink);
  border-radius: var(--radius);
  padding: var(--space-5);
}
.stats div {
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-1);
}
.stats dt {
  font-size: var(--step-small);
  font-weight: var(--weight-strong);
}
.stats dd {
  margin: 0;
  font-size: clamp(2.25rem, 1.6rem + 2.4vw, 3.75rem);
  font-weight: var(--weight-display);
  letter-spacing: var(--tracking-display);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.bars {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.bars li {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: center;
  font-size: var(--step-small);
}
.bar-track {
  display: block;
  width: 100%;
  height: 0.875rem;
  border-radius: var(--radius-pill);
  background: var(--bg);
  overflow: hidden;
}
.bar-track rect {
  fill: var(--ink);
}
.bar-value {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---- Settings ---- */
.settings {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  max-width: 52rem;
}
.settings > * {
  scroll-margin-top: var(--space-4);
}
.plan-name {
  font-size: clamp(3rem, 2rem + 4vw, 5rem);
  font-weight: var(--weight-display);
  letter-spacing: var(--tracking-display);
  line-height: 0.9;
}
.plan .btn-quiet {
  background: var(--bg);
}
.keys {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.keys li {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  align-items: center;
  padding: var(--space-2) var(--space-3);
  background: var(--bg);
  border-radius: var(--radius-small);
}
.keys li > :last-child {
  margin-left: auto;
}
details {
  border-radius: var(--radius-small);
  background: var(--bg);
  padding: var(--space-3) var(--space-4);
}
details summary {
  cursor: pointer;
  font-weight: var(--weight-strong);
}
details[open] summary {
  margin-bottom: var(--space-3);
}
details .stack {
  --input-bg: var(--surface);
}

/* ---- Signed out: the one loud screen ---- */
body.bare .bar {
  background: var(--field-pink);
}
body.bare .page {
  max-width: none;
  padding: 0;
  gap: 0;
}
body.bare .page > .lone {
  border-radius: 0;
  min-height: 70svh;
  padding: var(--space-8) var(--gutter);
  justify-content: center;
}
body.bare .page > .notice {
  margin: var(--space-4) var(--gutter) 0;
}
.gate {
  background: var(--field-pink);
  color: var(--field-pink-ink);
  min-height: 78svh;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: var(--space-7);
  align-items: center;
  padding: var(--space-7) var(--gutter) var(--space-9);
}
.gate h1 {
  font-size: clamp(3.5rem, 1rem + 9vw, 9rem);
  line-height: var(--leading-display);
}
.gate-words {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.gate-words p {
  font-size: var(--step-lead);
  max-width: 34rem;
}
.gate-form {
  background: var(--bg);
  color: var(--ink);
  border-radius: var(--radius);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 28rem;
  width: 100%;
  justify-self: end;
}
.gate-form h2 {
  font-size: 1.75rem;
  margin-bottom: var(--space-2);
}
.gate-form .btn {
  min-height: 3.25rem;
  margin-top: var(--space-1);
}

/* ---- Narrow screens ---- */
@media (max-width: 960px) {
  .detail {
    grid-template-columns: 1fr;
  }
  .reply {
    position: static;
  }
  .pr {
    grid-template-columns: auto auto 1fr auto;
  }
  .pr-name {
    grid-column: 1 / -1;
  }
  .pr-how {
    text-align: right;
  }
  .al {
    grid-template-columns: 1fr auto;
  }
  .al-act {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
  .gate {
    grid-template-columns: 1fr;
    align-items: start;
    gap: var(--space-6);
  }
  .gate-form {
    justify-self: stretch;
    max-width: none;
  }
}
@media (max-width: 640px) {
  .bar {
    gap: var(--space-2) var(--space-3);
    padding-bottom: var(--space-2);
  }
  .tabs {
    order: 3;
    flex-basis: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
  }
  .tabs {
    justify-content: space-between;
  }
  .tabs a {
    padding-inline: 0.5rem;
    font-size: 0.8125rem;
  }
  .demo-band {
    font-size: 0.75rem;
  }
  .demo-more {
    display: none;
  }
  .filterbox > summary {
    display: inline-flex;
  }
  .filterbox[open] > summary {
    margin-bottom: var(--space-3);
  }
  .who-email {
    display: none;
  }
  .who-ws {
    max-width: 11rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .page {
    padding-top: var(--space-5);
    gap: var(--space-4);
  }
  .panel,
  .reply {
    padding: var(--space-4);
    border-radius: 22px;
  }
  .rv {
    padding: var(--space-4);
  }
  .filters select {
    flex: 1 1 8rem;
  }
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-5) var(--space-3);
  }
  .bars li {
    grid-template-columns: 5.5rem minmax(0, 1fr);
  }
  .bar-value {
    grid-column: 2;
    margin-top: calc(-1 * var(--space-2));
  }
  .check-list li {
    grid-template-columns: 1fr auto;
  }
  .pr-how {
    grid-column: 1 / -1;
    text-align: left;
    order: 5;
  }
  .gate h1 {
    font-size: clamp(3.25rem, 17vw, 5rem);
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* ---- API docs (/api/docs) and place search results ---- */
.api-docs {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.api-intro {
  max-width: 48rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.api-layout {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}
.api-toc {
  position: sticky;
  top: var(--space-4);
  max-height: calc(100svh - 2 * var(--space-4));
  overflow-y: auto;
  font-size: 0.875rem;
}
.api-toc ul {
  list-style: none;
  margin: var(--space-1) 0 var(--space-3);
  padding: 0;
}
.api-toc a {
  text-decoration: none;
}
.api-ops {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}
.api-op h3 {
  font-size: 1.125rem;
}
.api-op h4 {
  margin: var(--space-2) 0 0;
}
.api-method {
  display: inline-block;
  min-width: 3.6em;
  font-size: 0.75rem;
  font-weight: var(--weight-strong);
  letter-spacing: 0.04em;
}
.api-method[data-method='post'],
.api-method[data-method='put'],
.api-method[data-method='patch'] {
  color: var(--field-cyan-ink);
}
.api-method[data-method='delete'] {
  color: var(--danger, #b3261e);
}
.api-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.api-table th,
.api-table td {
  text-align: left;
  vertical-align: top;
  padding: var(--space-1) var(--space-2);
  border-bottom: 1px solid var(--line, #0001);
}
.api-field[data-depth='1'] {
  padding-left: var(--space-5);
}
.api-responses {
  margin: 0;
  padding-left: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.api-example {
  margin: 0;
  padding: var(--space-3);
  background: var(--bg);
  border-radius: 12px;
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.45;
}
.api-example code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: normal;
  overflow-wrap: normal;
}
.cand-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.cand-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  align-items: center;
  padding: var(--space-2) 0;
  border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
}
.cand-what {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cand-act {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}
@media (max-width: 52rem) {
  .api-layout {
    grid-template-columns: 1fr;
  }
  .api-toc {
    position: static;
    max-height: none;
  }
}

/* ---- AI reading, auto-replies, review links ---- */
.translation {
  border-left: 4px solid var(--field-cyan);
}
.flag[data-sentiment] {
  text-decoration: none;
  font-weight: var(--weight-strong);
}
.flag[data-sentiment='positive'] {
  color: var(--ok);
}
.flag[data-sentiment='negative'] {
  color: var(--bad);
}
.aq-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.aq {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--surface);
}
.num {
  width: 5rem;
}
.log-list li {
  grid-template-columns: 7rem minmax(0, 1fr) 11rem minmax(0, 2fr);
}
.log-list li > :last-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 640px) {
  .log-list li {
    grid-template-columns: 1fr;
    gap: 0;
  }
}
.review-link summary {
  cursor: pointer;
  font-weight: var(--weight-strong);
}
.review-link[open] {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.rl {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: flex-start;
}
.rl-qr {
  width: 9rem;
  flex: none;
  background: #fff;
  border-radius: var(--radius-small);
}
.rl-qr svg {
  display: block;
  width: 100%;
  height: auto;
}
.rl code {
  word-break: break-all;
}

/* ---- App charts and map rank grids: SVG styled here, since the CSP allows no inline styles ---- */
.chart {
  width: 100%;
  height: auto;
}
.chart-grid {
  stroke: var(--muted);
  stroke-opacity: 0.25;
}
.chart-label {
  fill: var(--muted);
  font-size: 11px;
}
.chart-line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.5;
  stroke-linejoin: round;
}
.chart-release line {
  stroke: var(--field-orange);
  stroke-dasharray: 4 3;
}
.heat {
  width: 100%;
  max-width: 32rem;
  height: auto;
}
.heat text {
  font-size: 13px;
  font-weight: var(--weight-strong);
  fill: var(--ink);
}
.heat .r-top rect {
  fill: var(--ok-bg);
}
.heat .r-mid rect {
  fill: var(--warn-bg);
}
.heat .r-low rect {
  fill: var(--field-orange);
}
.heat .r-none rect {
  fill: var(--bad-bg);
}
.heat .r-wait rect {
  fill: var(--bg);
  stroke: var(--muted);
  stroke-opacity: 0.4;
}
.key {
  display: inline-block;
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
}
.key.r-top {
  background: var(--ok-bg);
}
.key.r-mid {
  background: var(--warn-bg);
}
.key.r-low {
  background: var(--field-orange);
}
.key.r-none {
  background: var(--bad-bg);
}
