:root {
  --ink: #102426;
  --ink-soft: #405658;
  --paper: #f4f6f3;
  --paper-deep: #e7ece7;
  --line: #c7d0ca;
  --teal: #0b857c;
  --teal-deep: #056760;
  --blue: #245ee9;
  --blue-deep: #1744af;
  --amber: #f1a918;
  --red: #dc4c4c;
  --green: #1b9c72;
  --review: #5368a8;
  --white: #ffffff;
  --shadow: 0 18px 45px rgba(21, 47, 50, 0.14);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .42; }
input, select { color: var(--ink); }
::selection { color: var(--white); background: var(--teal); }

.page-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cpath d='M0 79.5H80M79.5 0V80' stroke='%2391a39e' stroke-width='.5' fill='none'/%3E%3C/svg%3E");
  background-size: 80px 80px;
}

.app-root { position: relative; min-height: 100vh; }

.page-shell,
.admin-page {
  width: min(1440px, calc(100% - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  border: 1px solid var(--line);
  background: rgba(244, 246, 243, .94);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: none;
  text-align: left;
}

.brand > span:last-child { display: grid; line-height: 1.02; }
.brand b { font-size: 15px; letter-spacing: .08em; }
.brand small { color: var(--ink-soft); font-size: 12px; letter-spacing: .08em; }

.brand-mark {
  position: relative;
  width: 34px;
  height: 34px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 5px;
  overflow: hidden;
  border: 1px solid var(--ink);
  background: var(--paper);
}

.brand-mark i { display: block; background: var(--teal); }
.brand-mark i:nth-child(2) { background: var(--blue); }
.brand-mark i:nth-child(3) { background: var(--amber); }

.topbar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.topbar-status strong { display: inline-flex; gap: 4px; margin-left: 8px; color: var(--ink); font-weight: 600; }
.topbar-status b { color: var(--teal); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(27,156,114,.12); }

.text-button,
.mini-button {
  border: 0;
  padding: 8px 0;
  color: var(--ink-soft);
  background: none;
  font-size: 13px;
}
.text-button:hover, .mini-button:hover { color: var(--teal); }
.admin-head-actions { display: flex; gap: 18px; margin-left: 8px; }

.notice {
  position: sticky;
  top: 10px;
  z-index: 12;
  width: min(720px, calc(100% - 40px));
  margin: 14px auto -6px;
  padding: 12px 16px;
  border-left: 4px solid var(--amber);
  background: #fff7df;
  color: #715400;
  font-size: 14px;
  box-shadow: 0 8px 20px rgba(87, 69, 4, .11);
}

.eyebrow,
.form-kicker,
.site-kicker {
  margin: 0 0 12px;
  color: var(--teal);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 18px; font-size: clamp(34px, 4vw, 64px); line-height: 1.04; letter-spacing: 0; }
h2 { margin-bottom: 12px; font-size: 24px; line-height: 1.2; }
.lead { max-width: 660px; color: var(--ink-soft); font-size: 17px; line-height: 1.7; }

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border: 1px solid var(--teal);
  border-radius: 4px;
  font-weight: 700;
  transition: transform .2s ease, background-color .2s ease, color .2s ease;
}
.button:hover { transform: translateY(-1px); }
.button.primary { color: var(--white); background: var(--teal); }
.button.primary:hover { background: var(--teal-deep); }
.button.secondary { color: var(--teal); background: var(--white); }
.button.secondary:hover { color: var(--white); background: var(--teal); }
.button.ghost { color: var(--ink-soft); border-color: var(--line); background: transparent; }
.button.wide { width: 100%; }

.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 28px;
  border-top: 1px solid var(--line);
  color: #6c7b7b;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .07em;
}

/* Access gate */
.access-layout {
  min-height: calc(100vh - 176px);
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(440px, .94fr);
}

.access-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(46px, 7vw, 110px);
  border-right: 1px solid var(--line);
  background: var(--paper);
}

