:root {
  color-scheme: light;
  --ink: #171916;
  --muted: #6f746d;
  --paper: #f4f5f1;
  --white: #fff;
  --line: #d9dcd5;
  --line-dark: #32352f;
  --highlight: #c9ccc6;
  --highlight-soft: #eef0ec;
  --error: #a3382d;
  --success: #2f6f43;
  --header: 76px;
}

* { box-sizing: border-box; }
html { max-width: 100%; background: var(--paper); scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0;
  max-width: 100%;
  min-height: 100svh;
  overflow-x: clip;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(23,25,22,.045) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(rgba(23,25,22,.045) 1px, transparent 1px) 0 0 / 42px 42px,
    var(--paper);
  font-family: Inter, "SF Pro Text", "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.hidden { display: none !important; }

.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; background: var(--ink); color: white; }
.skip-link:focus { top: 12px; }

.site-header {
  height: var(--header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(22px, 4vw, 64px);
  color: #fff;
  background: var(--ink);
  border-bottom: 1px solid #3b3e38;
}

.brand { display: inline-flex; align-items: center; gap: 13px; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid #474b43; }
.brand-mark img { width: 28px; height: 28px; object-fit: contain; }
.brand-word { width: 156px; height: auto; object-fit: contain; }
.header-meta { display: flex; align-items: center; gap: 30px; font-size: 12px; letter-spacing: .04em; }
.header-meta a { color: #fff; text-decoration: none; opacity: .72; }
.header-meta a:hover { opacity: 1; }
.system-status { color: #c8ccc3; }
.system-status i { display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--highlight); }

.auth-shell {
  width: 100%;
  min-width: 0;
  min-height: calc(100svh - var(--header));
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(480px, .92fr);
}

.story-panel {
  min-width: 0;
  min-height: inherit;
  padding: clamp(42px, 6vw, 90px) clamp(28px, 6vw, 92px) 30px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.story-panel::after {
  content: "AT";
  position: absolute;
  right: -4vw;
  bottom: -8vw;
  z-index: 0;
  font: 800 clamp(220px, 32vw, 580px)/.75 Arial, sans-serif;
  letter-spacing: -.12em;
  color: rgba(23,25,22,.035);
  pointer-events: none;
}
.story-copy, .agent-orbit, .story-footer { position: relative; z-index: 1; }
.eyebrow, .step-label, .list-title { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; }
.eyebrow::before { content: ""; width: 28px; height: 2px; background: var(--ink); }
.story-copy h1 { max-width: 760px; margin: 24px 0 26px; font: 600 clamp(52px, 6vw, 104px)/.94 Georgia, "Songti SC", serif; letter-spacing: -.065em; }
.story-copy h1 em { color: transparent; -webkit-text-stroke: 1.5px var(--ink); font-style: italic; }
.story-lead { max-width: 620px; margin: 0; color: #565b54; font-size: clamp(16px, 1.5vw, 21px); line-height: 1.75; }

.agent-orbit { width: min(680px, 100%); margin: auto 0; padding: 54px 0 36px; display: grid; gap: 0; }
.orbit-line { position: absolute; top: 75px; bottom: 56px; left: 25px; width: 1px; background: var(--line-dark); }
.agent-node { min-height: 86px; display: grid; grid-template-columns: 52px minmax(0,1fr) auto; align-items: center; border-top: 1px solid var(--line-dark); background: rgba(244,245,241,.7); }
.agent-node:last-child { border-bottom: 1px solid var(--line-dark); }
.agent-node.primary { background: var(--highlight); }
.agent-node.muted { color: #81867e; }
.node-number { padding-left: 4px; font: 700 12px/1 monospace; }
.agent-node strong { display: block; font: 600 18px/1.2 Georgia, serif; }
.agent-node small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.node-state { margin-right: 18px; padding: 6px 9px; border: 1px solid currentColor; font-size: 10px; letter-spacing: .12em; }
.node-state.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.story-footer { display: flex; justify-content: space-between; gap: 20px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }

.auth-panel {
  min-width: 0;
  min-height: inherit;
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,.94);
  border-left: 1px solid var(--line-dark);
  box-shadow: -24px 0 70px rgba(23,25,22,.08);
}
.panel-topline, .panel-footer { display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.panel-topline { padding: 22px clamp(28px, 5vw, 72px); border-bottom: 1px solid var(--line); }
.secure-label i { color: var(--success); margin-right: 6px; }
.auth-content { width: min(500px, calc(100% - 56px)); margin: auto; padding: 52px 0; }
.panel-heading h2, .identity-card h2 { margin: 12px 0 10px; font: 600 clamp(40px, 4vw, 62px)/1 Georgia, "Songti SC", serif; letter-spacing: -.045em; }
.panel-heading > p:last-child { margin: 0; color: var(--muted); font-size: 14px; }

.mode-switch { margin: 38px 0 30px; display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--ink); }
.mode-switch button { border: 0; padding: 14px 8px; background: transparent; color: var(--muted); cursor: pointer; }
.mode-switch button.active { background: var(--ink); color: white; }

.auth-form { display: grid; gap: 18px; }
.auth-form label > span:first-child { display: block; margin-bottom: 8px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.auth-form input { width: 100%; min-height: 56px; padding: 0 16px; border: 1px solid #bbbfb7; border-radius: 0; outline: none; color: var(--ink); background: #fafbf8; }
.auth-form input:focus { border-color: var(--ink); box-shadow: inset 4px 0 0 var(--highlight); }
.auth-form input[readonly] { color: var(--muted); background: #f0f1ed; }
.password-field { position: relative; display: block !important; margin: 0 !important; }
.password-field input { padding-right: 70px; }
.reveal { position: absolute; right: 0; top: 0; height: 56px; border: 0; padding: 0 15px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.form-row { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }
.text-action { border: 0; padding: 0; color: var(--ink); background: none; text-decoration: underline; cursor: pointer; }
.text-action:disabled { color: #a4a8a0; cursor: default; }
.form-message { min-height: 18px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.form-message.error { color: var(--error); }
.form-message.success { color: var(--success); }
.primary-action, .secondary-action, .logout-action { min-height: 58px; border: 1px solid var(--ink); cursor: pointer; }
.primary-action { display: flex; align-items: center; justify-content: space-between; padding: 0 22px; color: var(--ink); background: var(--highlight); font-weight: 700; }
.primary-action:hover { background: #d8dad5; }
.primary-action:disabled { opacity: .55; cursor: wait; }
.primary-action i { font-size: 22px; font-style: normal; }
.secondary-action { background: transparent; color: var(--ink); }
.consent { grid-template-columns: 18px 1fr; align-items: start; gap: 10px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.consent input { width: 16px; min-height: 16px; margin: 2px 0 0; accent-color: var(--ink); }
.consent > span { display: inline !important; margin: 0 !important; letter-spacing: 0 !important; text-transform: none !important; font-weight: 400 !important; }
.consent a { margin: 0 3px; color: var(--ink); }
.privacy-note { margin: 28px 0 0; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.7; }
.privacy-note span { color: var(--success); margin-right: 6px; }
.registration-stage { display: grid; gap: 18px; }
.verification-stage { display: grid; gap: 18px; }
.mail-sent { display: flex; align-items: center; gap: 13px; padding: 16px; background: var(--highlight-soft); border: 1px solid #c9ccc6; }
.mail-icon { width: 34px; height: 34px; display: grid; place-items: center; background: var(--ink); color: var(--highlight); }
.mail-sent strong, .mail-sent small { display: block; }
.mail-sent small { margin-top: 3px; color: var(--muted); }
.code-input { text-align: center; font: 700 28px/1 monospace !important; letter-spacing: .28em; }
.resend { justify-self: start; }

.signed-in { text-align: center; }
.identity-card { padding-bottom: 32px; border-bottom: 1px solid var(--line-dark); }
.identity-avatar { width: 88px; height: 88px; margin: 0 auto 24px; display: grid; place-items: center; background: var(--highlight); border: 1px solid var(--ink); font: 600 30px/1 Georgia, serif; }
.identity-card p:not(.step-label) { margin: 0; color: var(--muted); }
.verified-badge { display: inline-block; margin-top: 18px; padding: 7px 10px; color: var(--success); background: #edf7ee; font-size: 11px; }
.auth-return-message { min-height: 20px; margin: 18px 0 0 !important; color: var(--muted); font-size: 12px; }
.service-list { margin-top: 32px; text-align: left; }
.list-title { margin-bottom: 12px; color: var(--muted); }
.service-row { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 14px; min-height: 76px; padding: 0 14px; border-top: 1px solid var(--line); text-decoration: none; }
.service-row:last-child { border-bottom: 1px solid var(--line); }
.service-row:hover, .service-row.accent { background: var(--highlight-soft); }
.service-row strong, .service-row small { display: block; }
.service-row small { margin-top: 3px; color: var(--muted); }
.service-index { font: 700 11px/1 monospace; }
.service-row i { font-size: 20px; font-style: normal; }
.logout-action { width: 100%; margin-top: 24px; background: transparent; color: var(--ink); }
.logout-action:hover { background: var(--ink); color: white; }
.panel-footer { padding: 18px clamp(28px, 5vw, 72px); border-top: 1px solid var(--line); }

@media (max-width: 980px) {
  .auth-shell { grid-template-columns: 1fr; }
  .story-panel { min-height: auto; padding-bottom: 50px; }
  .story-copy h1 { font-size: clamp(50px, 11vw, 82px); }
  .agent-orbit { margin-top: 52px; padding-bottom: 30px; }
  .auth-panel { min-height: 780px; border-left: 0; border-top: 1px solid var(--line-dark); }
}

@media (max-width: 640px) {
  :root { --header: 64px; }
  .site-header { padding: 0 18px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-word { width: 124px; }
  .system-status { display: none; }
  .header-meta { gap: 0; }
  .story-panel { padding: 40px 20px 28px; }
  .story-copy h1 { margin-top: 18px; font-size: clamp(42px, 12.5vw, 50px); overflow-wrap: anywhere; }
  .story-lead { font-size: 15px; }
  .agent-node { grid-template-columns: 46px minmax(0,1fr); padding-right: 10px; }
  .agent-node strong { overflow-wrap: anywhere; }
  .node-state { display: none; }
  .story-footer { display: none; }
  .auth-panel { min-height: calc(100svh - 64px); }
  .panel-topline, .panel-footer { padding-left: 20px; padding-right: 20px; }
  .auth-content { width: calc(100% - 40px); padding: 42px 0; }
  .panel-heading h2, .identity-card h2 { font-size: 42px; }
}

@media (prefers-reduced-motion: no-preference) {
  .story-copy, .agent-orbit, .auth-content { animation: rise .6s ease both; }
  .agent-orbit { animation-delay: .08s; }
  .auth-content { animation-delay: .14s; }
  @keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
}
