:root {
  color-scheme: light;
  --paper: #f5f7f5;
  --surface: #ffffff;
  --ink: #1e302b;
  --muted: #586b62;
  --line: #d6e0da;
  --green: #245b45;
  --green-hover: #184432;
  --pale: #e7eee9;
  --red: #a0342e;
  --amber: #855b13;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 16px; line-height: 1.6; }
::selection { background: #d1e5d7; color: var(--ink); }
a { color: var(--green); text-underline-offset: 5px; }
a:hover { color: var(--green-hover); }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 4px; }
.skip-link { position: fixed; z-index: 2; top: -100px; left: 16px; padding: 12px; background: var(--surface); }
.skip-link:focus { top: 12px; }
.site-header { min-height: 80px; padding: 0 max(24px, calc((100vw - 1120px) / 2)); display: flex; align-items: center; gap: 48px; background: var(--surface); border-bottom: 1px solid var(--line); }
.wordmark { display: inline-flex; gap: 12px; align-items: center; color: var(--ink); font-size: 20px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.brand-mark { width: 8px; height: 20px; border-top: 3px solid var(--green); border-bottom: 3px solid var(--green); }
nav { display: flex; align-self: stretch; gap: 28px; }
nav a { display: flex; align-items: center; padding: 0 5px; border-bottom: 3px solid transparent; text-decoration: none; color: var(--muted); }
nav a[aria-current] { color: var(--green); border-color: var(--green); font-weight: 600; }
.logout { margin-left: auto; }
.text-button { padding: 10px 0 10px 12px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.text-button:hover { color: var(--ink); }
.content { width: min(1120px, calc(100% - 48px)); margin: 56px auto 80px; }
.narrow { max-width: 420px; }
.form-page { max-width: 640px; }
.login-page { margin-top: clamp(56px, 12vh, 120px); }
h1, h2, p { margin: 0; }
h1 { font-size: 30px; line-height: 1.3; font-weight: 650; letter-spacing: -0.02em; text-wrap: balance; }
h2 { font-size: 20px; line-height: 1.4; font-weight: 600; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 32px; }
.list-meta { margin-top: 8px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 46px; padding: 10px 24px; border: 1px solid transparent; border-radius: 6px; background: var(--green); color: var(--surface); font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.button:hover { background: var(--green-hover); color: var(--surface); }
.button:active { background: #102f23; }
.button:disabled { opacity: 0.5; cursor: not-allowed; }
.quiet-link { font-size: 14px; padding-block: 10px; }
.entry-form { margin-top: 32px; }
.certificate-form { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; }
.field { margin-bottom: 26px; min-width: 0; }
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
input:not([type=hidden]), select { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid #788e81; border-radius: 6px; background: var(--surface); color: var(--ink); caret-color: var(--green); }
select { padding-right: 30px; }
input:hover, select:hover { border-color: var(--green); }
input[aria-invalid], select[aria-invalid] { border-color: var(--red); }
input[type=date] { appearance: auto; font-variant-numeric: tabular-nums; }
.field-error { color: var(--red); font-size: 14px; margin-top: 6px; }
.form-actions { display: flex; align-items: center; gap: 24px; padding-top: 8px; grid-column: 1 / -1; }
.login-button { width: 100%; margin-top: 4px; }
.notice { color: var(--green); background: var(--pale); padding: 12px 16px; margin-bottom: 24px; border-radius: 6px; }
.error-banner { color: var(--red); background: #f9eae7; padding: 12px 16px; margin-bottom: 24px; border-radius: 6px; grid-column: 1 / -1; }
.table-scroll { overflow-x: auto; scrollbar-color: #839e8c var(--pale); scrollbar-width: thin; }
table { width: 100%; border-collapse: collapse; text-align: left; background: var(--surface); }
thead { background: var(--pale); }
th, td { padding: 18px 20px; border-bottom: 1px solid var(--line); }
thead th { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }
tbody th { font-weight: 600; }
.unit-cell { max-width: 260px; overflow-wrap: anywhere; }
tbody tr:hover { background: #f9fbf9; }
.numeric { font-variant-numeric: tabular-nums; }
.tail { max-width: 180px; overflow-wrap: anywhere; }
td:not(.tail) { white-space: nowrap; }
.days { font-size: 14px; color: var(--green); }
.expired { color: var(--red); }
.soon { color: var(--amber); }
.actions-heading { text-align: right; }
.row-actions { text-align: right; }
.row-actions a { display: inline-block; padding: 8px 0 8px 16px; font-size: 14px; text-decoration: none; }
.row-actions a:hover { text-decoration: underline; }
.row-actions .delete-link { color: var(--muted); }
.row-actions .delete-link:hover { color: var(--red); }
.empty-state { padding: 80px 24px; text-align: center; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.empty-state a { display: inline-block; margin-top: 16px; }
.record-detail { margin: 32px 0; padding: 16px 0; border-block: 1px solid var(--line); }
.record-detail div { display: grid; grid-template-columns: 100px 1fr; gap: 24px; padding: 8px 0; }
dt { font-size: 14px; color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.danger { background: var(--red); }
.danger:hover { background: #832822; }
.error-message { color: var(--muted); margin: 24px 0 16px; }
@media (max-width: 700px) {
  .site-header { min-height: 68px; padding-inline: 20px; gap: 24px; }
  .wordmark { font-size: 18px; gap: 8px; }
  nav { gap: 16px; }
  .content { width: calc(100% - 40px); margin-top: 36px; }
  .login-page { margin-top: 64px; }
  h1 { font-size: 26px; }
  .page-heading { margin-bottom: 24px; gap: 12px; }
  .page-heading .button { padding-inline: 16px; }
  .certificate-form { grid-template-columns: 1fr; }
  .table-scroll { overflow: visible; }
  .table-scroll table, tbody { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 20px; padding: 20px; border-bottom: 1px solid var(--line); }
  tbody th, tbody td { border: 0; padding: 6px 0; }
  .unit-cell { grid-column: 1 / -1; max-width: none; padding-bottom: 12px; }
  td[data-label] { display: flex; flex-direction: column; gap: 4px; white-space: normal; overflow-wrap: anywhere; }
  td[data-label]::before { content: attr(data-label); font-size: 12px; color: var(--muted); }
  .tail { max-width: none; }
  .row-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 24px; padding-top: 8px; }
  .row-actions a { padding: 8px 0; }
  .empty-state { padding: 56px 16px; }
}
@media (max-width: 380px) {
  .site-header { gap: 16px; padding-inline: 16px; }
  nav { gap: 8px; }
  .brand-mark { display: none; }
}
