:root {
  color-scheme: light;
  --ink: #1c1915;
  --ink-soft: #3f3a34;
  --paper: #f6f3ee;
  --paper-2: #fbfaf7;
  --line: #e4ddd2;
  --line-strong: #b7aea2;
  --forest: #1f4b3a;
  --forest-press: #10261e;
  --good-ink: #143d2c;
  --good-bg: #e5f2ea;
  --warn-ink: #6a3d0a;
  --bad-ink: #8a1f14;
  --bad-bg: #fde8e4;
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;
  --hit: 44px;
  --radius: 4px;
  --measure: 40rem;
  --page: 76rem;
  --font: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --mono: ui-monospace, "SF Mono", "Menlo", monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-padding-top: var(--hit); }

body {
  margin: 0;
  font: 16px/1.6 var(--font);
  color: var(--ink);
  background: var(--paper);
}

::selection { background: #d5e4dc; color: var(--ink); }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--forest);
  outline-offset: 2px;
}

a { color: var(--forest); text-underline-offset: 3px; }
a:hover { color: var(--forest-press); }

.skip {
  position: absolute;
  left: var(--s4);
  top: -48px;
  z-index: 5;
  background: #fff;
  color: var(--ink);
  padding: var(--s2) var(--s3);
}
.skip:focus { top: var(--s2); }

.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

header.top {
  background: var(--forest);
  color: var(--paper);
}
.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  width: min(100%, calc(var(--page) + var(--s6)));
  margin: 0 auto;
  padding-inline: var(--s4);
}
header.top a { color: var(--paper); text-decoration: none; }
header.top :focus-visible { outline-color: var(--paper); }

.brand {
  display: inline-flex;
  align-items: center;
  order: 1;
  min-height: var(--hit);
  font-weight: 700;
}
.account { display: flex; align-items: center; order: 3; margin-left: auto; }
.account a { padding: 0 var(--s3); }
nav.primary {
  display: flex;
  flex-wrap: wrap;
  order: 2;
  margin-left: var(--s2);
}
nav.primary a,
header.top button {
  display: inline-flex;
  align-items: center;
  min-height: var(--hit);
  padding: 0 var(--s3);
  background: transparent;
  color: var(--paper);
  border: 0;
  border-radius: 0;
  cursor: pointer;
}
header.top a[aria-current="page"] { text-decoration: underline; text-underline-offset: 6px; }
header form { margin: 0; }

