:root {
  --paper: #f3f5f0;
  --paper-strong: #ffffff;
  --ink: #16211d;
  --muted: #65736c;
  --line: #cbd5ce;
  --line-strong: #aebdb4;
  --forest: #1f5549;
  --forest-deep: #153b34;
  --orange: #a94725;
  --orange-bright: #d15c32;
  --orange-soft: #f7d7c9;
  --blue: #2a7482;
  --blue-soft: #d8ebed;
  --yellow: #e7c466;
  --red: #aa3e35;
  --shadow: 0 16px 36px rgba(28, 49, 41, .09);
  --radius: 4px;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--forest); outline-offset: 3px; }
.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; }

.topbar {
  min-height: 76px;
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.wordmark { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.wordmark-mark { display: grid; place-items: center; width: 35px; height: 35px; background: var(--forest); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: 0; border-radius: 2px; }
.wordmark strong, .wordmark small { display: block; }
.wordmark strong { font-size: 12px; letter-spacing: 0; }
.wordmark small { color: var(--muted); font-size: 11px; letter-spacing: 0; margin-top: 1px; }
.topnav { display: flex; align-items: center; gap: 22px; }
.nav-logout { margin: 0; }
.nav-logout button { padding: 8px 0; border: 0; background: transparent; }
.nav-link { color: var(--forest-deep); font-size: 13px; font-weight: 700; text-decoration: none; }
.nav-link:hover { color: var(--orange); }
.nav-link-quiet { color: var(--muted); font-weight: 600; }

.page { width: min(1240px, calc(100% - 48px)); margin: 0 auto; }
.page-home { padding: 76px 0 0; }
.workbench { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 480px); gap: clamp(50px, 8vw, 140px); align-items: center; min-height: 535px; }
.route-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0; }
.route-signal { width: 8px; height: 8px; border-radius: 50%; background: var(--orange-bright); box-shadow: 0 2px 6px rgba(169,71,37,.32); }
.route-signal.is-live { background: var(--blue); box-shadow: 0 2px 6px rgba(42,116,130,.3); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 20px; font-family: Georgia, "Songti SC", "SimSun", serif; font-size: 72px; line-height: 1.03; letter-spacing: 0; font-weight: 800; }
h1 em { color: var(--forest); font-style: normal; }
.lede { max-width: 38ch; margin-bottom: 42px; color: var(--muted); font-size: 17px; }
.state-rail { display: flex; align-items: flex-start; max-width: 600px; }
.rail-step { display: grid; gap: 3px; min-width: 98px; }
.rail-step span { color: var(--orange); font-size: 11px; font-weight: 800; letter-spacing: 0; }
.rail-step strong { font-size: 13px; }
.rail-step small { color: var(--muted); font-size: 11px; }
.rail-step:not(.is-current) span { color: var(--muted); }
.rail-step.is-current strong { color: var(--forest-deep); }
.rail-rule { height: 1px; flex: 1; margin: 10px 12px 0; background: var(--line-strong); }

