:root {
  color-scheme: light;
  --background: #f4f4ed;
  --paper: #fffef9;
  --ink: #202b24;
  --muted: #536359;
  --line: #d8dfd6;
  --field-line: #a7b4a8;
  --accent: #23573f;
  --accent-hover: #19442f;
  --accent-soft: #e8efe6;
  --danger: #8f3438;
  --danger-soft: #f9ebea;
  --warning: #754f17;
  --warning-soft: #f7eed9;
  --shadow: 0 0 0 1px rgb(40 65 48 / 7%), 0 2px 5px rgb(40 65 48 / 4%), 0 16px 34px rgb(40 65 48 / 5%);
  --control-radius: 0.625rem;
  --panel-padding: clamp(1rem, 3vw, 1.625rem);
  --panel-radius: calc(var(--control-radius) + var(--panel-padding));
  --gutter: clamp(1rem, 4vw, 2.5rem);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--background);
  line-height: 1.6;
}

h1, h2 { margin: 0; line-height: 1.2; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--accent); }
button, input, textarea, select { font: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  z-index: 1;
  inset-block-start: 0.5rem;
  inset-inline-start: var(--gutter);
  padding: 0.65rem 0.85rem;
  border-radius: var(--control-radius);
  background: var(--paper);
  transform: translateY(-150%);
}

.skip-link:focus { transform: none; }

.shell {
  width: min(100% - 2 * var(--gutter), 70rem);
  margin-inline: auto;
}

.site-header {
  border-block-end: 1px solid var(--line);
  background: #fafaf4;
}

.site-header-inner {
  min-height: 4.375rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.site-link {
  min-height: 44px;
  padding-inline: 0.375rem;
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--ink);
  border-radius: var(--control-radius);
  text-decoration: none;
  font-weight: 700;
}

.site-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 0.25em; }

.site-mark {
  position: relative;
  width: 2.125rem;
  height: 2.125rem;
  flex: 0 0 auto;
  color: white;
  background: var(--accent);
  border-radius: 0.625rem;
}

.site-mark::before, .site-mark::after {
  position: absolute;
  content: '';
  border: 1.5px solid currentColor;
}

.site-mark::before {
  inset-block-start: 0.625rem;
  inset-inline-start: 0.5625rem;
  width: 1rem;
  height: 0.6875rem;
  border-radius: 0.2rem;
}

.site-mark::after {
  inset-block-start: 1.1875rem;
  inset-inline-start: 0.75rem;
  width: 0.3rem;
  height: 0.3rem;
  background: var(--accent);
  border-block-start: 0;
  border-inline-end: 0;
  transform: skewY(-35deg);
}

.page {
  padding-block: clamp(1.625rem, 6vw, 4.375rem) 3rem;
}

.page-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: 0.625rem 2rem;
  margin-block-end: clamp(1.375rem, 4vw, 2.625rem);
}

.page-title {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-family: "Instrument Serif", "Songti SC", "STSong", "Noto Serif CJK SC", "SimSun", serif;
  font-size: clamp(2.375rem, 6vw, 4.25rem);
  font-weight: 700;
  letter-spacing: -0.035em;
}

.page-scope {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.875rem;
}

.page-scope bdi, .comment-scope bdi {
  font: 0.925em ui-monospace, "IBM Plex Mono", Consolas, monospace;
  color: var(--ink);
}

.public-grid, .admin-layout {
  display: grid;
  align-items: start;
  gap: clamp(1rem, 3vw, 1.75rem);
}

.public-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.admin-layout {
  grid-template-columns: minmax(15rem, 4fr) minmax(0, 8fr);
  grid-template-areas: 'filters queue' 'notice queue';
  grid-template-rows: auto 1fr;
}

.filter-panel { grid-area: filters; }
.queue-panel { grid-area: queue; }
.notification-panel { grid-area: notice; }

.panel {
  min-width: 0;
  padding: var(--panel-padding);
  border-radius: var(--panel-radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.panel h2 { font-size: 1.25rem; }
.panel-heading { margin-block-end: 1.125rem; }
.panel-caption { margin-block-start: 0.375rem; color: var(--muted); font-size: 0.875rem; }

fieldset { min-width: 0; padding: 0; margin: 0; border: 0; }
.form-stack { display: grid; gap: 1rem; }
.form-stack > * { min-width: 0; }
.field { display: grid; gap: 0.375rem; }
.field label { font-size: 0.875rem; font-weight: 700; }

.field input, .field textarea, .field select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--field-line);
  border-radius: var(--control-radius);
  background: #fcfcf7;
  color: var(--ink);
  font-size: 1rem;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.field input:hover, .field textarea:hover, .field select:hover { border-color: var(--muted); }
.field [aria-invalid='true'] { border-color: var(--danger); }
.field :disabled { opacity: 0.65; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: 1; }
.field textarea { min-height: 8rem; resize: vertical; }

.field-footer, .button-row, .list-header, .comment-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.field-footer { justify-content: space-between; color: var(--muted); font-size: 0.8125rem; }
.counter, time, .list-status { font-variant-numeric: tabular-nums; }
.counter { white-space: nowrap; }

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease, scale 180ms cubic-bezier(0.2, 0, 0, 1);
}

