/* Desk. One hand written stylesheet, no build step.
   Tokens and measures follow the approved mockups (docs/CONTRACT.md section 5). */

@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/ibm-plex-sans-latin-400-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/ibm-plex-sans-latin-500-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/ibm-plex-sans-latin-600-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-latin-400-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-latin-500-normal.woff2) format('woff2');
}

:root {
  --plane: #0d0d0d;
  --card: #1a1a19;
  --raised: #222220;
  --hairline: #2c2c2a;
  --border: rgba(255, 255, 255, 0.10);
  --input-bg: #111110;
  --input-border: #383835;
  --text: #f4f3ef;
  --secondary: #c3c2b7;
  --muted: #a3a199;
  --action: #256abf;
  --action-hover: #2b76d3;
  --accent: #3987e5;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --link: #6da7ec;
  --link-hover: #9ec5f4;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--plane);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
}

a {
  color: var(--link);
}
a:hover {
  color: var(--link-hover);
}

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

/* --- page frame ------------------------------------------------------------ */

.top {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.01em;
  border-radius: 6px;
}
.brand:hover {
  color: var(--text);
}
.brand svg {
  flex: none;
  display: block;
}
.badge,
.badge:hover {
  color: var(--plane);
  text-decoration: none;
}
.badge {
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--warning);
  color: var(--plane);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
}
.top-label {
  color: var(--muted);
  font-size: 13px;
}

.main {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px 56px;
}
.column {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.column.is-wide {
  max-width: 1040px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.eyebrow {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 600;
}

/* --- boxes ------------------------------------------------------------------- */

.statusbox {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--raised);
  font-size: 14px;
  color: var(--secondary);
}
.statusbox svg {
  flex: none;
  margin-top: 1px;
}
.statusbox-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.statusbox strong {
  color: var(--text);
  font-weight: 500;
}

.panel {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--raised);
}
.panel svg {
  flex: none;
  margin-top: 2px;
}
.panel-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.panel-text strong {
  font-size: 16px;
  font-weight: 600;
}
.panel-text span {
  font-size: 14px;
  color: var(--secondary);
}

.livebox {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--raised);
}
.livebox-text {
  font-size: 16px;
  font-weight: 500;
}

.spinner {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--input-border);
  border-top-color: var(--accent);
  animation: desk-spin 0.8s linear infinite;
}
@keyframes desk-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2.4s;
  }
}

/* --- forms ------------------------------------------------------------------- */

.fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 13px;
  color: var(--secondary);
}
.input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder {
  color: #77766f;
  opacity: 1;
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(57, 135, 229, 0.28);
}
.input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 100px var(--input-bg) inset;
  caret-color: var(--text);
}
.input.is-code {
  height: 48px;
  font-family: var(--mono);
  font-size: 18px;
  letter-spacing: 0.12em;
}
textarea.input {
  height: auto;
  min-height: 92px;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  word-break: break-all;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: var(--action);
  color: #ffffff;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button:hover {
  background: var(--action-hover);
  color: #ffffff;
}
.button:active {
  background: #205ca6;
}
.button:disabled {
  opacity: 0.6;
  cursor: default;
}
.button.is-quiet {
  border: 1px solid var(--input-border);
  background: transparent;
  color: var(--text);
  font-weight: 500;
}
.button.is-quiet:hover {
  background: var(--raised);
}
.ghost {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  background: transparent;
  color: var(--secondary);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.ghost:hover {
  background: var(--card);
  color: var(--text);
}
.ghost:disabled {
  opacity: 0.6;
  cursor: default;
}

.note {
  font-size: 13px;
  color: var(--muted);
}
.note.is-center {
  text-align: center;
}
.note.is-error {
  color: var(--serious);
}
.text {
  margin: 0;
  font-size: 14px;
  color: var(--secondary);
}
.footnote {
  font-size: 13px;
  color: var(--muted);
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
}
.quiet-link {
  align-self: center;
  padding: 6px 8px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-decoration-color: var(--input-border);
  text-underline-offset: 3px;
  cursor: pointer;
}
.quiet-link:hover {
  color: var(--text);
}
.mono {
  font-family: var(--mono);
  font-size: 0.92em;
  white-space: nowrap;
}

/* --- steps ------------------------------------------------------------------- */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.step {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 38px;
}
.step[data-status='pending'] {
  opacity: 0.5;
}
.step-icon {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--input-border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.step-icon svg {
  display: none;
}
.step[data-status='done'] .step-icon {
  border: 0;
  background: var(--good);
}
.step[data-status='done'] .step-icon .icon-check {
  display: block;
}
.step[data-status='active'] .step-icon {
  border-top-color: var(--accent);
  animation: desk-spin 0.8s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .step[data-status='active'] .step-icon {
    animation-duration: 2.4s;
  }
}
.step[data-status='attention'] .step-icon {
  border-color: var(--warning);
}
.step[data-status='attention'] .step-icon::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warning);
}
.steps.is-serious .step[data-status='attention'] .step-icon {
  border-color: var(--serious);
}
.steps.is-serious .step[data-status='attention'] .step-icon::after {
  background: var(--serious);
}
.step[data-status='failed'] .step-icon {
  border-color: var(--serious);
}
.step[data-status='failed'] .step-icon .icon-cross {
  display: block;
}
.step-label {
  flex: 1 1 auto;
  font-size: 15px;
}
.step-detail {
  flex: none;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.step[data-status='attention'] .step-detail,
.step[data-status='failed'] .step-detail {
  color: var(--secondary);
}

/* --- done -------------------------------------------------------------------- */

.done {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.done-row {
  display: flex;
  align-items: center;
  gap: 16px;
}
.done-check {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--good);
  display: flex;
  align-items: center;
  justify-content: center;
}
.done-check svg {
  width: 26px;
  height: 26px;
}
.done-word {
  font-size: 64px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.done-line {
  font-size: 16px;
  color: var(--secondary);
}
.done-line strong {
  color: var(--text);
  font-weight: 500;
}
.summary {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
}
.facts {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 20px;
  font-size: 14px;
}
.facts dt {
  color: var(--muted);
}
.facts dd {
  margin: 0;
  min-width: 0;
}

/* --- needs code -------------------------------------------------------------- */

.codepanel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-radius: 10px;
  background: var(--raised);
}
.codepanel-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.codepanel-head svg {
  flex: none;
  margin-top: 1px;
}
.codepanel-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* --- needs human ------------------------------------------------------------- */

#human-panel .icon-phone,
#human-panel[data-reason='approve'] .icon-alert {
  display: none;
}
#human-panel[data-reason='approve'] .icon-phone {
  display: block;
}

.split {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  align-items: flex-start;
}
.split .steps {
  flex: 1 1 300px;
}
.window {
  flex: 2 1 460px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.window-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}
.window-live {
  display: flex;
  align-items: center;
  gap: 6px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good);
}
.dot.is-off {
  background: var(--serious);
}
.dot.is-wait {
  background: var(--input-border);
}
.window-frame {
  display: block;
  width: 100%;
  height: 380px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: var(--plane);
}
.window-wait {
  height: 380px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: repeating-linear-gradient(135deg, #1f1f1e 0px, #1f1f1e 12px, #242422 12px, #242422 24px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 24px;
}
.window-wait strong {
  font-size: 16px;
  font-weight: 500;
}
.window-wait span {
  font-size: 14px;
  color: var(--secondary);
  max-width: 340px;
}
.window-open {
  display: none;
  font-size: 13px;
}

/* --- the fallback ------------------------------------------------------------- */

.fallback-area {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.fallback {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-radius: 10px;
  background: var(--raised);
}
.fallback-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
a.button[aria-disabled='true'] {
  opacity: 0.6;
  cursor: default;
}

/* --- row under the card ------------------------------------------------------ */

.under {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  font-size: 13px;
  color: var(--muted);
}
.under-text {
  display: flex;
  gap: 8px;
  align-items: center;
}
.under-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: center;
}

/* --- sign in ----------------------------------------------------------------- */

.codeshow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 16px 20px;
  border-radius: 10px;
  background: var(--raised);
}
.codeshow-label {
  font-size: 13px;
  color: var(--secondary);
}
.codeshow-code {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 64px;
  line-height: 1;
  letter-spacing: 0.08em;
  /* optical centering: letter spacing adds space after the last digit */
  margin-right: -0.08em;
}
.waitline {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--secondary);
}
.input.is-two {
  height: 64px;
  text-align: center;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 30px;
  letter-spacing: 0.3em;
  padding-left: calc(14px + 0.3em);
}
.device {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--raised);
  font-size: 14px;
}
.device dt {
  color: var(--muted);
}
.device dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* --- approval page ------------------------------------------------------------ */