nav.sub {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
nav.sub .bar {
  align-items: stretch;
  flex-wrap: nowrap;
  gap: var(--s1);
  overflow-x: auto;
}
nav.sub a {
  display: inline-flex;
  align-items: center;
  min-height: var(--hit);
  padding: 0 var(--s3);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
nav.sub a:hover { color: var(--forest); }
nav.sub a[aria-current="page"] {
  color: var(--forest);
  font-weight: 600;
  border-bottom-color: var(--forest);
}
.sub-break {
  width: 1px;
  align-self: stretch;
  margin: var(--s3) var(--s2);
  background: var(--line);
  flex: 0 0 auto;
}

main {
  width: min(100%, calc(var(--page) + var(--s6)));
  margin: 0 auto;
  padding: var(--s6) var(--s4) var(--s8);
}
main:focus { outline: none; }

h1 {
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.3;
  font-weight: 700;
}
h2 {
  margin: var(--s7) 0 var(--s4);
  font-size: 1.25rem;
  line-height: 1.35;
  font-weight: 700;
  scroll-margin-top: 56px;
}
h3 { margin: var(--s5) 0 var(--s2); font-size: 1.125rem; line-height: 1.4; font-weight: 600; }
h4 { margin: var(--s4) 0 var(--s2); font-size: 1rem; line-height: 1.4; }
p { margin: 0 0 var(--s4); }
.lede, .measure { max-width: var(--measure); }
.lede { color: var(--ink-soft); margin-top: var(--s2); }
.muted, .hint { color: var(--ink-soft); font-weight: 400; font-size: 0.875rem; line-height: 1.5; }

.page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s4);
  margin-bottom: var(--s5);
}
.poll-alert {
  margin: 0 0 var(--s5);
  padding: var(--s3) var(--s4);
  border: 1px solid #f0c2bb;
  background: var(--bad-bg);
}
.poll-alert ul { margin: var(--s2) 0 0; padding-left: 1.2rem; }
.poll-opt { display: flex; gap: var(--s2); align-items: center; }
.poll-opt input { flex: 1; }
.poll-card { margin: 0 0 var(--s5); padding: var(--s4); border: 1px solid var(--line); background: #fff; }
.topic-zone { margin: var(--s5) 0 0; }
.topic-zone tbody tr:nth-child(odd) { background: #fff; }
.topic-zone tbody tr:nth-child(even) { background: #efeae2; }
.topic-zone tbody tr:hover { background: #e3efe8; }
.topic-card { margin: 0 0 var(--s4); }
.topic-card p { margin: var(--s2) 0 0; }
.poll-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.poll-head h2 { margin: 0; }
.prop-choice { display: flex; align-items: flex-start; gap: var(--s2); font-weight: 400; }
.prop-choice input { flex: 0 0 auto; margin-top: 0.2rem; }
.poll-choice { display: flex; flex-wrap: nowrap; align-items: center; gap: var(--s2); font-weight: 400; }
.poll-choice input { flex: 0 0 auto; }
.poll-choice .hint { margin-left: auto; white-space: nowrap; }
.topic-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s3);
  margin: 0 0 var(--s5);
}
.topic-unset { margin: 0; font-weight: 600; line-height: 2.5rem; }
.topic-pick { flex: 1 1 16rem; margin: 0; }
.topic-pick summary {
  cursor: pointer;
  font-weight: 600;
  line-height: 1.5;
  padding: 0.6rem 0;
}
.topic-pick p { margin: 0 0 var(--s2); max-width: var(--measure); }
.view-switch { margin: 0; }
button.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
}
button.switch:hover { background: var(--paper-2); color: var(--ink); }
.switch-track {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #c5c5c5;
}
.switch.is-on .switch-track { background: var(--forest); }
.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
}
.switch.is-on .switch-knob { left: 18px; }
.crumb {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  align-items: center;
  margin: 0 0 var(--s2);
  color: var(--ink-soft);
  font-size: 0.875rem;
}
.crumb a { color: inherit; }
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  align-items: center;
  margin: var(--s3) 0 0;
  color: var(--ink-soft);
}
.jump { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin: 0 0 var(--s2); }

.status { color: var(--ink-soft); font-size: 0.875rem; white-space: nowrap; }
.status-good { color: var(--good-ink); }
.status-warn { color: var(--warn-ink); }
.status-bad { color: var(--bad-ink); font-weight: 600; }

.ok, .err {
  margin: 0 0 var(--s5);
  padding: var(--s3) var(--s4);
}
.ok { background: var(--good-bg); color: var(--good-ink); }
.err { background: var(--bad-bg); color: var(--bad-ink); }
.empty {
  margin: 0 0 var(--s5);
  padding: var(--s5) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  max-width: var(--measure);
}

.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line);
}
.list a.grow {
  flex: 1 1 12rem;
  min-width: 0;
  min-height: var(--hit);
  display: flex;
  align-items: center;
  font-weight: 600;
}

