:root {
  color-scheme: light;
  --paper: #faf9f5;
  --sheet: #fffefa;
  --text: #262a28;
  --muted: #626660;
  --rule: #d4d3ca;
  --rule-dark: #9c9e95;
  --accent: #a53929;
  --accent-dark: #842819;
  --serif: "Songti SC", "Noto Serif CJK SC", SimSun, serif;
  --mono: "IBM Plex Mono", Consolas, monospace;
  font: 15px/1.5 "Segoe UI", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--paper);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body, h1, h2, p, dl, dd, fieldset, legend { margin: 0; }
body { min-width: 300px; }
button, input, select, textarea { color: inherit; font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .52; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent-dark); text-underline-offset: 3px; }
#connection { padding: 40px; color: var(--muted); }

.masthead { border-bottom: 1px solid var(--rule); }
.mast-inner, .content { width: min(1120px, calc(100% - 96px)); margin-inline: auto; }
.mast-inner { min-height: 75px; display: flex; align-items: center; }
.brand { display: inline-flex; align-items: center; gap: 16px; white-space: nowrap; }
.wordmark { display: inline-block; font: italic 850 30px/.95 "Arial", sans-serif; letter-spacing: -.10em; padding-right: 3px; }
.brand-name { border-left: 1px solid var(--rule-dark); padding-left: 16px; font-size: 15px; font-weight: 600; }
.workspace-bar { display: flex; gap: clamp(28px, 5vw, 78px); }
nav { display: flex; align-self: stretch; gap: 26px; }
nav button, #logout, .action { border: 0; background: transparent; padding: 0; }
nav button { position: relative; color: var(--muted); font-size: 14px; white-space: nowrap; }
nav button[aria-current="page"] { color: var(--text); font-weight: 650; }
nav button[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--accent);
}
nav button:hover, #logout:hover, .action:hover { color: var(--accent-dark); }
.account { margin-left: auto; display: flex; align-items: baseline; gap: 9px; min-width: 0; }
#current-name { max-width: 15ch; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; font-weight: 600; font-size: 14px; }
.account small, #logout { font-size: 12px; color: var(--muted); white-space: nowrap; }
#logout { margin-left: 6px; padding-left: 13px; border-left: 1px solid var(--rule); }
h1 { font: 600 clamp(35px, 3.2vw, 46px)/1.25 var(--serif); }
h2 { font-size: 16px; font-weight: 650; }
.content { padding-top: clamp(36px, 5vw, 65px); padding-bottom: 64px; }
.page-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 14px; padding-bottom: 22px; border-bottom: 1px solid var(--rule-dark); }
.page-heading p { color: var(--muted); font-size: 14px; }

.login-layout {
  display: grid; grid-template-columns: minmax(280px, 354px) minmax(270px, 430px);
  gap: clamp(64px, 9vw, 145px); align-items: center; justify-content: center;
  width: min(1020px, calc(100% - 96px)); margin: 0 auto;
  padding: clamp(55px, 11vh, 126px) 0 70px;
}
.login-box { min-width: 0; }
.login-box h1 { font-size: clamp(36px, 3.7vw, 52px); }
.login-box h1::before { content: ""; display: block; width: 34px; border-top: 3px solid var(--accent); margin-bottom: 21px; }
.auth-description:not(:empty) { font-size: 14px; line-height: 1.75; color: var(--muted); margin-top: 12px; }
.login-box form { margin-top: 30px; }
.login-field + .login-field { margin-top: 18px; }
.login-field label, .user-fields label { display: block; font-size: 14px; margin-bottom: 7px; }
.remember-choice { display: flex; width: fit-content; align-items: center; gap: 8px; margin-top: 16px; font-size: 14px; cursor: pointer; }
.remember-choice input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.password-entry { text-align: left; color: var(--muted); cursor: text; }
.login-box .primary { margin-top: 22px; min-width: 132px; }
.auth-print { display: grid; place-items: center; min-width: 0; }
.auth-print img { display: block; width: 100%; max-width: 420px; height: auto; }

