:root {
  color-scheme: light;
  font-family: system-ui, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  line-height: 1.55;
  color: #14243b;
  background: #f3f6fa;
  --text: #14243b;
  --muted: #4d6078;
  --border: #ccd6e4;
  --blue: #1354bc;
  --dark-blue: #0b3f92;
  --error: #a12c2c;
}
* { box-sizing: border-box; }
body { margin: 0; }
h1, h2, p, dl { margin: 0; }
h1 { font-size: clamp(1.85rem, 4vw + .2rem, 2.6rem); line-height: 1.2; letter-spacing: .035em; }
h2 { font-size: 1.2rem; }
a { color: var(--dark-blue); text-underline-offset: .2em; }
:focus-visible { outline: 3px solid #256ee3; outline-offset: 3px; }
.skip { position: absolute; background: white; padding: .7rem; transform: translateY(-150%); }
.skip:focus { transform: translateY(0); z-index: 1; }

.site-header { background: #102742; color: white; }
.site-header-inner { max-width: 76rem; margin: auto; padding: .85rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.site-header a { color: #fff; display: inline-flex; align-items: center; min-height: 44px; }
.brand { text-decoration: none; font-weight: 750; letter-spacing: .05em; gap: .65rem; }
.brand-mark { display: inline-block; width: 1rem; height: 1rem; border: 2px solid #aad2ff; border-radius: .25rem; box-shadow: inset 0 .23rem #aad2ff; }

.shell { width: min(100% - 2rem, 74rem); margin: 1.7rem auto 3rem; }
.narrow { max-width: 43rem; }
.compact { max-width: 28rem; }
.page-heading { margin-bottom: 1.2rem; }
.page-heading p { color: var(--muted); margin-top: .55rem; }
.panel, .table-panel, .department-list { background: #fff; border: 1px solid var(--border); border-radius: .9rem; }
.panel { padding: clamp(1rem, 4vw, 1.9rem); }
.stack { display: grid; gap: 1.15rem; }
.fields { display: grid; gap: 1rem 1.15rem; }
.field { display: grid; gap: .3rem; min-width: 0; align-content: start; }
.field label { font-weight: 700; }
.required, .hint { color: var(--muted); font-size: .875rem; font-weight: 500; }
.required { margin-left: .2em; }
input, select, textarea, button { font: inherit; }
input, select, textarea { width: 100%; min-width: 0; min-height: 46px; padding: .56rem .7rem; color: var(--text); background: #fff; border: 1px solid #879bb4; border-radius: .5rem; }
input::placeholder { color: var(--muted); }
textarea { resize: vertical; }
[aria-invalid="true"] { border-color: var(--error); }
.field-error { color: var(--error); font-size: .9rem; }
.alert { margin: 0; padding: .75rem 1rem; border: 1px solid #e7beba; border-radius: .5rem; background: #fff1ef; color: var(--error); }
ul.alert { padding-left: 2.2rem; }

button, .button { display: inline-flex; justify-content: center; align-items: center; min-height: 44px; padding: .53rem .9rem; border: 1px solid transparent; border-radius: .5rem; font-weight: 700; text-decoration: none; cursor: pointer; }
.primary { color: #fff; background: var(--blue); }
.primary:hover { background: var(--dark-blue); }
.secondary, .quiet { color: var(--dark-blue); background: #fff; }
.secondary { border-color: #9bb0cc; }
.secondary:hover, .quiet:hover { background: #e9f2fe; }
.danger { color: var(--error); background: #fff; border-color: #e7beba; }
.danger:hover { background: #fff1ef; }
.record-actions { display: flex; gap: .4rem; white-space: nowrap; }
.main-action { width: 100%; }
.actions, .records-header, .pagination, .admin-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.admin-nav { margin-bottom: 1.2rem; }
.admin-nav a { padding: .55rem .6rem; border-radius: .45rem; text-decoration: none; }
.admin-nav a[aria-current="page"] { background: #ddeafd; color: #103776; font-weight: 750; }
.admin-nav form { margin-left: auto; }
.records { margin-top: 1.5rem; }
.records-header { justify-content: space-between; margin-bottom: .65rem; }
.records-header h2 span { color: var(--muted); font-size: .9rem; font-weight: 500; margin-left: .25rem; }
.table-panel { overflow-x: auto; }
table { width: 100%; min-width: 65rem; border-collapse: collapse; text-align: left; }
th, td { padding: .75rem .85rem; border-bottom: 1px solid #e3e9f1; vertical-align: top; overflow-wrap: anywhere; }
thead { background: #edf3fc; }
tbody tr:last-child > * { border-bottom: 0; }
.nowrap { white-space: nowrap; }
.purpose { min-width: 9rem; max-width: 18rem; white-space: pre-wrap; }
.pagination { justify-content: center; margin-top: .85rem; }
.empty { color: var(--muted); }
.department-list { list-style: none; padding: 0; margin: .65rem 0 0; }
.department-list li { display: flex; align-items: center; gap: .6rem; padding: .7rem .9rem; }
.department-list li + li { border-top: 1px solid var(--border); }
.department-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.result { display: grid; justify-items: center; gap: .9rem; text-align: center; }
.result p { color: var(--muted); }
.success-mark { display: grid; place-content: center; width: 3rem; height: 3rem; border-radius: 100%; background: #def4e9; color: #156542; font-size: 1.5rem; font-weight: 800; }
.receipt { width: 100%; padding: .8rem; border-radius: .6rem; background: #ecf3ff; }
.receipt dt { font-size: .9rem; color: var(--muted); }
.receipt dd { margin: 0; font: 700 1.25rem / 1.5 ui-monospace, monospace; overflow-wrap: anywhere; }

@media (min-width: 38rem) {
  .site-header-inner { padding-inline: 1.5rem; }
  .shell { width: min(100% - 3rem, 74rem); margin-top: 2.6rem; }
  .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main-action { width: auto; justify-self: start; }
}
@media (min-width: 63rem) {
  .filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.department-list li { flex-wrap: wrap; }
.rename-form { display: flex; gap: .4rem; align-items: center; }
.rename-form input { width: 11rem; max-width: 100%; padding: .35rem .5rem; }

.section { margin: 0; min-width: 0; padding: 1rem clamp(.9rem, 3vw, 1.3rem) 1.2rem; border: 1px solid var(--border); border-radius: .75rem; background: #fafbff; }
.section legend { padding: 0 .5rem; font-size: 1.05rem; font-weight: 800; color: var(--dark-blue); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.notice { max-height: 14rem; overflow-y: auto; padding: .8rem 1rem; border: 1px solid var(--border); border-radius: .6rem; background: #fff; font-size: .92rem; line-height: 1.7; }
.notice p { margin: 0 0 .5rem; }
.notice ol, .notice ul { margin: .3rem 0 0; padding-left: 1.3rem; }
.notice li + li { margin-top: .35rem; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 500; cursor: pointer; }
.check input { flex: none; width: 1.25rem; height: 1.25rem; margin-top: .2rem; }
