:root {
  color-scheme: light;
  font: 14px/1.55 "Inter", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  color: #202935;
  background: #f5f7fa;
  --muted: #546272;
  --border: #dce3eb;
  --accent: #205bd3;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
h1, h2, p { margin: 0; }
button, input, select, a { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, [tabindex="0"]:focus-visible { outline: 3px solid #8eb1ff; outline-offset: 2px; }
.skip { position: fixed; left: 12px; top: -80px; z-index: 10; background: white; padding: 6px 10px; }
.skip:focus { top: 8px; }
.sr-only { position: absolute; height: 1px; width: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.topbar { border-bottom: 1px solid var(--border); background: white; }
.topbar-inner, .main { max-width: 1330px; margin: 0 auto; padding-inline: 28px; }
.topbar-inner { min-height: 59px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { font-size: 15px; font-weight: 750; white-space: nowrap; }
.user { display: flex; align-items: center; gap: 10px; color: var(--muted); min-width: 0; font-size: 13px; }
.user span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { padding-top: 28px; padding-bottom: 42px; }
.heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 9px 18px; margin-bottom: 16px; }
h1 { font-size: 30px; letter-spacing: -.035em; line-height: 1.22; }
h2 { font-size: 19px; }
.page-actions, .row-actions, .settings { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.row-actions { flex-wrap: nowrap; color: var(--muted); min-width: 137px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 37px; border-radius: 6px;
  padding: 7px 12px; background: white; border: 1px solid #d2dce7; color: #263951; text-decoration: none;
  white-space: nowrap; font-size: 13px; font-weight: 650;
}
.btn:hover { background: #eff3f9; }
.btn.primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn.primary:hover { background: #174aa9; border-color: #174aa9; }
.btn.small { min-height: 31px; padding: 3px 8px; font-size: 12px; }
.btn.wide, .link.wide { width: 100%; }
.link { background: transparent; border: 0; color: var(--accent); padding: 4px; white-space: nowrap; }
.link:hover { text-decoration: underline; }
.close { font-size: 24px; line-height: 1; padding: 5px 9px; color: var(--muted); }
.close:hover { background: #eff3f8; border-radius: 6px; text-decoration: none; }

.sheet { background: #fff; border: 1px solid var(--border); border-radius: 9px; }
.filters { display: flex; align-items: center; gap: 8px; padding: 11px 13px; border-bottom: 1px solid var(--border); }
.filters label:first-child { min-width: 0; }
.filters label:first-child select { max-width: min(45vw, 370px); text-overflow: ellipsis; }
.filters select, .field select, .field input {
  color: #263951; border: 1px solid #d2dce7; border-radius: 6px; background: #fff; min-height: 35px; padding: 5px 8px;
}
.row-count { margin-left: auto; color: var(--muted); font-size: 12px; text-align: right; white-space: nowrap; }
.table-scroll { overflow: auto; border-radius: 0 0 8px 8px; }
table { width: 100%; border-collapse: collapse; }
.chapter-table { min-width: 755px; }
th, td { padding: 11px 13px; text-align: left; border-bottom: 1px solid #e6ebf1; }
thead th { white-space: nowrap; background: #f4f7fb; color: #39495a; font-size: 12px; font-weight: 700; padding-block: 10px; }
tbody th { font-weight: 650; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:nth-child(even) { background: #fbfcfe; }
tbody tr:hover { background: #f5f8ff; }
.chapter-table td:first-child { min-width: 154px; max-width: 285px; overflow-wrap: anywhere; }
.chapter-table th:nth-child(2) { min-width: 96px; max-width: 260px; overflow-wrap: anywhere; }
.chapter-table td:nth-child(5) { max-width: 180px; overflow-wrap: anywhere; }
.numeric { font-variant-numeric: tabular-nums; }
.minor { display: block; color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 2px; }
.status { display: inline-block; border-radius: 4px; padding: 2px 6px; font-size: 12px; white-space: nowrap; }
.status.open { background: #f0f2f6; color: #43556d; }
.status.active { background: #eaf0ff; color: #224eb0; }
.status.done { background: #e8f5ee; color: #205e3e; }
.empty { padding: 39px 12px; color: var(--muted); text-align: center; }

.gate { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.gate-card, dialog {
  width: min(450px, calc(100vw - 32px)); border: 1px solid var(--border); border-radius: 10px; background: white;
  color: #202935; padding: 22px; box-shadow: 0 8px 30px #253b5b12;
}
.gate-card h1 { font-size: 23px; margin-bottom: 16px; }
dialog { max-height: 90dvh; overflow-y: auto; }
dialog.large { width: min(720px, calc(100vw - 32px)); }
dialog::backdrop { background: #131f3b76; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.field { display: grid; gap: 5px; margin-bottom: 12px; min-width: 0; }
.field span { font-size: 13px; font-weight: 650; }
.field input, .field select { width: 100%; min-width: 0; }
.hint { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.form-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 12px; }
.form-error { color: #963728; font-size: 13px; margin: 8px 0; }
.form-error:empty { display: none; }
.project-select { margin-top: 12px; }
#import-content { margin-top: 12px; }
.preview-table { border: 1px solid var(--border); border-radius: 6px; max-height: 45dvh; }
.preview-table thead th { position: sticky; top: 0; }
.preview-table th:first-child { min-width: 70px; }
.report-range { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.report-range .field { margin-bottom: 0; flex: 1 1 125px; }
.report-range .form-error { flex: 1 0 100%; }
#report-result { margin-top: 14px; }
.result-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; }
#notice { position: fixed; opacity: 0; visibility: hidden; bottom: 16px; right: 16px; padding: 8px 12px; max-width: calc(100vw - 32px); z-index: 8; border-radius: 6px; color: white; background: #193759; }
#notice.show { opacity: 1; visibility: visible; }
#notice.error { background: #92382d; }

.brand-nav, .brand-nav nav { display: flex; align-items: center; gap: 22px; }
.brand-nav nav a { color: var(--muted); text-decoration: none; padding: 18px 0; border-bottom: 2px solid transparent; }
.brand-nav nav a[aria-current="page"] { color: var(--accent); border-color: var(--accent); font-weight: 700; }
.subtitle { color: var(--muted); margin-top: 9px; font-size: 13px; }
.report-controls { padding: 18px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 18px 28px; }
.report-tabs { display: flex; gap: 6px; }
.report-controls .report-range { flex: 1; max-width: 370px; }
.statistics-main #report-result { margin-top: 22px; }
.stat-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { padding: 20px 22px; display: grid; gap: 8px; }
.stat-card span { color: var(--muted); font-size: 13px; }
.stat-card strong { font-size: 32px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-card small { font-size: 13px; font-weight: 400; color: var(--muted); }
.report-tables { display: grid; gap: 18px; }
.report-tables.monthly { grid-template-columns: 1fr 1fr; align-items: start; }
.report-table h2 { padding: 17px 18px; font-size: 16px; }
.report-table th, .report-table td { padding-inline: 18px; }
.report-table th:last-child, .report-table td:last-child { text-align: right; }
.report-warning { background: #fff7e8; border: 1px solid #ead9b7; border-radius: 8px; padding: 15px 18px; margin-bottom: 20px; color: #6c4e23; font-size: 13px; }
.report-warning p + p { margin-top: 8px; }
.report-warning summary { cursor: pointer; font-weight: 650; }
.report-warning[open] summary { margin-bottom: 10px; }

@media (max-width: 640px) {
  .topbar-inner { flex-wrap: wrap; padding-block: 9px; }
  .brand-nav { gap: 14px; }
  .brand-nav nav { gap: 12px; font-size: 12px; }
  .brand-nav nav a { padding-block: 8px; }
  .report-tables.monthly { grid-template-columns: 1fr; }
  .stat-cards { gap: 9px; }
  .stat-card { padding: 15px; }
  .stat-card strong { font-size: 27px; }
  .topbar-inner, .main { padding-inline: 12px; }
  .main { padding-top: 18px; }
  h1 { font-size: 24px; }
  .heading { margin-bottom: 12px; }
  .btn { padding-inline: 9px; }
  .filters { padding-inline: 8px; }
  th, td { padding-inline: 9px; }
}