.done-row.is-small {
  gap: 14px;
}
.done-row.is-small .done-check {
  width: 40px;
  height: 40px;
}
.done-row.is-small .done-check svg {
  width: 20px;
  height: 20px;
}
.done-title {
  font-size: 28px;
  line-height: 1.2;
  font-weight: 600;
}

/* --- status page ------------------------------------------------------------- */

.checks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.statusbox.is-tight {
  margin-top: 6px;
}

.section-title {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--secondary);
}
.group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
}
.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 34px;
  padding-top: 7px;
}
.check .step-icon {
  margin-top: 1px;
}
.check[data-ok='yes'] .step-icon {
  border: 0;
  background: var(--good);
}
.check[data-ok='yes'] .icon-check {
  display: block;
}
.check[data-ok='no'] .step-icon {
  border-color: var(--warning);
}
.check[data-ok='no'] .step-icon::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warning);
}
.check-text {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.check-hint {
  font-size: 13px;
  color: var(--muted);
}
.check-state {
  flex: none;
  padding-top: 2px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.check[data-ok='no'] .check-state {
  color: var(--secondary);
}

/* --- phone ------------------------------------------------------------------- */

@media (max-width: 560px) {
  .top {
    flex-wrap: nowrap;
    gap: 12px;
    padding: 20px 20px 16px;
  }
  .main {
    align-items: flex-start;
    padding: 8px 16px 24px;
  }
  .card {
    padding: 24px 22px;
    gap: 20px;
  }
  .stack {
    gap: 20px;
  }
  .card.is-tight,
  .card.is-tight .stack {
    gap: 18px;
  }
  h1 {
    font-size: 26px;
  }
  .input {
    height: 48px;
    font-size: 16px;
  }
  .input.is-code {
    font-size: 18px;
  }
  .input.is-two {
    height: 64px;
    font-size: 30px;
  }
  textarea.input {
    height: auto;
    font-size: 13px;
  }
  .button.is-tall {
    height: 52px;
  }
  .step {
    min-height: 40px;
  }
  .card.is-tight .steps {
    gap: 0;
  }
  .card.is-tight .step {
    min-height: 36px;
  }
  .card.is-tight .step-label {
    font-size: 14px;
  }
  .done-row {
    gap: 14px;
  }
  .done-check {
    width: 48px;
    height: 48px;
  }
  .done-check svg {
    width: 24px;
    height: 24px;
  }
  .done-word {
    font-size: 58px;
  }
  .done-line {
    font-size: 15px;
  }
  .summary {
    gap: 12px;
    padding-top: 16px;
  }
  .footnote {
    padding-top: 14px;
  }
  .window-frame,
  .window-wait {
    height: 300px;
  }
  .window-open {
    display: block;
  }
}

/* --- demo only ----------------------------------------------------------------- */

.demo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.demo-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  align-items: baseline;
}
.demo-list a,
.demo-chips a {
  font-family: var(--mono);
  font-size: 13px;
}
.demo-list a[aria-current='true'] {
  color: var(--text);
  font-weight: 500;
}
.demo-chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.demo-chips a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  color: var(--secondary);
  text-decoration: none;
}
.demo-chips a:hover {
  background: var(--raised);
  color: var(--text);
}
.demo-message {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--raised);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--secondary);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
body.demo-window {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(135deg, #1f1f1e 0px, #1f1f1e 12px, #242422 12px, #242422 24px);
}
.demo-window-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
}
.demo-window-inner strong {
  font-size: 16px;
  font-weight: 500;
}
.demo-window-inner span {
  font-size: 14px;
  color: var(--secondary);
  max-width: 340px;
}
.demo-window-inner .badge {
  margin-top: 8px;
  color: var(--plane);
  font-size: 11px;
}
