/* The platform's own pages — sign-in, account, invitations.
 *
 * TSUNAGI///M's instrument language (hub Skill tsunagi-m-design), kept to what applies to a page
 * a person reads on a phone once in a while: a black ground, slate neutrals, and the three ///M
 * colours with one meaning each —
 *
 *   M-blue    the one thing to press; focus; "done"
 *   M-red     what cannot be undone, and what went wrong
 *   M-violet  waiting
 *
 * No fourth hue, no radius, hairlines only. Chrome is small uppercase sans; anything read from
 * the machine — an account's label, a code, a date, a device — is mono and never uppercased.
 * The brand is the platform's own and neutral: every Mainstay's people come through here, so no
 * page wears one Mainstay's colours. Sentences are larger than an instrument's 10px labels on
 * purpose: this is read by a shop's staff on a phone, not glanced at on a dash.
 *
 * Phone width first (one column, 48px targets, safe-area insets); wider screens get the same
 * column, centred. Nothing here is loaded from anywhere else: no web font, no script, no image.
 */

:root {
  color-scheme: dark;
  --ground: #000000;
  --panel: #0a0a0d;
  --raised: #17171c;
  --hairline: #2a2a33;
  --faint: #4c4c58;
  --label: #70707e;
  --body: #9a9aa8;
  --text: #c6c6cf;
  --strong: #dfdfe6;
  --blue: #26aee4; /* blue-400: 8.3:1 on black */
  --blue-mark: #0a9bdb;
  --red: #f64a50; /* red-400: 6.0:1 */
  --red-mark: #f11a22;
  --violet: #b9a6ee; /* indigo-300: 9.8:1 */
  --violet-mark: #9b84e8;
  --sans: Inter, system-ui, -apple-system, 'Segoe UI', 'Hiragino Sans', 'Yu Gothic UI', 'Noto Sans JP', sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', 'JetBrains Mono', Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
  border-radius: 0;
}

html {
  background: var(--ground);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--ground);
  color: var(--text);
  font: 14px/1.7 var(--sans);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.shell {
  max-width: 440px;
  margin: 0 auto;
  padding: 0 20px 48px;
}

/* ── the bar: the wordmark, and which page this is ─────────────────────────── */

.bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  height: 56px;
  padding-top: 20px;
  border-bottom: 1px solid var(--hairline);
}

.wordmark {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--strong);
  white-space: nowrap;
}

.wordmark .slashes {
  letter-spacing: -0.05em;
}
.wordmark .s1 { color: var(--blue-mark); }
.wordmark .s2 { color: var(--violet-mark); }
.wordmark .s3 { color: var(--red-mark); }

.label {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--label);
}

/* ── content ───────────────────────────────────────────────────────────────── */

main {
  padding-top: 28px;
}

main:focus {
  outline: none;
}

h2 {
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.5;
  font-weight: 600;
  color: var(--strong);
  text-wrap: balance;
}

p {
  margin: 0 0 12px;
  color: var(--body);
}

p.lead {
  color: var(--text);
}

section {
  padding: 22px 0;
  border-top: 1px solid var(--hairline);
}

/* The bar already draws the line above the first thing on the page: one device per edge. */
main > section:first-child {
  border-top: 0;
  padding-top: 0;
}

section > .label {
  margin-bottom: 12px;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  text-transform: none;
  letter-spacing: 0;
}

/* The account's short name: machine data, and the strongest thing on the page. */
.account {
  font-family: var(--mono);
  font-size: 22px;
  line-height: 1.2;
  color: #f2f2f5;
}

/* Who is asking, and for what: the fact the page exists to state. */
.asking {
  min-height: 52px; /* reserved: it arrives after the page, and must not move what is below */
  margin: 0 0 20px;
  padding: 0 0 0 12px;
  border-left: 2px solid var(--blue-mark);
  color: var(--text);
}
.asking strong {
  color: var(--strong);
  font-weight: 600;
}

/* ── rows of facts: devices, people, rights ────────────────────────────────── */

ul.rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

ul.rows > li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 8px 0;
  border-bottom: 1px solid var(--raised);
}
ul.rows > li:last-child {
  border-bottom: 0;
}

.row-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.row-main .mono {
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.row-main .meta {
  font-size: 11px;
  color: var(--label);
}

.tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue);
  white-space: nowrap;
}

/* ── controls ──────────────────────────────────────────────────────────────── */

button,
a.button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 10px 16px;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--text);
  font: 700 13px/1.3 var(--sans);
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:hover,
a.button:hover {
  background: var(--raised);
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* The one thing to press. Black on M-blue: 8.3:1. */
button.primary,
a.button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #000000;
}
button.primary:hover,
a.button.primary:hover {
  background: #6ccbef;
  border-color: #6ccbef;
}

button.danger {
  border-color: var(--red-mark);
  color: var(--red);
}

button.small,
a.button.small {
  width: auto;
  min-height: 44px;
  padding: 6px 12px;
  font-size: 12px;
  flex: none;
}

button[disabled] {
  border-color: var(--raised);
  background: transparent;
  color: var(--faint);
  cursor: default;
}

.stack > * + * {
  margin-top: 10px;
}

label.field {
  display: block;
  margin-bottom: 10px;
}
label.field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--label);
}

input[type='text'] {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  background: var(--raised);
  color: #f2f2f5;
  font: 16px/1.3 var(--mono); /* 16px: iOS does not zoom the page on focus */
}

label.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--text);
}
label.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

/* ── what the machine hands back: a code, a link ───────────────────────────── */

.code {
  margin: 0 0 12px;
  padding: 14px 12px;
  border: 1px solid var(--hairline);
  background: var(--panel);
  color: #f2f2f5;
  font: 17px/1.4 var(--mono);
  letter-spacing: 0.04em;
  text-align: center;
  overflow-wrap: anywhere;
  user-select: all;
}
.code.link {
  font-size: 11px;
  letter-spacing: 0;
  text-align: left;
  color: var(--text);
}

/* A QR code is read by a camera, not by a person: dark on white, whatever is around it. */
.qr {
  display: block;
  width: 200px;
  height: 200px;
  margin: 0 auto 12px;
  background: #ffffff;
}
.qr path {
  fill: #000000;
}

/* ── the status line: a fixed slot, so that what it says never moves the page ─ */

.status {
  min-height: 44px;
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--body);
}
.status[data-kind='error'] { color: var(--red); }
.status[data-kind='ok'] { color: var(--blue); }
.status[data-kind='busy'] {
  color: var(--violet);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  50% { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  .status[data-kind='busy'] { animation: none; }
}

.foot {
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
  font-size: 11px;
  color: var(--label);
}
.foot a {
  color: var(--body);
}

/* ── a document: the privacy policy ────────────────────────────────────────── */

/* Read, not operated: a wider measure, and lists that look like lists. */
.shell.doc {
  max-width: 640px;
}
.doc main ul {
  margin: 0 0 12px;
  padding: 0 0 0 1.2em;
  color: var(--body);
}
.doc main li {
  margin: 0 0 8px;
}
.doc main strong {
  color: var(--text);
  font-weight: 600;
}

/* Not in effect yet: waiting for the operator — M-violet, the colour of waiting. */
.draft {
  margin: 0 0 8px;
  padding: 14px 0 6px 14px;
  border-left: 2px solid var(--violet-mark);
}
.draft > .label {
  margin-bottom: 8px;
  color: var(--violet);
}

[hidden] {
  display: none !important;
}