.button:hover { background-color: #dce8da; }
.button:active { scale: 0.96; }
.button:disabled, .button[aria-disabled='true'] {
  color: var(--muted);
  border-color: var(--line);
  background: var(--background);
  cursor: default;
  scale: 1;
}

.button--primary { color: white; background: var(--accent); }
.button--primary:hover { background: var(--accent-hover); }
.button--quiet { background: transparent; border-color: var(--line); }
.button--icon { padding-inline-start: 0.75rem; }
.button-icon { font-family: system-ui, sans-serif; font-size: 1.1em; transform: translateY(-0.04em); }
.button--small { min-height: 40px; font-size: 0.8125rem; }
.button--reject { color: var(--warning); background: var(--warning-soft); }
.button--reject:hover { background: #f1e2bf; }
.button--delete { color: var(--danger); background: var(--danger-soft); }
.button--delete:hover { background: #f5dddc; }

.feedback {
  overflow-wrap: anywhere;
  color: var(--muted);
  border-radius: var(--control-radius);
  font-size: 0.875rem;
}

.feedback:not(:empty) {
  margin-block-start: 0.75rem;
  padding: 0.625rem 0.75rem;
  background: var(--background);
}

.feedback[data-tone='success'] { color: var(--accent); background: var(--accent-soft); }
.feedback[data-tone='error'] { color: var(--danger); background: var(--danger-soft); }
.form-stack > .feedback { display: none; }
.form-stack > .feedback:not(:empty) { display: block; margin-block-start: 0; }

.list-header { justify-content: space-between; }
.list-status { margin-block-start: 0.5rem; color: var(--muted); font-size: 0.875rem; }
.list-status:empty { margin-block-start: 0; }
.list-context { color: var(--muted); font-size: 0.8125rem; overflow-wrap: anywhere; }

.comment-list { list-style: none; padding: 0; margin: 0; }
.comment-list:not(:empty) { margin-block-start: 0.75rem; }
.comment { border-block-start: 1px solid var(--line); padding-block: 1rem; }
.comment:last-child { padding-block-end: 0; }
.comment-meta { gap: 0.25rem 0.75rem; }
.comment-meta strong { min-width: 0; overflow-wrap: anywhere; }
.comment-meta time, .comment-scope { color: var(--muted); font-size: 0.8125rem; }
.comment-scope { margin-block-start: 0.25rem; overflow-wrap: anywhere; }
.comment-body {
  margin-block-start: 0.375rem;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  text-wrap: wrap;
}
.comment-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-block-start: 0.75rem; }
.list-more { margin-block-start: 1rem; }

.admin-login { max-width: 27rem; }
.status-mark {
  padding: 0.1875rem 0.5rem;
  border-radius: 0.375rem;
  color: var(--muted);
  background: var(--background);
  font-size: 0.75rem;
  font-weight: 700;
}
.status-mark--pending { color: var(--warning); background: var(--warning-soft); }
.status-mark--approved { color: var(--accent); background: var(--accent-soft); }
.status-mark--rejected { color: var(--danger); background: var(--danger-soft); }

.notification-panel .button { margin-block-start: 0.75rem; }
.notification-channel { margin-block-start: 0.5rem; color: var(--muted); font-size: 0.875rem; }
.notification-channel strong { color: var(--ink); }

.is-embedded [data-standalone] { display: none; }
.is-embedded .shell { --gutter: clamp(0.625rem, 2vw, 1.25rem); }
.is-embedded .page { padding-block: 1rem; }
.is-embedded .page-heading { margin-block-end: 1rem; }
.is-embedded .page-title { font-size: clamp(1.625rem, 5vw, 2.25rem); }

@media (max-width: 45rem) {
  .public-grid { grid-template-columns: minmax(0, 1fr); }
  .admin-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'filters' 'queue' 'notice';
    grid-template-rows: auto;
  }
  .site-header-inner { min-height: 3.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  .button, .field input, .field textarea, .field select { transition: none; }
  .button:active { scale: 1; }
}

@media (forced-colors: active) {
  .panel { border: 1px solid CanvasText; }
  .button { border-color: ButtonText; }
  :focus-visible { outline-color: Highlight; }
}
