:root {
  --ink: #292d29;
  --muted: #747b74;
  --paper: #f3f4ef;
  --surface: #ffffff;
  --sage: #5d796b;
  --sage-dark: #395448;
  --sage-soft: #dfe9e2;
  --sand: #e8ddcb;
  --line: #d9ddd5;
  --danger: #a8483e;
  --warning: #9b6b22;
  --shadow: 0 24px 70px rgba(48, 61, 51, .12);
  --radius: 18px;
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

[hidden] { display: none !important; }

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(93, 121, 107, .26);
  outline-offset: 2px;
}

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(360px, .7fr); }
.login-story {
  position: relative; overflow: hidden; padding: clamp(44px, 7vw, 112px);
  background:
    linear-gradient(130deg, rgba(26, 59, 46, .9), rgba(72, 99, 83, .78)),
    radial-gradient(circle at 18% 18%, #8ca997, #345347 58%, #203b31);
  color: white; display: flex; flex-direction: column; justify-content: center;
}
.login-story::after {
  content: "卡"; position: absolute; right: -3vw; bottom: -16vw;
  font-family: "Songti SC", "STSong", serif; font-size: min(48vw, 650px);
  line-height: 1; color: rgba(255,255,255,.045); pointer-events: none;
}
.eyebrow, .section-kicker { margin: 0 0 10px; font-size: 11px; font-weight: 700; letter-spacing: .18em; color: var(--sage); }
.login-story .eyebrow { color: #d5e4da; }
.login-story h1 { margin: 0; max-width: 760px; font-family: "Songti SC", "STSong", serif; font-size: clamp(44px, 6vw, 92px); line-height: 1.08; font-weight: 500; letter-spacing: -.035em; }
.login-copy { max-width: 580px; margin: 34px 0 0; font-size: 17px; line-height: 1.8; color: rgba(255,255,255,.76); }
.material-note { display: flex; align-items: center; gap: 12px; margin-top: 72px; font-size: 12px; letter-spacing: .12em; color: #e6eee8; }
.material-note i { width: clamp(20px, 4vw, 72px); height: 1px; background: rgba(255,255,255,.3); }
.login-panel { display: grid; place-items: center; padding: 32px; background: #eeefe9; }
.login-card { width: min(390px, 100%); padding: 40px; border: 1px solid var(--line); border-radius: 24px; background: rgba(255,255,255,.82); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.login-card h2 { margin: 0; font-family: "Songti SC", "STSong", serif; font-size: 34px; font-weight: 600; }
.muted { color: var(--muted); }
label { display: grid; gap: 8px; margin-top: 20px; color: #525951; font-size: 13px; font-weight: 650; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 12px 13px;
  background: #fbfcf9; color: var(--ink); transition: border-color .18s, box-shadow .18s;
}
input:hover, select:hover, textarea:hover { border-color: #aab6ad; }
textarea { min-height: 110px; resize: vertical; }
.form-error { min-height: 20px; margin: 12px 0 0; color: var(--danger); font-size: 13px; }

.button { border: 0; border-radius: 10px; padding: 10px 15px; font-weight: 700; cursor: pointer; transition: transform .16s, background .16s, opacity .16s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.button-primary { background: var(--sage-dark); color: white; }
.button-secondary { background: var(--sage-soft); color: var(--sage-dark); }
.button-quiet { background: #ecefe9; color: var(--ink); }
.button-danger { background: #f7e5e2; color: var(--danger); }
.button-block { width: 100%; margin-top: 18px; padding: 13px; }
.text-button { border: 0; background: none; color: var(--sage-dark); cursor: pointer; padding: 0; font-weight: 700; }
.icon-button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: #eef0ec; cursor: pointer; font-size: 24px; }

.workspace { min-height: 100vh; grid-template-columns: 250px minmax(0, 1fr); }
.workspace:not([hidden]) { display: grid; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 16px; background: #e7eae3; border-right: 1px solid #d4d9d1; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 28px; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px 5px 13px 5px; background: var(--sage-dark); color: white; font-family: "Songti SC", serif; font-size: 20px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 10px; letter-spacing: .12em; }
#main-nav { display: grid; gap: 5px; }
.nav-button { display: flex; align-items: center; gap: 11px; width: 100%; border: 0; border-radius: 10px; padding: 11px 12px; background: transparent; color: #5d655e; cursor: pointer; text-align: left; font-weight: 650; }
.nav-button::before { content: ""; width: 7px; height: 7px; border: 1px solid #8d968e; border-radius: 50%; }
.nav-button:hover { background: rgba(255,255,255,.6); }
.nav-button.active { background: var(--surface); color: var(--sage-dark); box-shadow: 0 4px 16px rgba(48,61,51,.06); }
.nav-button.active::before { background: var(--sage); border-color: var(--sage); box-shadow: 0 0 0 4px var(--sage-soft); }
.sidebar-foot { margin-top: auto; display: flex; align-items: end; justify-content: space-between; padding: 18px 10px 4px; border-top: 1px solid #ced4cb; }
.sidebar-foot small, .sidebar-foot strong { display: block; }
.sidebar-foot small { color: var(--muted); font-size: 10px; }
.sidebar-foot strong { margin-top: 4px; font-size: 13px; }

.main { min-width: 0; padding: 34px clamp(24px, 4vw, 64px) 80px; }
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.topbar h1 { margin: 0; font-family: "Songti SC", "STSong", serif; font-size: 38px; font-weight: 600; letter-spacing: -.03em; }
.flow-rail { display: grid; grid-template-columns: repeat(4, 1fr); margin: 30px 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: rgba(255,255,255,.56); }
.flow-rail div { position: relative; display: flex; align-items: center; gap: 11px; padding: 15px 18px; color: var(--muted); }
.flow-rail div + div { border-left: 1px solid var(--line); }
.flow-rail b { color: #a1a8a0; font-family: "Avenir Next Condensed", sans-serif; font-size: 11px; }
.flow-rail .active { background: var(--sage-dark); color: white; }
.flow-rail .active b { color: #bcd1c4; }
.content { min-height: 460px; }

.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 30px rgba(48,61,51,.045); overflow: hidden; }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px; border-bottom: 1px solid #e6e9e3; }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-body { padding: 22px; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.toolbar .spacer { flex: 1; }
.metric-line { display: flex; align-items: baseline; gap: 8px; }
.metric-line strong { font-family: "Avenir Next Condensed", sans-serif; font-size: 36px; }
.metric-line span { color: var(--muted); font-size: 12px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 12px 14px; background: #f6f7f3; color: #7b827b; font-size: 10px; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
td { padding: 14px; border-top: 1px solid #eceee9; vertical-align: middle; }
tbody tr:hover { background: #fafbf8; }
.status { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 9px; background: #edf0eb; color: #5d665f; font-size: 11px; font-weight: 700; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.success { background: #e3efe7; color: #426d54; }
.status.warning { background: #f5ead7; color: var(--warning); }
.status.danger { background: #f5e2df; color: var(--danger); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.row-actions button { border: 0; background: #edf0eb; color: #48534b; border-radius: 8px; padding: 6px 9px; cursor: pointer; font-size: 11px; font-weight: 700; }
.row-actions button:hover { background: var(--sage-soft); }

.empty { display: grid; place-items: center; min-height: 280px; padding: 36px; text-align: center; color: var(--muted); }
.empty-mark { width: 64px; height: 64px; display: grid; place-items: center; margin-bottom: 18px; border: 1px dashed #aeb9b0; border-radius: 50%; color: var(--sage); font-family: "Songti SC", serif; font-size: 24px; }
.empty h3 { margin: 0 0 8px; color: var(--ink); }
.empty p { margin: 0 0 18px; }
.loading { display: grid; place-items: center; min-height: 300px; color: var(--muted); }
.loading::before { content: ""; width: 26px; height: 26px; margin-right: 12px; border: 2px solid var(--line); border-top-color: var(--sage); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.grid-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-full { grid-column: 1 / -1; }
.help { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.pool-list { display: grid; gap: 10px; margin: 16px 0; }
.pool-row { display: grid; grid-template-columns: minmax(160px, 1fr) 120px 150px 38px; gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fafbf8; }
.pool-row label { margin: 0; }

.verify-shell { display: grid; grid-template-columns: minmax(300px, .8fr) minmax(360px, 1.2fr); gap: 18px; }
.scan-stage { min-height: 430px; padding: 28px; border-radius: var(--radius); background: var(--sage-dark); color: white; }
.scan-stage .section-kicker { color: #bdd0c3; }
.scan-frame { position: relative; display: grid; place-items: center; min-height: 220px; margin: 26px 0; border: 1px solid rgba(255,255,255,.25); border-radius: 18px; color: rgba(255,255,255,.68); text-align: center; }
.scan-frame::before, .scan-frame::after { content: ""; position: absolute; width: 42px; height: 42px; border-color: #dceade; }
.scan-frame::before { left: 18px; top: 18px; border-left: 3px solid; border-top: 3px solid; }
.scan-frame::after { right: 18px; bottom: 18px; border-right: 3px solid; border-bottom: 3px solid; }
.verify-result { min-height: 430px; }
.receipt { padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.receipt h2 { margin: 8px 0 20px; font-family: "Songti SC", serif; font-size: 30px; }
.receipt dl { display: grid; grid-template-columns: 100px 1fr; gap: 12px; margin: 0; }
.receipt dt { color: var(--muted); }
.receipt dd { margin: 0; font-weight: 650; }

dialog { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 40px); padding: 0; border: 0; border-radius: 22px; box-shadow: var(--shadow); overflow: auto; }
dialog::backdrop { background: rgba(29, 36, 31, .45); backdrop-filter: blur(4px); }
.modal-card { padding: 0; }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 22px 24px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.95); backdrop-filter: blur(12px); }
.modal-head h2 { margin: 0; font-family: "Songti SC", serif; font-size: 26px; }
#modal-body { padding: 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: 360px; padding: 13px 17px; border-radius: 12px; background: #263d33; color: white; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #7b342e; }

@media (max-width: 980px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-story { min-height: 48vh; }
  .material-note { margin-top: 40px; }
  .workspace:not([hidden]) { grid-template-columns: 84px minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; }
  .brand div, .nav-button span, .sidebar-foot div, .sidebar-foot .text-button { display: none; }
  .brand { justify-content: center; padding-inline: 0; }
  .nav-button { justify-content: center; }
  .verify-shell { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .login-story { min-height: 42vh; padding: 36px 24px; }
  .login-story h1 { font-size: 42px; }
  .login-panel { padding: 18px; }
  .login-card { padding: 28px 22px; }
  .workspace:not([hidden]) { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 12px; }
  .brand { justify-content: flex-start; padding: 0 4px 12px; }
  .brand div { display: block; }
  #main-nav { display: flex; overflow-x: auto; }
  .nav-button { flex: 0 0 auto; }
  .nav-button span { display: block; }
  .sidebar-foot { display: none; }
  .main { padding: 24px 14px 64px; }
  .topbar { align-items: start; }
  .topbar h1 { font-size: 30px; }
  .flow-rail { grid-template-columns: repeat(4, minmax(84px, 1fr)); overflow-x: auto; }
  .flow-rail div { display: grid; gap: 3px; padding: 12px; }
  .field-row, .grid-two, .grid-three { grid-template-columns: 1fr; }
  .pool-row { grid-template-columns: 1fr 1fr; }
  .table-wrap { margin-inline: -14px; }
  th, td { white-space: nowrap; }
}

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