.tool-surface { background: var(--paper-strong); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.verify-surface { padding: 29px 31px 22px; }
.surface-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 28px; }
.surface-kicker { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0; }
.surface-head h2, .ledger-head h2 { margin: 5px 0 0; font-family: Georgia, "Songti SC", "SimSun", serif; font-size: 24px; line-height: 1.1; letter-spacing: 0; }
.surface-stamp { padding: 4px 7px; border: 1px solid var(--orange); color: var(--orange); font-size: 10px; font-weight: 800; letter-spacing: 0; }
.release-form { display: grid; gap: 11px; }
.release-form label, .form-row label { font-size: 12px; font-weight: 800; }
.input-wrap { position: relative; }
.input-wrap input { width: 100%; height: 56px; padding: 0 53px 0 16px; border: 1px solid var(--line-strong); border-radius: 2px; background: #fbfcfa; color: var(--ink); font-size: 17px; letter-spacing: 0; }
.input-wrap input::placeholder { color: var(--muted); letter-spacing: 0; }
.input-wrap input:hover { border-color: var(--forest); }
.input-wrap input:focus { border-color: var(--forest); outline: 0; box-shadow: none; }
.input-wrap input:focus-visible { outline: 3px solid var(--forest); outline-offset: 3px; }
.input-mark { position: absolute; top: 50%; right: 15px; transform: translateY(-50%); color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0; }
.field-note { min-height: 42px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 45px; padding: 0 17px; border: 1px solid transparent; border-radius: 2px; font-size: 13px; font-weight: 800; letter-spacing: 0; transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button-primary { background: var(--forest); color: #fff; }
.button-primary:hover { background: var(--forest-deep); }
.button-secondary { background: transparent; border-color: var(--line-strong); color: var(--forest-deep); }
.button-secondary:hover { border-color: var(--forest); background: #eef4ef; }
.button:disabled, .format-option:disabled, .table-action:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.icon { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.form-message { min-height: 20px; margin: 0; color: var(--red); font-size: 12px; }
.form-message.is-ok { color: var(--forest); }
.form-message:empty { display: none; }
.surface-foot { display: flex; align-items: center; gap: 8px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.mini-lock { display: inline-flex; color: var(--forest); }
.mini-lock .icon { width: 14px; height: 14px; }
.notice-band { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; align-items: center; gap: 22px; margin-top: 46px; padding: 22px 0 25px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.notice-label { color: var(--orange); font-size: 10px; font-weight: 800; letter-spacing: 0; }
.notice-band p { max-width: 68ch; margin: 0; color: var(--muted); font-size: 13px; }
.notice-code { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0; }

.page-format { padding: 82px 0 110px; }
.format-head { max-width: 800px; margin-bottom: 44px; }
.format-head h1 { margin-top: 20px; font-size: 64px; }
.mobile-break { display: none; }
.verified-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.verified-line code { padding: 5px 8px; border: 1px solid var(--line); background: var(--paper-strong); color: var(--ink); font-family: Consolas, "Courier New", monospace; font-size: 12px; letter-spacing: 0; }
.verified-mark { color: var(--forest); font-weight: 800; }
.format-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.format-option { display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 18px; min-height: 166px; padding: 24px 25px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--paper-strong); color: var(--ink); text-align: left; box-shadow: 0 8px 20px rgba(28,49,41,.05); transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.format-option:hover { transform: translateY(-3px); border-color: var(--forest); background: #f8fbf7; }
.format-option:disabled { cursor: wait; opacity: .65; transform: none; }
.format-option[aria-pressed="true"] { border-color: var(--forest); background: #edf5ef; box-shadow: 0 0 0 3px rgba(31,85,73,.16); }
.format-cpa:hover { border-color: var(--orange); }
.format-sub2:hover { border-color: var(--blue); }
.format-index { display: grid; place-items: center; width: 43px; height: 43px; border: 1px solid currentColor; color: var(--orange); font-size: 14px; font-weight: 900; }
.format-sub2 .format-index { color: var(--blue); }
.format-body strong, .format-body small { display: block; }
.format-body strong { font-size: 29px; letter-spacing: 0; }
.format-body small { margin-top: 5px; color: var(--muted); font-size: 12px; }
.format-action { display: inline-flex; align-items: center; gap: 7px; color: var(--forest); font-size: 12px; font-weight: 800; white-space: nowrap; }
.choice-warning { display: flex; align-items: flex-start; gap: 16px; margin: 0 0 16px; padding: 14px 17px; border: 1px solid #d8b39f; background: #fffaf7; color: var(--ink); font-size: 13px; }
.choice-warning p { margin: 0; }
.choice-warning strong { color: var(--orange); }
.choice-commit { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 18px; padding: 18px 20px; border: 1px solid var(--forest); background: #edf5ef; }
.choice-summary strong, .choice-summary small { display: block; }
.choice-summary strong { margin-top: 3px; font-size: 18px; }
.choice-summary small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.choice-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.choice-commit[hidden] { display: none; }
.choice-note { display: flex; align-items: center; gap: 16px; margin-top: 23px; color: var(--muted); font-size: 12px; }
.choice-note p { margin: 0; }
.choice-note .form-message { margin-left: auto; }
.choice-rule { display: block; width: 34px; height: 1px; background: var(--orange); }
.locked-surface { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 20px; padding: 28px; }
.locked-icon { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid var(--forest); color: var(--forest); }
.locked-icon .icon { width: 22px; height: 22px; }
.locked-surface h2 { margin: 4px 0 4px; font-family: Georgia, "Songti SC", "SimSun", serif; font-size: 25px; }
.locked-surface p { margin: 0; color: var(--muted); font-size: 13px; }
.retry-closed { display: inline-flex; align-items: center; justify-content: center; min-height: 45px; padding: 0 14px; border: 1px solid var(--line); background: var(--paper); color: var(--muted); font-size: 12px; font-weight: 800; white-space: nowrap; }
.locked-surface .form-message { grid-column: 2 / -1; }

.page-admin-login { padding: 112px 0 150px; }
.login-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 480px); gap: clamp(50px, 8vw, 140px); align-items: center; }
.login-copy h1 { margin-top: 22px; }
.login-surface { padding: 29px 31px 22px; }

.page-admin { padding: 55px 0 100px; }
.admin-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.admin-heading h1 { margin: 15px 0 0; font-size: 60px; }
.admin-heading-note { color: var(--muted); font-size: 12px; line-height: 1.7; text-align: right; }
.notice { margin: 18px 0 0; padding: 13px 15px; border: 1px solid var(--line); font-size: 13px; }
.notice.success { background: #e6f1e8; border-color: #a9c6ae; color: var(--forest-deep); }
.notice.error { background: #f9e6e1; border-color: #e3aaa0; color: var(--red); }
.generated-code { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-top: 18px; padding: 19px 21px; background: var(--forest-deep); color: #fff; }
.generated-code strong { display: block; margin-top: 4px; font-family: Consolas, "Courier New", monospace; font-size: 20px; letter-spacing: 0; word-break: break-all; }
.generated-code p { margin: 6px 0 0; color: #c7dad1; font-size: 12px; }
.generated-code .surface-kicker { color: #a9c8bb; }
.generated-code .button-secondary { border-color: #769b8d; color: #fff; flex: 0 0 auto; }
.generated-code .button-secondary:hover { background: #254f44; border-color: #b5d1c6; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); margin: 26px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metrics > div { min-height: 91px; padding: 17px 20px; border-right: 1px solid var(--line); }
.metrics > div:last-child { border-right: 0; }
.metrics span, .metrics strong { display: block; }
.metrics span { color: var(--muted); font-size: 11px; }
.metrics strong { margin-top: 4px; color: var(--forest); font-size: 31px; line-height: 1; }
.admin-grid { display: grid; grid-template-columns: minmax(330px, .75fr) minmax(0, 1.55fr); gap: 22px; align-items: start; }
.import-surface { padding: 26px; }
.import-form { display: grid; gap: 15px; }
.form-row { display: grid; gap: 6px; }
.form-row label span { color: var(--muted); font-weight: 500; }
.form-row input { height: 43px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 2px; background: #fbfcfa; color: var(--ink); }
.form-row input:focus { border-color: var(--forest); outline: 0; box-shadow: none; }
.form-row input:focus-visible { outline: 3px solid var(--forest); outline-offset: 3px; }
.file-pair { display: grid; gap: 10px; }
.file-field { display: grid; gap: 8px; min-height: 92px; padding: 13px; border: 1px dashed var(--line-strong); background: #fbfcfa; cursor: pointer; }
.file-field:hover { border-color: var(--forest); background: #f5faf5; }
.file-field span { color: var(--forest-deep); font-size: 12px; font-weight: 800; }
.file-field input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-field small { color: var(--muted); font-size: 11px; }
.file-choice { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.file-choice .button-like { flex: 0 0 auto; padding: 5px 8px; border: 1px solid var(--line-strong); color: var(--forest-deep); font-size: 11px; font-weight: 800; }
.file-name { min-width: 0; overflow-wrap: anywhere; color: var(--ink); font-family: Consolas, "Courier New", monospace; font-size: 11px; }
.file-status { color: var(--muted); }
.file-field.is-valid { border-color: #83ac8d; background: #f5faf5; }
.file-field.is-invalid { border-color: var(--red); background: #fff8f6; }
.form-footnote { margin: 17px 0 0; color: var(--muted); font-size: 11px; }
.ledger-panel { min-width: 0; border-top: 1px solid var(--line-strong); }
.ledger-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 23px 0 16px; }
.ledger-count { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0; }
.ledger-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--paper-strong); box-shadow: var(--shadow); }
.ledger { width: 100%; min-width: 680px; border-collapse: collapse; text-align: left; }
.ledger th { padding: 11px 14px; border-bottom: 1px solid var(--line-strong); color: var(--muted); font-size: 10px; letter-spacing: 0; white-space: nowrap; }
.ledger td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 12px; }
.ledger tr:last-child td { border-bottom: 0; }
.ledger td strong, .ledger td small { display: block; }
.ledger td strong { font-size: 13px; }
.ledger td small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.hash-line { font-family: Consolas, "Courier New", monospace; font-size: 10px; }
.status, .format-tag { display: inline-block; padding: 4px 7px; border: 1px solid var(--line); font-size: 10px; font-weight: 800; white-space: nowrap; }
.status-unused { border-color: #a9c6ae; background: #e6f1e8; color: var(--forest-deep); }
.status-claimed { border-color: #b5d7dc; background: var(--blue-soft); color: #1f5962; }
.status-revoked { border-color: #e3aaa0; background: #f9e6e1; color: var(--red); }
.format-tag { color: var(--forest); }
.table-action { min-width: 44px; min-height: 44px; padding: 8px; border: 1px solid #d9aaa4; background: #fff8f6; color: var(--red); font-size: 12px; font-weight: 800; text-decoration: none; }
.table-action:hover { color: #74271f; }
.muted { color: var(--muted); }
.empty-ledger { padding: 37px !important; color: var(--muted); text-align: center; }

.page-error { display: grid; grid-template-columns: 82px minmax(0, 600px); align-items: start; gap: 26px; padding: 130px 0; }
.error-mark { display: grid; place-items: center; width: 70px; height: 70px; border: 1px solid var(--orange); color: var(--orange); font-size: 32px; font-weight: 900; }
.page-error h1 { margin: 12px 0 8px; font-size: 50px; }
.page-error p { margin-bottom: 28px; color: var(--muted); }
.footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; width: min(1240px, calc(100% - 48px)); margin: 50px auto 0; padding: 18px 0 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.footer-dot { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--forest); }
.footer-meta { text-align: right; }

@media (max-width: 900px) {
  .workbench, .login-layout { grid-template-columns: 1fr; gap: 45px; }
  .workbench { min-height: auto; }
  .verify-surface, .login-surface { max-width: 560px; }
  .admin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 650px) {
  .topbar, .page, .footer { width: min(100% - 30px, 1240px); }
  .topbar { min-height: 66px; }
  .wordmark strong { font-size: 11px; }
  .topnav { gap: 12px; }
  .nav-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; font-size: 11px; }
  .page-home, .page-format, .page-admin-login { padding-top: 53px; }
  h1 { font-size: 43px; }
  .format-head h1, .admin-heading h1 { font-size: 43px; }
  .mobile-break { display: inline; }
  .lede { margin-bottom: 31px; font-size: 15px; }
  .state-rail { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .rail-rule { display: none; }
  .rail-step { min-width: 0; padding-top: 8px; border-top: 1px solid var(--line-strong); }
  .rail-step strong { font-size: 12px; }
  .rail-step small { font-size: 10px; }
  .verify-surface, .login-surface, .import-surface { padding: 22px 18px 18px; }
  .notice-band { grid-template-columns: 1fr auto; gap: 8px 16px; }
  .notice-band p { grid-column: 1 / -1; font-size: 12px; }
  .format-grid { grid-template-columns: 1fr; }
  .format-option { min-height: 130px; grid-template-columns: 43px 1fr; gap: 13px; padding: 19px; }
  .format-action { grid-column: 2; }
  .choice-commit { align-items: stretch; flex-direction: column; }
  .choice-actions { justify-content: stretch; }
  .choice-actions .button { flex: 1 1 100%; }
  .locked-surface { grid-template-columns: 40px 1fr; padding: 21px; }
  .locked-icon { width: 40px; height: 40px; }
  .locked-surface .button-secondary { grid-column: 1 / -1; }
  .locked-surface .retry-closed { grid-column: 1 / -1; white-space: normal; }
  .locked-surface .form-message { grid-column: 1 / -1; }
  .choice-note { align-items: flex-start; flex-wrap: wrap; }
  .choice-note .form-message { margin-left: 0; width: 100%; }
  .admin-heading { align-items: flex-start; flex-direction: column; }
  .admin-heading-note { text-align: left; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics > div:nth-child(2) { border-right: 0; }
  .metrics > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .generated-code { align-items: flex-start; flex-direction: column; }
  .generated-code .button-secondary { width: 100%; }
  .file-pair { grid-template-columns: 1fr; }
  .footer { align-items: flex-start; flex-direction: column; }
  .footer-meta { text-align: left; }
  .page-error { grid-template-columns: 1fr; padding: 90px 0; }
}

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