:root {
  color-scheme: light;
  font: 16px/1.55 system-ui, "Microsoft YaHei", sans-serif;
  color: #172e38;
  background: #f0f5f4;
  --accent: #13665d;
  --edge: #d0dedb;
  --secondary: #50656a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main { width: min(100% - 2rem, 42.5rem); margin: 4.5rem auto; }
header { margin-bottom: 1.4rem; }
h1 { margin: 0 0 .35rem; font-size: clamp(1.85rem, 6vw, 2.65rem); line-height: 1.2; }
header p { margin: 0; color: var(--secondary); }

.tools-menu { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.5rem), 1fr)); gap: .5rem; margin-bottom: 1.5rem; }
.tools-menu a { min-height: 2.8rem; display: grid; place-items: center; padding: .5rem; border: 1px solid var(--edge); border-radius: .65rem; background: #fff; color: #0d594f; text-align: center; text-decoration: none; }
.tools-menu a:hover { background: #ecf7f4; }
.tools-menu a[aria-current] { background: #e6f3ef; border-color: #62948b; color: #09594e; font-weight: 700; }
.tools-menu a:focus-visible, summary:focus-visible { outline: 3px solid #13867a; outline-offset: 3px; }

.panel {
  padding: clamp(1rem, 4vw, 2rem);
  border: 1px solid var(--edge);
  border-radius: 1.15rem;
  background: #fff;
  box-shadow: 0 12px 40px #1839340a;
}

.directions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin: 0 0 1.45rem; padding: 0; border: 0; }
.directions legend { margin-bottom: .65rem; padding: 0; font-weight: 650; }
.directions label { position: relative; min-width: 0; }
.directions input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.directions span { display: grid; min-height: 3rem; place-items: center; text-align: center; border: 1px solid var(--edge); border-radius: .65rem; }
.directions input:checked + span { background: #e6f3ef; border-color: #62948b; color: #09594e; font-weight: 700; }
.directions input:focus-visible + span, button:focus-visible { outline: 3px solid #13867a; outline-offset: 3px; }
.directions input:disabled { cursor: wait; }

.upload { min-height: 9.6rem; display: grid; align-content: center; justify-items: center; gap: .5rem; padding: 1.3rem; border: 2px dashed #bacdc9; border-radius: .85rem; background: #f9fcfb; text-align: center; }
.upload.is-dragging { border-color: var(--accent); background: #e7f5f0; }
.upload p { margin: 0; color: var(--secondary); }
.upload .selection { max-width: 100%; overflow-wrap: anywhere; color: #172e38; font-weight: 650; }
.limits { margin: .8rem 0 1.2rem; color: var(--secondary); font-size: .9rem; }

button { font: inherit; font-weight: 640; border: 1px solid transparent; border-radius: .65rem; min-height: 2.8rem; padding: .56rem 1.1rem; cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
.pick { background: #fff; border-color: #9ebcb4; color: #0d594f; }
.pick:hover:not(:disabled) { background: #ecf7f4; }
.actions { display: flex; gap: .65rem; flex-wrap: wrap; }
.primary { background: var(--accent); color: #fff; }
.primary:hover:not(:disabled) { background: #0d5148; }
.feedback { margin-top: 1rem; padding: .8rem 1rem; border-radius: .65rem; background: #eaf4f1; overflow-wrap: anywhere; }
.feedback p { margin: 0; }
.feedback p + p { margin-top: .25rem; color: var(--secondary); font-size: .9rem; }
.feedback.is-error { color: #8b2c28; background: #fff0ed; }

.hr-panel #hr-access-status { margin: 0 0 1rem; }
.hr-templates { margin: 0 0 1.15rem; padding-bottom: 1.15rem; border-bottom: 1px solid var(--edge); }
.hr-templates h2 { margin: 0 0 .55rem; font-size: 1.05rem; }
.hr-template-links a { min-height: 2.8rem; display: grid; place-items: center; padding: .45rem .8rem; border: 1px solid #9ebcb4; border-radius: .65rem; font-weight: 640; text-align: center; text-decoration: none; }
.hr-template-links a:focus-visible { outline: 3px solid #13867a; outline-offset: 3px; }
.hr-guide { margin-top: .75rem; overflow-wrap: anywhere; }
.hr-guide summary { color: #0d594f; font-weight: 650; cursor: pointer; }
.hr-guide p, .hr-guide dl { margin: .5rem 0; color: var(--secondary); }
.hr-guide dt { color: #172e38; font-weight: 650; }
.hr-guide dd { margin: 0 0 .45rem; }
.hr-actions { margin-top: 1rem; }
.hr-bulletin { margin: 1rem 0 0; padding: .8rem 1rem; border: 1px solid var(--edge); border-radius: .65rem; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }

.ledger-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .65rem; }
.ledger-heading h2 { margin: 0; font-size: 1.1rem; }
.ledger-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 7.4rem), 1fr)); gap: .5rem; margin: .75rem 0 0; }
.ledger-counts div { min-width: 0; padding: .55rem .7rem; border-radius: .55rem; background: #edf5f2; }
.ledger-counts dt { color: var(--secondary); font-size: .87rem; }
.ledger-counts dd { margin: .1rem 0 0; font-size: 1.15rem; font-weight: 700; overflow-wrap: anywhere; }
.ledger-overview { margin-bottom: 1rem; }
.ledger-section { border-top: 1px solid var(--edge); padding: .2rem 0; }
.ledger-section summary { display: list-item; align-content: center; min-height: 2.8rem; color: #0d594f; font-weight: 650; cursor: pointer; }
.ledger-form { display: grid; gap: .85rem; padding: .35rem 0 .8rem; }
.ledger-form :is(p, pre) { margin: 0; }
.ledger-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.ledger-form label { display: grid; gap: .25rem; min-width: 0; font-weight: 600; }
.ledger-form :is(input:not([type=checkbox]), select, textarea) { width: 100%; min-width: 0; min-height: 2.8rem; padding: .5rem .6rem; border: 1px solid #9ebcb4; border-radius: .55rem; background: #fff; color: inherit; font: inherit; }
.ledger-form :is(input, select, textarea):focus-visible { outline: 3px solid #13867a; outline-offset: 2px; }
.ledger-form input[type=file] { padding-inline: .35rem; }
.ledger-form textarea { resize: vertical; }
.ledger-form .ledger-check { display: flex; align-items: center; gap: .6rem; min-height: 2.8rem; }
.ledger-check input { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); }
#ledger-link-result { display: grid; justify-items: start; gap: .5rem; }
#ledger-link-result label { width: 100%; }
.ledger-candidates { border-top: 1px solid var(--edge); padding: 1rem 0; }
.ledger-filter-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ledger-records { display: grid; gap: .55rem; margin: .65rem 0 0; padding: 0; list-style: none; }
.ledger-records li { display: grid; gap: .35rem; min-width: 0; padding: .7rem .8rem; border: 1px solid var(--edge); border-radius: .65rem; overflow-wrap: anywhere; }
.ledger-records :is(h4, p) { margin: 0; }
.ledger-records h4 { font-size: 1rem; }
.ledger-secondary { margin: 0; color: var(--secondary); font-size: .91rem; overflow-wrap: anywhere; }
.ledger-records .ledger-comment { white-space: pre-wrap; }
.ledger-records .actions { margin-top: .25rem; }
.ledger-records .ledger-badge { display: inline-block; justify-self: start; padding: .12rem .43rem; border-radius: .35rem; background: #e6f3ef; color: #0d594f; font-size: .875rem; }
.ledger-records .ledger-revoked { background: #fff0ed; color: #8b2c28; }
.ledger-records .ledger-empty { color: var(--secondary); border-style: dashed; }
.ledger-page { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .45rem; margin-top: .85rem; }
.ledger-page p { margin: 0; color: var(--secondary); font-size: .9rem; }
.ledger-timeline-group { margin: 1rem 0 0; }
.ledger-timeline-group h3, .ledger-correction h3 { margin: 0; font-size: 1rem; }
.ledger-correction { margin-top: 1rem; padding: .85rem; border: 1px solid #9ebcb4; border-radius: .65rem; background: #f8fbfa; overflow-wrap: anywhere; }
#ledger-list-retry { margin-top: .65rem; }
#ledger-todos-retry { margin-top: .65rem; }
#ledger-detail-title { overflow-wrap: anywhere; }
.ledger-todo-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 7.1rem), 1fr)); gap: .45rem; margin: .8rem 0; }
.ledger-todo-filters button { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .25rem; min-width: 0; padding-inline: .6rem; text-align: left; }
.ledger-todo-filters button[aria-pressed=true] { border-color: #62948b; background: #e6f3ef; color: #09594e; }
.ledger-todo-filters span { font-variant-numeric: tabular-nums; }

@media (max-width: 36rem) {
  main { margin: 2.4rem auto; }
  header p { font-size: .95rem; }
  .actions button { flex: 1 0 100%; }
  .hr-template-links a { flex: 1 1 7rem; }
  .ledger-fields { grid-template-columns: minmax(0, 1fr); }
  .ledger-page button { padding-inline: .7rem; }
}