input:not([type="radio"]):not([type="checkbox"]), select, textarea, .password-entry {
  width: 100%; min-width: 0; min-height: 42px; display: block;
  padding: 8px 11px; border: 1px solid #acafa6; border-radius: 3px; background: var(--sheet);
  font-size: 15px; line-height: 1.5;
}
input:not([type="radio"]):not([type="checkbox"]):focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: #777a72; opacity: 1; }
textarea { resize: vertical; min-height: 94px; }
.primary, .download {
  display: inline-flex; align-items: center; justify-content: center; min-height: 43px;
  padding: 8px 22px; background: var(--accent); border: 1px solid var(--accent);
  border-radius: 3px; color: white; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.primary:hover:not(:disabled), .download:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.issue-layout { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(240px, 1fr); gap: clamp(40px, 7vw, 96px); align-items: start; padding-top: 32px; }
.issue-form { --label-width: 112px; min-width: 0; }
.form-row { position: relative; min-width: 0; border: 0; padding: 0; margin-bottom: 26px; }
.form-row > legend, .note-row > label { position: absolute; left: 0; top: 9px; padding: 0; font-weight: 600; font-size: 14px; }
.form-row small { margin-left: 2px; color: var(--muted); font-size: 12px; font-weight: 400; }
#date-group legend small { display: block; margin: 1px 0 0; }
.row-body, .form-actions { margin-left: var(--label-width); }
.radio-line { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 24px; min-height: 40px; }
.radio-line label { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; padding-block: 5px; }
.radio-line input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.expiry-fields { display: grid; grid-template-columns: minmax(138px, 1.5fr) minmax(94px, 1fr); gap: 10px; }
.expiry-fields input, .expiry-fields select { font-variant-numeric: tabular-nums; }
.hint { font-size: 12px; color: var(--muted); margin-top: 7px; line-height: 1.6; }
.file-summary { min-width: 0; padding: 17px 0 14px; border-top: 3px double var(--rule-dark); border-bottom: 1px solid var(--rule); }
.file-summary h2 { font-weight: 500; font-size: 14px; color: var(--muted); }
.file-cover { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 21px; }
.file-art { position: relative; background: #fffef7; width: 73px; height: 89px; margin: 0 10px 2px 0; flex: 0 0 auto; border: 1px solid #9bb299; border-radius: 3px; transform: rotate(-5deg); box-shadow: 5px 5px 0 #cedac5; padding: 39px 13px 14px; }
.file-art i { position: absolute; top: 0; right: 0; width: 19px; height: 19px; border-left: 1px solid #a4b99d; border-bottom: 1px solid #a4b99d; background: #dfe9d6; }
.file-art b { display: block; width: 100%; height: 2px; background: #a7b89d; margin-bottom: 7px; }
.file-art b:last-child { width: 55%; }
.file-name { margin: 7px 0 0; font: 400 clamp(32px, 3vw, 43px)/1.18 Georgia, "Times New Roman", serif; }
.file-summary dl { border-top: 1px solid var(--rule); padding-top: 7px; }
.file-summary dl > div { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 12px; padding: 6px 0; }
.file-summary dt { color: var(--muted); font-size: 13px; }
.file-summary dd { text-align: right; font-size: 14px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#preview-date { font-family: var(--mono), "Microsoft YaHei UI", sans-serif; }
.success, .warning, .error:not(:empty), .small-status:not(:empty) { padding: 10px 14px; border-left: 3px solid; overflow-wrap: anywhere; }
.success { display: flex; align-items: center; gap: 16px; justify-content: space-between; margin-top: 28px; background: #eef2ec; border-color: #507155; }
.success small { display: block; color: var(--muted); font: 12px/1.6 var(--mono); margin-top: 3px; }
.download { background: var(--sheet); border-color: #788779; color: #314e34; }
.download:hover { background: #e1eadf; border-color: #617563; }
.warning, .error:not(:empty), .small-status:not(:empty) { font-size: 14px; margin: 12px 0; }
.warning { background: #f7efd8; border-color: #977222; color: #674e14; }
.error:not(:empty) { background: #f8eae5; border-color: var(--accent); color: #853021; }
.small-status:not(:empty) { color: #36563c; background: #eef2ec; border-color: #507155; }

.list-panel { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--rule); }
th:first-child, td:first-child { padding-left: 3px; }
th { font-size: 13px; color: var(--muted); font-weight: 550; white-space: nowrap; }
td { vertical-align: middle; overflow-wrap: anywhere; }
tbody tr:hover { background: #f2f1eb; }
td strong { font-weight: 600; }
.secondary { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.table-id { font: 11px/1.5 var(--mono); }
.action, td a { color: var(--accent-dark); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.action { min-height: 36px; }
.empty { padding: 35px 3px; border-bottom: 1px solid var(--rule); color: var(--muted); }
.user-form { padding-block: 26px; border-bottom: 1px solid var(--rule-dark); }
.user-fields { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 250px) auto; align-items: end; gap: 16px; margin-top: 14px; }
.user-fields button { justify-self: start; }

@media (max-width: 950px) {
  .mast-inner, .content { width: calc(100% - 56px); }
  .workspace-bar { gap: 30px; }
  nav { gap: 18px; }
  .issue-layout { gap: 34px; grid-template-columns: minmax(0, 1.7fr) minmax(212px, 1fr); }
  .issue-form { --label-width: 88px; }
}
@media (max-width: 740px) {
  .mast-inner, .content { width: calc(100% - 36px); }
  .mast-inner { min-height: 61px; }
  .workspace-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; padding-top: 15px; }
  .brand { gap: 10px; }
  .brand-name { font-size: 14px; padding-left: 10px; }
  .wordmark { font-size: 26px; }
  .account { grid-column: 2; grid-row: 1; gap: 5px; }
  #current-name { max-width: 10ch; }
  .account small { display: none; }
  #logout { padding-left: 8px; margin-left: 2px; }
  nav { grid-column: 1/-1; grid-row: 2; gap: 24px; margin-top: 8px; }
  nav button { min-height: 42px; }
  .content { padding-top: 28px; padding-bottom: 32px; }
  .page-heading { padding-bottom: 15px; }
  h1 { font-size: 34px; }
  .issue-layout { grid-template-columns: 1fr; gap: 28px; padding-top: 22px; }
  .file-summary { margin-top: 0; }
  .file-cover { margin-bottom: 12px; }
  .file-name { font-size: 30px; margin: 3px 0 0; }
  .file-art { width: 46px; height: 56px; margin-right: 5px; padding: 23px 9px 6px; box-shadow: 3px 3px 0 #cedac5; }
  .file-art i { width: 12px; height: 12px; }
  .file-art b { height: 1px; margin-bottom: 4px; }
  .user-fields { grid-template-columns: 1fr 1fr; gap: 12px; }
  .login-layout { grid-template-columns: minmax(0, 370px); width: calc(100% - 48px); padding-block: 58px; }
  .auth-print { display: none; }
  #history-list table { min-width: 0; }
  #history-list thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #history-list tbody { display: block; }
  #history-list tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px;
    padding: 14px 0; border-bottom: 1px solid var(--rule);
  }
  #history-list td { padding: 0; border: 0; grid-column: 1; }
  #history-list td:nth-child(2), #history-list td:nth-child(3) { color: var(--muted); font-size: 13px; }
  #history-list td:nth-child(2)::before { content: "有效期"; margin-right: 7px; }
  #history-list td:nth-child(3) { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
  #history-list td:last-child { grid-area: 1 / 2 / 4 / 3; align-self: center; }
  #history-list td a { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 7px; }
  #user-list table { min-width: 0; }
  th, td { padding: 11px 8px; }
}
@media (max-width: 480px) {
  .form-row { margin-bottom: 22px; }
  .form-row > legend, .note-row > label { position: static; display: block; margin-bottom: 7px; }
  #date-group legend small { display: inline; margin-left: 4px; }
  .row-body, .form-actions { margin-left: 0; }
  .radio-line { min-height: 32px; }
  .user-fields { grid-template-columns: 1fr; }
  .success { align-items: start; flex-direction: column; }
}