.metric {
  margin: 0 0 var(--s5);
  padding: var(--s4) 0 0;
  border-top: 1px solid var(--line);
  max-width: var(--measure);
}
.metric-label { margin: 0; color: var(--ink-soft); font-size: 0.875rem; }
.metric-value {
  margin: var(--s1) 0 var(--s2);
  font-size: 2rem;
  line-height: 1.2;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.metric-value.is-bad { color: var(--bad-ink); }

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: var(--s3);
  margin: 0 0 var(--s5);
}
.stat {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--s2);
  min-height: 8.5rem;
  padding: var(--s4);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
}
.stat:hover { color: var(--ink); }
.stat-label { font-size: 0.875rem; font-weight: 700; }
.stat-value { font-size: 1.75rem; line-height: 1.2; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-title {
  font-size: 1.05rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.stat-meta { font-size: 0.875rem; }
.stat-event { background: var(--good-bg); }
.stat-poll { background: #f8ecd4; }
.stat-topic { background: #e4eef6; }
.stat-final { background: #f3e6f5; }
.stat-final.is-soon { background: var(--bad-bg); }
.stat-form { display: grid; gap: var(--s1); margin: 0; }
.stat-form label { font-size: 0.8125rem; font-weight: 600; }
.stat-form button { min-height: 2.25rem; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: #fff;
  margin: 0 0 var(--s5);
}
table { width: 100%; border-collapse: collapse; min-width: 40rem; font-variant-numeric: tabular-nums; }
th, td {
  padding: var(--s3);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
th {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--paper-2);
  white-space: nowrap;
}
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--paper-2); }

.actions, form.inline, .inline {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  align-items: center;
}
form.inline, .actions form { margin: 0; }
.actions select, form.inline select { width: auto; min-width: 8rem; }

button, .button, input, select, textarea { font: inherit; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: var(--s2) var(--s4);
  background: var(--forest);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
}
button:hover, .button:hover { background: #17382c; color: #fff; }
button:active, .button:active { background: var(--forest-press); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.secondary, .button.secondary {
  background: transparent;
  color: var(--forest);
  border-color: var(--line-strong);
}
button.secondary:hover, .button.secondary:hover { background: var(--paper-2); color: var(--forest-press); }
button.danger {
  background: transparent;
  color: var(--bad-ink);
  border-color: #e3b2aa;
}
button.danger:hover { background: var(--bad-bg); color: var(--bad-ink); }
label { display: grid; gap: var(--s2); font-weight: 600; }
.pw { display: flex; gap: var(--s2); align-items: center; }
.pw input { flex: 1; min-width: 0; width: auto; }
.pw button {
  width: auto;
  flex: 0 0 auto;
  background: transparent;
  color: var(--forest);
  border-color: var(--line-strong);
}
.pw button:hover { background: var(--paper-2); color: var(--forest-press); }
.links { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s4); margin-top: var(--s4); }
[hidden] { display: none !important; }
input[autocomplete="one-time-code"] {
  max-width: 12rem;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2em;
}
.stack { display: grid; gap: var(--s4); max-width: 36rem; }
.stack h2 { margin: var(--s2) 0 0; font-size: 1rem; }
.filters { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: end; margin-bottom: var(--s5); }
.filters label { min-width: min(100%, 16rem); }

input, select, textarea {
  width: 100%;
  min-height: var(--hit);
  padding: var(--s2) var(--s3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 8rem; height: auto; padding-block: var(--s3); line-height: 1.6; }
textarea.note { min-height: 4.5rem; width: 18rem; display: block; }
details.confirm-remove { position: relative; }
details.confirm-remove summary {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: var(--s2) var(--s4);
  list-style: none;
  cursor: pointer;
  color: var(--bad-ink);
  background: transparent;
  border: 1px solid #e3b2aa;
  border-radius: var(--radius);
}
details.confirm-remove summary::-webkit-details-marker { display: none; }
details.confirm-remove[open] summary { border-color: var(--bad-ink); }
details.confirm-remove p { margin: var(--s2) 0; }
input[type="checkbox"], input[type="radio"] { width: 1.125rem; height: 1.125rem; min-height: 0; padding: 0; accent-color: var(--forest); }
input[type="file"] { padding: var(--s2); background: #fff; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--forest); }
input[readonly], select:disabled, textarea[readonly] { background: var(--paper-2); color: var(--ink); }
.stack > .hint, main > form + form, .stack + form { margin-top: var(--s2); }
main > form + form, .stack + form { margin-bottom: var(--s4); }

.checks { display: grid; margin: var(--s4) 0; max-width: 36rem; border-top: 1px solid var(--line); }
.checks label {
  display: flex;
  gap: var(--s3);
  align-items: center;
  min-height: var(--hit);
  padding: var(--s2) 0;
  border-bottom: 1px solid var(--line);
  font-weight: 400;
}

.facts { margin: 0 0 var(--s5); max-width: var(--measure); }
.facts div { display: grid; gap: var(--s1); padding: var(--s3) 0; border-top: 1px solid var(--line); }
.facts div:last-child { border-bottom: 1px solid var(--line); }
.facts dt { margin: 0; color: var(--ink-soft); font-size: 0.875rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }

dialog.sheet {
  width: min(76rem, calc(100% - 2rem));
  max-height: calc(100vh - 2rem);
  margin: auto;
  padding: var(--s5);
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
}
dialog.sheet::backdrop { background: rgba(28, 25, 21, 0.45); }
.month-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  align-items: center;
  margin: 0 0 var(--s4);
}
table.month { min-width: 52rem; }
table.month td { min-width: 6.5rem; }
table.month td.is-out { color: var(--line-strong); background: var(--paper-2); }
.day-num { display: block; font-weight: 700; font-variant-numeric: tabular-nums; }
form.slot-form { margin: var(--s1) 0 0; }
button.slot {
  width: 100%;
  min-height: 28px;
  padding: 2px var(--s2);
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  font-size: 0.75rem;
}
button.slot:hover { background: var(--paper-2); color: var(--ink); }
button.slot.is-on, button.slot.is-on:hover { background: var(--forest); color: #fff; border-color: var(--forest); }
.who { margin: var(--s1) 0 0; font-size: 0.75rem; line-height: 1.4; }

.explorer {
  border: 1px solid #b4b4b4;
  background: #f3f3f3;
  color: #1a1a1a;
  max-width: 100%;
}
.explorer-title {
  background: #fff;
  border-bottom: 1px solid #d0d0d0;
  padding: 8px 12px;
  font-weight: 600;
}
.explorer-tool, .explorer-address, .explorer-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: #f3f3f3;
  border-bottom: 1px solid #e0e0e0;
}
.explorer-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 0; }
.explorer-inline label { font-weight: 400; min-width: 12rem; }
.explorer-address { background: #fff; }
.explorer-list { margin: 0; border: 0; background: #fff; }
.explorer-list table { min-width: 40rem; }
.explorer-name { display: inline-flex; align-items: center; gap: 8px; min-height: 28px; text-decoration: none; color: inherit; }
.explorer-name::before { content: ""; width: 16px; height: 14px; background: #c8c8c8; border: 1px solid #8a8a8a; flex: 0 0 auto; }
.explorer-dl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-left: 8px;
  color: var(--forest);
  vertical-align: middle;
}
.preview-img { max-width: 100%; height: auto; background: #fff; border: 1px solid var(--line); }
.preview-pdf { width: 100%; height: 70vh; border: 1px solid var(--line); background: #fff; }
.explorer-name.is-dir::before { background: #ffc83d; border-color: #c48a00; }
.explorer-list tbody tr:hover { background: #cce8ff; }
.explorer-status { border-bottom: 0; border-top: 1px solid #e0e0e0; color: #444; font-size: 0.875rem; }

article.minute { padding: var(--s5) 0; border-top: 1px solid var(--line); max-width: var(--measure); }
article.minute h3 { margin-top: 0; }
pre.draft {
  margin: 0 0 var(--s4);
  padding: var(--s4);
  max-width: var(--measure);
  overflow-x: auto;
  white-space: pre-wrap;
  background: #fff;
  border: 1px solid var(--line);
  font: 0.875rem/1.6 var(--mono);
}

@media (min-width: 768px) {
  .bar, main { width: min(100%, calc(var(--page) + var(--s8))); }
  .bar { padding-inline: var(--s6); }
  header.top .bar { flex-wrap: nowrap; }
  .brand { order: 1; }
  nav.primary { order: 2; flex-basis: auto; border-top: 0; margin-left: var(--s2); }
  .account { order: 3; }
  main { padding: var(--s7) var(--s6) var(--s8); }
}

@media (max-width: 479px) {
  nav.primary {
    order: 3;
    flex-basis: 100%;
    margin-left: 0;
    border-top: 1px solid rgba(246, 243, 238, 0.28);
  }
  .account { order: 2; }
}

@media (max-width: 767px) {
  .page-head .button, .stack > button, .stack > .button { width: 100%; }
  h1 { font-size: 1.5rem; }
  th:first-child, td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: #fff;
    box-shadow: 1px 0 0 var(--line);
  }
  th:first-child { z-index: 2; background: var(--paper-2); }
  tbody tr:hover td:first-child { background: var(--paper-2); }
  .topic-zone tbody tr:nth-child(odd) td:first-child { background: #fff; }
  .topic-zone tbody tr:nth-child(even) td:first-child { background: #efeae2; }
  .topic-zone tbody tr:hover td:first-child { background: #e3efe8; }
}

@media (pointer: coarse) {
  button, .button { min-height: var(--hit); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