.boundary-list {
  display: grid;
  gap: 12px;
  max-width: 510px;
  padding: 0;
  margin: 26px 0 20px;
  list-style: none;
}
.boundary-list li { display: flex; align-items: center; gap: 12px; color: var(--ink-soft); font-size: 15px; }
.boundary-list span { display: grid; width: 27px; height: 27px; place-items: center; border: 1px solid var(--line); color: var(--teal); font-family: var(--mono); font-size: 10px; background: var(--white); }
.fine-print { color: #718080; font-size: 12px; line-height: 1.6; }

.access-gate {
  position: relative;
  min-height: 640px;
  overflow: hidden;
  display: grid;
  align-content: center;
  padding: 52px;
  background: #eaf0ef;
}

.gate-visual { position: absolute; inset: 0; overflow: hidden; opacity: .98; }
.gate-label { position: absolute; top: 28px; right: 36px; color: #748482; font: 700 11px var(--mono); letter-spacing: .13em; }
.flow { position: absolute; left: -5%; right: -5%; height: 8px; border-top: 1px solid #aebbb7; border-bottom: 1px solid #aebbb7; overflow: hidden; }
.flow-one { top: 21%; } .flow-two { top: 43%; }
.flow i { position: absolute; top: 1px; width: 17px; height: 4px; background: var(--teal); animation: pass 5s linear infinite; }
.flow i:nth-child(1) { left: 6%; } .flow i:nth-child(2) { left: 42%; background: var(--blue); animation-delay: -1.7s; } .flow i:nth-child(3) { left: 75%; background: var(--amber); animation-delay: -3.5s; }
.inspection-unit { position: absolute; top: 25%; left: 48%; width: 150px; height: 166px; transform: translateX(-50%); border: 10px solid #d2ddda; border-top: 0; background: rgba(255,255,255,.58); box-shadow: 0 18px 30px rgba(38,70,73,.14); }
.inspection-unit:before { content: ""; position: absolute; inset: -16px -10px auto; height: 16px; background: var(--ink); }
.inspection-unit span { position: absolute; top: 30px; left: 0; right: 0; color: #678080; font: 700 10px var(--mono); text-align: center; letter-spacing: .13em; }
.inspection-unit b { position: absolute; left: 50%; bottom: 28px; width: 20px; height: 20px; border-radius: 50%; transform: translateX(-50%); background: var(--green); box-shadow: 0 0 0 7px rgba(27,156,114,.15); animation: inspect 2.8s ease-in-out infinite; }
.inspection-unit em { position: absolute; left: 16px; right: 16px; bottom: 14px; height: 1px; background: #aebcba; }
.route { position: absolute; left: 50%; width: 180px; height: 64px; transform: translateX(-50%); border-left: 1px solid #aebbb7; border-bottom: 1px solid #aebbb7; }
.route i { position: absolute; bottom: -5px; right: -5px; width: 10px; height: 10px; border-radius: 50%; }
.route span { position: absolute; right: -53px; bottom: -25px; font: 700 10px var(--mono); letter-spacing: .1em; }
.route-red { top: 54%; transform: translateX(-50%) rotate(22deg); } .route-red i { background: var(--red); } .route-red span { color: var(--red); }
.route-green { top: 63%; transform: translateX(-50%) rotate(-12deg); } .route-green i { background: var(--green); } .route-green span { color: var(--green); }
.route-blue { top: 72%; transform: translateX(-50%) rotate(12deg); } .route-blue i { background: var(--blue); } .route-blue span { color: var(--blue); }
.signal-loop { position: absolute; right: 10%; bottom: 7%; width: 160px; height: 160px; border: 20px solid #d0dad7; border-radius: 50%; }
.signal-loop:after { content: ""; position: absolute; inset: 22px; border: 1px dashed #8da39f; border-radius: 50%; }
.signal-loop i { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--teal); }
.signal-loop i:nth-child(1) { top: -16px; left: 50%; } .signal-loop i:nth-child(2) { right: -16px; top: 50%; background: var(--blue); } .signal-loop i:nth-child(3) { bottom: -16px; left: 50%; background: var(--green); } .signal-loop i:nth-child(4) { left: -16px; top: 50%; background: var(--amber); } .signal-loop i:nth-child(5) { top: 50%; left: 50%; background: var(--red); animation: inspect 2.2s infinite; }

.access-form {
  position: relative;
  z-index: 1;
  width: min(100%, 410px);
  margin: 150px auto 0;
  padding: 32px;
  border: 1px solid #bdcac6;
  background: rgba(255,255,255,.94);
  box-shadow: 0 16px 35px rgba(31,67,69,.16);
}
.access-form h2 { font-size: 27px; }
.access-form label, .form-panel label, .invite-form label, .admin-login-form label { display: grid; gap: 8px; color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.access-form input, .form-panel input, .invite-form input, .invite-form select, .admin-login-form input {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #b6c3bf; border-radius: 3px; outline: none; background: var(--white);
}
input:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(11,133,124,.14); }
.access-form .button { margin-top: 20px; }
.access-form p:last-child { margin: 13px 0 0; color: #778885; font-size: 11px; line-height: 1.6; }

/* Registration and diagnostic */
.process-page { min-height: calc(100vh - 176px); padding: clamp(32px, 5vw, 74px); }
.process-heading, .diagnostic-top, .admin-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 36px; padding-bottom: 30px; border-bottom: 1px solid var(--line); }
.process-heading h1, .diagnostic-top h1 { font-size: clamp(32px, 4vw, 50px); }
.process-heading > p, .diagnostic-top > p { max-width: 320px; margin: 7px 0 0; color: var(--ink-soft); line-height: 1.6; font-size: 14px; }

.registration-grid { display: grid; grid-template-columns: .85fr 1.15fr; gap: 34px; margin-top: 30px; }
.form-panel { display: grid; align-content: start; gap: 18px; }
.privacy-note { display: grid; gap: 6px; padding: 15px; border-left: 3px solid var(--amber); background: #fff9e7; color: #6a5b24; font-size: 12px; line-height: 1.6; }
.agreement-panel { border: 1px solid var(--line); background: var(--white); }
.agreement-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.agreement-head p { margin: 0; font-weight: 700; }
.agreement-head span { color: var(--teal); font: 10px var(--mono); }
.agreement-text { max-height: 260px; padding: 18px; overflow: auto; color: var(--ink-soft); font-size: 13px; line-height: 1.7; }
.agreement-check { display: flex; gap: 10px; align-items: flex-start; padding: 16px 18px; border-top: 1px solid var(--line); color: var(--ink); font-size: 13px; line-height: 1.5; }
.agreement-check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--teal); }
.form-footer { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 18px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 13px; }
.form-footer > span b { color: var(--teal); font-family: var(--mono); }

.completion { min-width: 160px; display: grid; gap: 5px; padding: 15px; border: 1px solid var(--line); background: var(--white); }
.completion span { color: var(--ink-soft); font: 10px var(--mono); letter-spacing: .08em; }
.completion strong { font-size: 28px; line-height: 1; }
.completion small { color: var(--ink-soft); font-size: 12px; font-weight: 400; }
.completion-meter, .meter { display: block; width: 100%; appearance: none; border: 0; background: #d9e1dd; }
.completion-meter { height: 5px; }
.completion-meter::-webkit-progress-bar, .meter::-webkit-progress-bar { background: #d9e1dd; }
.completion-meter::-webkit-progress-value { background: var(--teal); transition: width .25s ease; }
.completion-meter::-moz-progress-bar { background: var(--teal); transition: width .25s ease; }

.step-strip { display: flex; gap: 0; margin: 30px 0 0; overflow: auto; border: 1px solid var(--line); background: var(--white); }
.step-strip span { flex: 1 0 180px; display: flex; align-items: center; gap: 9px; min-height: 48px; padding: 0 14px; border-right: 1px solid var(--line); color: #78908e; font-size: 12px; }
.step-strip span:last-child { border-right: 0; }
.step-strip b { display: grid; width: 22px; height: 22px; place-items: center; border: 1px solid currentColor; border-radius: 50%; font: 10px var(--mono); }
.step-strip .active { color: var(--teal); background: #e7f3ef; }
.step-strip .done { color: var(--blue); }

.diagnostic-form { margin-top: 22px; }
.question-list { display: grid; border: 1px solid var(--line); background: var(--white); }
.question-row { display: grid; grid-template-columns: 44px minmax(220px, 1fr) minmax(230px, .75fr); gap: 16px; align-items: center; min-height: 84px; padding: 14px 18px; border-bottom: 1px solid #dce3df; }
.question-row:last-child { border-bottom: 0; }
.question-index { color: var(--teal); font: 12px var(--mono); }
.question-label { color: var(--ink); font-size: 14px; line-height: 1.45; }
.question-label em { display: inline-block; margin-left: 8px; color: var(--red); font-size: 10px; font-style: normal; }
.question-row select { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid #bbc8c4; border-radius: 3px; background: var(--paper); }

.result-page { min-height: calc(100vh - 176px); display: grid; grid-template-columns: 1fr minmax(340px, .7fr); align-items: center; gap: 70px; padding: clamp(42px, 7vw, 110px); }
.result-page[data-tone="red"] { --tone: var(--red); --tone-soft: #ffe8e8; }
.result-page[data-tone="amber-red"] { --tone: #d78818; --tone-soft: #fff4d8; }
.result-page[data-tone="amber-green"] { --tone: #6f9b23; --tone-soft: #eff7d5; }
.result-page[data-tone="green"] { --tone: var(--green); --tone-soft: #e6f6ed; }
.result-page[data-tone="review"] { --tone: var(--review); --tone-soft: #eaecf8; }
.status-chip { display: inline-flex; margin-bottom: 16px; padding: 5px 10px; color: var(--tone); border: 1px solid var(--tone); background: var(--tone-soft); font: 700 11px var(--mono); letter-spacing: .1em; }
.result-copy h1 { margin-bottom: 12px; color: var(--tone); }
.result-lock { display: flex; align-items: flex-start; gap: 11px; max-width: 560px; margin-top: 35px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 13px; line-height: 1.6; }
.result-lock span { flex: 0 0 auto; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--tone); }
.result-lock p { margin: 0; }
.result-meter { position: relative; overflow: hidden; padding: 36px; border: 1px solid var(--tone); background: var(--white); box-shadow: 14px 14px 0 var(--tone-soft); }
.result-meter > span { color: var(--tone); font: 700 10px var(--mono); letter-spacing: .12em; }
.result-meter > strong { display: block; margin: 24px 0 12px; color: var(--ink); font-size: 80px; line-height: .9; }
.result-meter strong small { margin-left: 8px; color: var(--ink-soft); font-size: 14px; font-weight: 400; }
.meter { height: 10px; background: #dce4df; }
.meter::-webkit-progress-bar { background: #dce4df; }
.meter::-webkit-progress-value { background: var(--tone); }
.meter::-moz-progress-bar { background: var(--tone); }
.result-meter > p { margin: 9px 0 26px; color: var(--ink-soft); font-size: 13px; }
.watermark { padding-top: 14px; border-top: 1px solid var(--line); color: #758582; font: 10px var(--mono); line-height: 1.6; }
.result-boundary { grid-column: 1 / -1; padding: 15px; border-left: 3px solid var(--tone); background: var(--tone-soft); color: var(--ink-soft); font-size: 13px; line-height: 1.6; }

/* End state */
.unavailable-panel { min-height: calc(100vh - 176px); display: grid; justify-items: center; align-content: center; padding: 50px 24px; text-align: center; }
.unavailable-panel h1 { max-width: 780px; font-size: clamp(32px, 5vw, 60px); }
.unavailable-panel > p:not(.eyebrow) { max-width: 540px; color: var(--ink-soft); line-height: 1.7; }
.unavailable-panel small { margin-top: 22px; color: #70807d; font-size: 12px; }
.unavailable-signal { display: flex; gap: 7px; margin-bottom: 22px; }
.unavailable-signal i { width: 13px; height: 13px; background: var(--red); animation: blink 1.7s ease-in-out infinite; }
.unavailable-signal i:nth-child(2) { background: var(--amber); animation-delay: .25s; } .unavailable-signal i:nth-child(3) { background: var(--blue); animation-delay: .5s; }

/* Admin */
.admin-page { background: var(--paper); }
.admin-topbar { background: var(--ink); border-color: #33484a; }
.admin-topbar .brand { color: var(--white); }
.admin-topbar .brand small, .admin-topbar .topbar-status, .admin-topbar .text-button { color: #b9ccca; }
.admin-topbar .brand-mark { border-color: #b9ccca; background: #193638; }
.admin-topbar .topbar-status strong { color: var(--white); }
.admin-login { min-height: calc(100vh - 176px); display: grid; grid-template-columns: 1fr minmax(360px, .72fr); gap: 70px; align-items: center; padding: clamp(42px, 7vw, 110px); background: #e9efec; }
.admin-login-copy p:last-child { max-width: 520px; color: var(--ink-soft); font-size: 16px; line-height: 1.7; }
.admin-login-form { display: grid; gap: 15px; padding: 32px; border: 1px solid #9fb0ac; background: var(--white); box-shadow: 12px 12px 0 #ced9d5; }
.admin-login-form > p { margin: 0; color: var(--teal); font: 700 11px var(--mono); letter-spacing: .1em; }
.admin-login-form small { color: #748582; font-size: 11px; line-height: 1.6; }

.admin-workspace { padding: clamp(28px, 5vw, 74px); }
.admin-intro h1 { margin-bottom: 8px; font-size: clamp(32px, 4vw, 52px); }
.admin-intro p:last-child { color: var(--ink-soft); }
.admin-counter { min-width: 150px; padding: 16px; border: 1px solid var(--line); background: var(--white); }
.admin-counter span { color: var(--ink-soft); font: 10px var(--mono); letter-spacing: .09em; }
.admin-counter strong { display: block; margin-top: 5px; color: var(--teal); font-size: 38px; line-height: 1; }
.admin-create, .admin-list { margin-top: 30px; border: 1px solid var(--line); background: var(--white); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.section-title p { margin: 0; font-weight: 700; }
.section-title span { color: #72817e; font-size: 12px; }
.invite-form { display: grid; grid-template-columns: 1.1fr 1.2fr 1.2fr .7fr 1.1fr auto; gap: 14px; align-items: end; padding: 20px; }
.invite-form label { min-width: 0; }
.invite-form .button { min-height: 46px; white-space: nowrap; }
.invite-list { display: grid; }
.invite-row { display: grid; grid-template-columns: 1.3fr .72fr .5fr .85fr auto; gap: 20px; align-items: center; padding: 18px 20px; border-bottom: 1px solid #dce4df; }
.invite-row:last-child { border-bottom: 0; }
.invite-person { display: grid; gap: 3px; }
.invite-person b { font-size: 14px; } .invite-person span, .invite-person small { color: var(--ink-soft); font-size: 12px; }
.invite-label { display: block; margin-bottom: 4px; color: #758683; font-size: 10px; font-family: var(--mono); }
.invite-row > div > strong { font-size: 12px; }
.state-pill { display: inline-flex; padding: 4px 7px; border: 1px solid currentColor; font-size: 11px !important; }
.state-issued { color: var(--blue); } .state-verified, .state-agreement_accepted { color: var(--teal); } .state-result_locked { color: var(--green); } .state-expired, .state-revoked { color: var(--red); }
.invite-actions { display: flex; gap: 13px; justify-content: flex-end; }
.mini-button { white-space: nowrap; } .mini-button.danger { color: var(--red); }
.empty-state { padding: 30px; color: var(--ink-soft); font-size: 14px; }

.code-modal { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(8, 27, 29, .52); }
.code-modal > div { width: min(100%, 520px); padding: 34px; border: 1px solid var(--ink); background: var(--paper); box-shadow: 16px 16px 0 var(--amber); }
.code-modal h2 { margin-bottom: 18px; }
.code-modal code { display: block; padding: 16px; overflow-wrap: anywhere; border: 1px solid var(--line); color: var(--blue); background: var(--white); font: 700 21px var(--mono); letter-spacing: .08em; }
.code-modal p:not(.eyebrow) { margin: 17px 0; color: var(--ink-soft); font-size: 13px; line-height: 1.6; }
.code-modal > div > div { display: flex; justify-content: flex-end; gap: 10px; }

@keyframes pass { from { transform: translateX(-35vw); } to { transform: translateX(110vw); } }
@keyframes inspect { 0%, 100% { transform: translateX(-50%) scale(.8); opacity: .45; } 50% { transform: translateX(-50%) scale(1.18); opacity: 1; } }
@keyframes blink { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

@media (max-width: 1050px) {
  .access-layout, .admin-login, .result-page { grid-template-columns: 1fr; }
  .access-copy { border-right: 0; border-bottom: 1px solid var(--line); }
  .access-gate { min-height: 560px; }
  .result-page { gap: 36px; }
  .result-meter { width: min(100%, 520px); }
  .invite-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invite-row { grid-template-columns: 1.2fr .8fr .6fr .8fr; }
  .invite-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 720px) {
  .page-shell, .admin-page { width: 100%; min-height: 100vh; margin: 0; border: 0; box-shadow: none; }
  .topbar { min-height: 64px; padding: 10px 16px; gap: 12px; }
  .topbar-status { display: none; }
  .topbar .text-button { margin-left: auto; }
  .page-footer { padding: 14px 16px; font-size: 9px; }
  .page-footer span:last-child { display: none; }
  .access-copy, .access-gate, .process-page, .admin-workspace { padding: 32px 20px; }
  .access-copy h1 { font-size: 42px; }
  .access-gate { min-height: 520px; padding: 20px; }
  .access-form { margin-top: 130px; padding: 24px; }
  .signal-loop { right: 4%; width: 120px; height: 120px; }
  .process-heading, .diagnostic-top, .admin-intro { display: grid; gap: 16px; }
  .registration-grid { grid-template-columns: 1fr; gap: 22px; }
  .form-footer { flex-wrap: wrap; }
  .form-footer .button { margin-left: auto; }
  .question-row { grid-template-columns: 30px 1fr; gap: 8px; padding: 16px; }
  .question-row select { grid-column: 2; }
  .step-strip span { flex-basis: 150px; }
  .result-page { padding: 46px 22px; }
  .result-meter > strong { font-size: 66px; }
  .admin-login { padding: 42px 20px; gap: 32px; }
  .admin-workspace { padding: 25px 16px; }
  .invite-form { grid-template-columns: 1fr; }
  .section-title { align-items: flex-start; flex-direction: column; gap: 6px; }
  .invite-row { grid-template-columns: 1fr 1fr; gap: 14px; padding: 16px; }
  .invite-person { grid-column: 1 / -1; }
  .code-modal > div { padding: 26px; }
  .code-modal > div > div { flex-wrap: wrap; }
}

@media (max-width: 420px) {
  h1 { font-size: 36px; }
  .brand b { font-size: 13px; }
  .brand small { font-size: 10px; }
  .access-form h2 { font-size: 23px; }
  .button { width: 100%; }
  .form-footer .button { margin-left: 0; }
  .invite-actions { flex-wrap: wrap; }
}

/* P1 opens with the approved P0 startup view, then hands over to the controlled gate. */
.p1-booting { background: #123029; }
.p1-booting .page-noise { display: none; }

.p0-boot.boot-screen {
  display: grid;
  min-height: 100vh;
  grid-template-rows: auto 1fr auto;
  padding: 26px clamp(22px, 5vw, 76px) 22px;
  background: #123029;
  color: #f8fcfa;
  font-family: "Microsoft YaHei UI", "Noto Sans SC", system-ui, sans-serif;
}

.p0-boot .boot-header {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #d4e4de;
  font-size: 13px;
  font-weight: 700;
}

.p0-boot .boot-mark {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  background: #08796d;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.p0-boot .boot-version {
  margin-left: auto;
  border: 1px solid #31544b;
  padding: 5px 8px;
  color: #a9c5bb;
  font-size: 10px;
  letter-spacing: .1em;
}

.p0-boot .boot-center {
  width: min(690px, 100%);
  align-self: center;
  justify-self: center;
  padding: 52px 0;
}

.p0-boot .boot-eyebrow {
  margin: 0 0 12px;
  color: #77c5b4;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
}

.p0-boot .boot-center h1 {
  margin: 0 0 18px;
  color: #f8fcfa;
  font-size: clamp(40px, 5vw, 68px);
  line-height: 1.08;
  letter-spacing: 0;
}

.p0-boot .boot-center > p:not(.boot-eyebrow) {
  max-width: 500px;
  margin-bottom: 34px;
  color: #b5cec5;
  font-size: 16px;
  line-height: 1.8;
}

.p0-boot .boot-sequence {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid #31544b;
  border-bottom: 1px solid #31544b;
}

.p0-boot .boot-sequence span {
  display: flex;
  min-height: 72px;
  align-items: center;
  gap: 8px;
  border-right: 1px solid #31544b;
  color: #d6e6df;
  font-size: 13px;
  opacity: 0;
  animation: p0-boot-reveal 420ms ease forwards;
}

.p0-boot .boot-sequence span:last-child { border-right: 0; }
.p0-boot .boot-sequence span:nth-child(1) { animation-delay: 140ms; }
.p0-boot .boot-sequence span:nth-child(2) { animation-delay: 310ms; }
.p0-boot .boot-sequence span:nth-child(3) { animation-delay: 480ms; }
.p0-boot .boot-sequence span:nth-child(4) { animation-delay: 650ms; }

.p0-boot .boot-sequence i {
  width: 7px;
  height: 7px;
  margin-left: 12px;
  background: #71bea9;
}

.p0-boot .boot-progress {
  height: 3px;
  margin-top: 18px;
  overflow: hidden;
  background: #35574d;
}

.p0-boot .boot-progress i {
  display: block;
  width: 0;
  height: 100%;
  background: #80d3bd;
  animation: p0-boot-progress 1800ms ease forwards;
}

.p0-boot .boot-skip {
  margin-top: 24px;
  border: 0;
  padding: 0;
  background: transparent;
  color: #b5d8cd;
  font-size: 13px;
  font-weight: 700;
}

.p0-boot .boot-skip:hover { color: #fff; }
.p0-boot .boot-footer { margin: 0; color: #84a399; font-size: 12px; }

@keyframes p0-boot-reveal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes p0-boot-progress {
  from { width: 0; }
  to { width: 100%; }
}

@media (max-width: 720px) {
  .p0-boot.boot-screen { padding: 18px; }
  .p0-boot .boot-center { padding: 42px 0; }
  .p0-boot .boot-center h1 { font-size: 40px; }
  .p0-boot .boot-sequence { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .p0-boot .boot-sequence span { min-height: 56px; border-bottom: 1px solid #31544b; }
  .p0-boot .boot-sequence span:nth-child(2n) { border-right: 0; }
  .p0-boot .boot-sequence span:nth-last-child(-n + 2) { border-bottom: 0; }
  .p0-boot .boot-sequence i { margin-left: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .p0-boot .boot-sequence span,
  .p0-boot .boot-progress i { animation: none; }
  .p0-boot .boot-sequence span { opacity: 1; }
  .p0-boot .boot-progress i { width: 100%; }
}

