:root {
  --ink: #1d292f;
  --muted: #627078;
  --line: #cbd3d5;
  --paper: #f7f8f6;
  --white: #ffffff;
  --teal: #176f6a;
  --gold: #a2792b;
  --red: #8b3b48;
  --green-bg: #e7f2eb;
  --red-bg: #f5e8ea;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "Microsoft YaHei", "Segoe UI", sans-serif; letter-spacing: 0; }
button, input, select { font: inherit; letter-spacing: 0; }
button, a { min-height: 38px; }
button { border: 1px solid #9ba8ac; border-radius: 4px; background: var(--white); color: var(--ink); padding: 7px 13px; cursor: pointer; }
button:hover { border-color: var(--teal); color: var(--teal); }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: var(--teal); display: inline-flex; align-items: center; }

.topbar { min-height: 104px; padding: 22px clamp(20px, 4vw, 64px); background: var(--white); border-bottom: 4px solid var(--ink); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.topbar h1 { margin: 2px 0 0; font-size: 30px; line-height: 1.2; }
.institution, .section-heading p, .detail-title p { margin: 0; color: var(--gold); font: 700 11px/1.3 "Segoe UI", sans-serif; text-transform: uppercase; }
.topbar nav { display: flex; align-items: center; gap: 16px; }
main { width: min(1500px, 100%); margin: 0 auto; }

.status-band { min-height: 88px; display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)) auto; align-items: center; gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.status-band > div, .status-band > button { height: 100%; background: var(--white); border: 0; border-radius: 0; padding: 15px 22px; }
.status-band span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.status-band strong { font-size: 22px; }
.status-band #receiptStatus { font-size: 15px; }

.notice { margin: 14px clamp(16px, 3vw, 36px) 0; padding: 11px 14px; border-left: 4px solid var(--teal); background: var(--white); }
.notice.error { border-left-color: var(--red); color: #6d2833; }
.workspace { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); min-height: calc(100vh - 192px); }
.registration-pane { padding: 28px; background: #eef1ee; border-right: 1px solid var(--line); }
.registry-pane { padding: 28px clamp(20px, 3vw, 42px) 54px; background: var(--white); }
.section-heading { margin-bottom: 20px; }
.section-heading h2, .detail-title h2 { margin: 3px 0 0; font-size: 20px; }
.row-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.row-heading > span { color: var(--muted); font-size: 12px; }

form { display: grid; gap: 14px; }
label, legend { color: #3e4a50; font-size: 13px; font-weight: 650; }
input, select { width: 100%; min-height: 40px; margin-top: 6px; border: 1px solid #aeb9bd; border-radius: 3px; background: var(--white); padding: 8px 10px; color: var(--ink); }
input:focus, select:focus { outline: 2px solid rgba(23, 111, 106, .25); border-color: var(--teal); }
fieldset { border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px 12px; display: grid; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 17px; min-height: 17px; margin: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.primary { color: var(--white); background: var(--teal); border-color: var(--teal); font-weight: 700; }
.primary:hover { color: var(--white); background: #115d59; }

.table-wrap { width: 100%; overflow-x: auto; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td { padding: 12px 10px; text-align: left; border-bottom: 1px solid #dce1e2; font-size: 13px; overflow-wrap: anywhere; }
th { color: var(--muted); background: #f2f4f3; font-size: 11px; text-transform: uppercase; }
th:first-child { width: 29%; }
tbody tr[data-id] { cursor: pointer; }
tbody tr[data-id]:hover, tbody tr.selected { background: #edf5f3; }

.detail-pane { margin-top: 32px; border-top: 4px solid var(--ink); }
.detail-title { padding: 20px 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.status-label { padding: 5px 9px; border-radius: 3px; background: var(--green-bg); color: #275c3b; font-size: 12px; font-weight: 750; }
.status-label.revoked { background: var(--red-bg); color: var(--red); }
dl { display: grid; grid-template-columns: 140px 1fr 140px 1fr; margin: 0; border-bottom: 1px solid var(--line); }
dt, dd { margin: 0; padding: 11px 10px; border-bottom: 1px solid #e3e7e7; font-size: 13px; }
dt { color: var(--muted); background: #f4f5f4; font-weight: 650; }
.operations { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); margin-top: 24px; border: 1px solid var(--line); }
.operations form { padding: 22px; background: var(--white); align-content: start; }
.operations .wide-operation { grid-column: 1 / -1; }
.four-fields { grid-template-columns: 2fr 1.4fr .7fr .9fr; }
.three-fields { grid-template-columns: 2fr 1.4fr .7fr; }
.roundtrip-result { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr); align-items: center; gap: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.roundtrip-result audio { width: 100%; }
.roundtrip-result output { color: var(--muted); font-size: 12px; line-height: 1.55; }
.operations h3, .danger-zone h3 { margin: 0 0 4px; font-size: 15px; }
.danger-zone { margin-top: 24px; padding: 17px 20px; border: 1px solid #d7b7bd; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.danger-zone p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.danger-zone button { border-color: var(--red); color: var(--red); }

@media (max-width: 900px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .status-band { grid-template-columns: 1fr 1fr; }
  .status-band > button { grid-column: span 2; }
  .workspace { grid-template-columns: 1fr; }
  .registration-pane { border-right: 0; border-bottom: 1px solid var(--line); }
  .operations, dl { grid-template-columns: 1fr; }
  .four-fields, .three-fields, .roundtrip-result { grid-template-columns: 1fr; }
  dt { padding-bottom: 3px; }
  dd { padding-top: 4px; }
}

@media (max-width: 560px) {
  .topbar, .registration-pane, .registry-pane { padding-left: 16px; padding-right: 16px; }
  .topbar nav { width: 100%; justify-content: space-between; }
  .form-grid { grid-template-columns: 1fr; }
  th:nth-child(3), td:nth-child(3), th:nth-child(5), td:nth-child(5), th:nth-child(6), td:nth-child(6) { display: none; }
  th:first-child { width: 42%; }
}
