:root {
  color-scheme: light dark;
  --background: #f3f7f6;
  --surface: #ffffff;
  --text: #132623;
  --muted: #455e58;
  --border: #cddbd6;
  --accent: #0b6153;
  --accent-text: #ffffff;
  --tint: #e8f3ee;
  --danger: #962f32;
  --focus: #146a9d;
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --background: #101b19;
    --surface: #192824;
    --text: #e9f2ee;
    --muted: #b1c6bf;
    --border: #3c544c;
    --accent: #76d8bf;
    --accent-text: #092c23;
    --tint: #223b33;
    --danger: #ffaaaa;
    --focus: #90cdfd;
  }
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: var(--background); }
header { background: var(--surface); border-bottom: 1px solid var(--border); }
a { color: var(--accent); text-underline-offset: .2em; }
button, input { font: inherit; }
button, .button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.shell { width: min(calc(100% - 48px), 1240px); margin-inline: auto; }
.topbar { min-height: 72px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); font-weight: 700; text-decoration: none; }
.monogram { display: grid; place-items: center; width: 38px; height: 38px; background: var(--accent); color: var(--accent-text); border-radius: 10px; }
.brand-divider { display: inline-block; height: 16px; border-left: 1px solid var(--border); margin-inline: 9px; vertical-align: middle; }
main.shell { padding-block: 34px 56px; }
.page-heading { margin-bottom: 24px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.6rem, 3vw, 2.25rem); line-height: 1.23; overflow-wrap: anywhere; }
h2 { font-size: 1.125rem; }
p { margin-top: 8px; }
.muted, time { color: var(--muted); }
.caption { font-size: .85rem; }
.metrics { margin: 0 0 20px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metrics > div { min-width: 0; padding: 16px; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; }
dt { color: var(--muted); font-size: .875rem; }
dd { margin: 0; }
.metrics dd { margin-top: 3px; font-size: clamp(1.1rem, 3vw, 1.75rem); font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 310px); align-items: start; gap: 16px; }
.workspace.single { grid-template-columns: minmax(0, 1fr); }
.panel { min-width: 0; padding: 21px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.panel-heading, .title-line, .reply-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.panel-heading, .reply-heading { justify-content: space-between; }
.list-panel { padding: 0; }
.list-panel .panel-heading { padding: 16px 20px; }
.search { display: flex; gap: 8px; align-items: center; }
.search input { max-width: 184px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 10px 12px; text-align: left; overflow-wrap: anywhere; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
th { background: var(--tint); color: var(--muted); font-weight: 650; }
td { border-top: 1px solid var(--border); }
td:last-child { color: var(--muted); }
.row-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 620; }
.number { font-variant-numeric: tabular-nums; }
td small { display: block; margin-bottom: 6px; }
.button, .primary, .quiet { display: inline-flex; justify-content: center; align-items: center; min-height: 44px; padding: 7px 13px; border-radius: 8px; font-weight: 650; text-decoration: none; }
.button { color: var(--text); background: var(--surface); border: 1px solid var(--border); }
.quiet { color: var(--accent); background: transparent; border: 1px solid transparent; }
.primary { color: var(--accent-text); background: var(--accent); border: 1px solid var(--accent); }
.button:hover, .quiet:hover { background: var(--tint); }
.primary:hover { color: var(--accent-text); background: var(--accent); filter: brightness(.92); }
.danger { color: var(--danger); }
.form-stack, .actions { display: grid; gap: 14px; }
.form-stack { margin-top: 14px; }
.form-stack label { display: grid; gap: 6px; font-weight: 600; font-size: .92rem; }
.form-stack label, .form-stack .check { font-size: 1rem; }
input:not([type=checkbox], [type=hidden]) { min-width: 0; width: 100%; min-height: 44px; padding: 8px 11px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
input::placeholder { color: var(--muted); }
.form-stack label.check { min-height: 44px; display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-stack .caption { margin-top: -8px; }
.status { display: inline-block; border-radius: 6px; padding: 3px 8px; color: var(--accent); background: var(--tint); white-space: nowrap; font-size: .8rem; font-weight: 650; }
.status.disabled { color: var(--danger); background: var(--background); }
.breadcrumb, .pagination { color: var(--muted); font-size: .875rem; }
.breadcrumb { margin-bottom: 12px; }
.pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 20px; }
.jump { display: flex; align-items: center; gap: 8px; }
.jump label { width: 82px; }
.login-panel, .narrow { max-width: 470px; margin-inline: auto; }
.login-screen { min-height: calc(100dvh - 73px); display: grid; place-items: center; }
.login-panel { width: 100%; padding: 26px; }
.login-panel h1 { font-size: 1.7rem; }
.empty { padding: 0 20px 18px; }
.alert { color: var(--danger); }
.credential { display: grid; gap: 10px; }
.credential code { user-select: all; overflow-wrap: anywhere; }
.actions form, .actions details { margin-top: 12px; }
summary { cursor: pointer; min-height: 44px; padding-block: 8px; }
.reply-list { max-width: 850px; display: grid; gap: 12px; }
.reply pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; margin-bottom: 0; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip:focus { position: absolute; top: 4px; left: 4px; z-index: 1; padding: 8px; background: var(--surface); }
@media (max-width: 840px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 580px) {
  .shell { width: calc(100% - 28px); }
  .topbar { min-height: 60px; }
  main.shell { padding-block: 20px 32px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .actions { grid-template-columns: minmax(0, 1fr); }
  .list-panel .search { width: 100%; }
  .list-panel .search input { max-width: none; }
  table, tbody, tr, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tr { border-top: 1px solid var(--border); padding: 8px 14px; }
  td, td:first-child, td:last-child { padding: 4px 0; border: 0; }
  td:not(:first-child)::before { content: attr(data-label); display: inline-block; margin-right: 10px; color: var(--muted); }
  .login-screen { min-height: calc(100dvh - 61px); }
}
