* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: #1f2329; background: #f5f6f7; }
a { color: #1664ff; }
button { font: inherit; padding: 4px 12px; border: 1px solid #c9cdd4; border-radius: 4px; background: #fff; cursor: pointer; }
button:hover:not(:disabled) { border-color: #1664ff; color: #1664ff; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: #1664ff; border-color: #1664ff; color: #fff; }
button.primary:hover:not(:disabled) { color: #fff; background: #4080ff; }
button.danger { color: #d93026; }
button.mini { padding: 0 6px; font-size: 12px; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #1664ff; outline-offset: 1px; }
input, select { font: inherit; padding: 3px 6px; border: 1px solid #c9cdd4; border-radius: 4px; background: #fff; }
input:disabled, select:disabled { background: #f2f3f5; color: #4e5969; }
.topbar { display: flex; align-items: center; gap: 16px; height: 48px; padding: 0 20px; background: #fff; border-bottom: 1px solid #e5e6eb; }
.topbar .brand { font-weight: 600; }
.topbar nav a { margin-right: 12px; text-decoration: none; color: #4e5969; }
.topbar nav a.active { color: #1664ff; font-weight: 600; }
.spacer { flex: 1; }
.page { padding: 16px 20px; }
.card { background: #fff; border: 1px solid #e5e6eb; border-radius: 6px; padding: 16px; margin-bottom: 16px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
table.list { width: 100%; border-collapse: collapse; background: #fff; }
table.list th, table.list td { padding: 6px 8px; border-bottom: 1px solid #e5e6eb; text-align: left; vertical-align: top; }
table.list th { background: #f7f8fa; font-weight: 600; }
.err { color: #d93026; font-size: 12px; }
.muted { color: #86909c; font-size: 12px; }
.tag { display: inline-block; padding: 0 6px; border-radius: 3px; font-size: 12px; }
.st-NONE { background: #f2f3f5; color: #86909c; }
.st-PENDING { background: #fff7e8; color: #b25e00; }
.st-REVIEWING { background: #f5e8ff; color: #722ed1; }
.st-SUBMITTED { background: #e8f3ff; color: #1664ff; }
.st-DONE { background: #e8ffea; color: #00875a; }
.login { max-width: 360px; margin: 12vh auto; }
.login label { display: block; margin-bottom: 12px; }
.login input { width: 100%; margin-top: 4px; }
.matrix { border-collapse: collapse; background: #fff; }
.matrix th, .matrix td { border: 1px solid #e5e6eb; padding: 0; text-align: center; min-width: 72px; }
.matrix th { background: #f7f8fa; padding: 4px 6px; font-weight: 600; white-space: nowrap; }
.matrix td button { width: 100%; height: 40px; border: 0; border-radius: 0; }
.matrix td.st-NONE button { background: #f2f3f5; color: #86909c; }
.matrix td.st-PENDING button { background: #ffe4ba; }
.matrix td.st-REVIEWING button { background: #e4ccff; }
.matrix td.st-SUBMITTED button { background: #bedaff; }
.matrix td.st-DONE button { background: #aff0b5; }
.legend span { margin-right: 12px; }
.book-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(360px, 1fr); gap: 16px; align-items: start; }
.meta-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.meta-form label { display: flex; flex-direction: column; font-size: 12px; color: #4e5969; }
.tree { max-height: calc(100vh - 300px); overflow: auto; }
.tree-row { display: flex; align-items: center; gap: 2px; padding: 3px 4px; border-bottom: 1px solid #f2f3f5; }
.tree-row.selected { background: #e8f3ff; }
.tree-row .name { flex: 1; min-width: 100px; }
.tree-row select { width: 84px; }
.tree-row button.mini { white-space: nowrap; padding: 0 3px; }
.tree-row input.num { width: 46px; }
.tree-row .end { width: 40px; font-size: 12px; color: #86909c; }
.tree-row label { font-size: 12px; white-space: nowrap; display: flex; align-items: center; }
.preview { position: sticky; top: 8px; }
.pdf-view { width: 100%; min-height: 300px; border: 1px solid #e5e6eb; background: #fff; }
.pdf-view canvas { display: block; }
.pdf-view p { padding: 16px; }
.footer-bar { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 10px 20px; background: #fff; border-top: 1px solid #e5e6eb; }
.toast { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); padding: 8px 16px; border-radius: 4px; background: #1f2329; color: #fff; z-index: 99; }
.toast.error { background: #d93026; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.combo { display: inline-flex; gap: 4px; }
td.msg { max-width: 420px; white-space: pre-wrap; word-break: break-all; }
.hint { margin: 8px 4px 0; line-height: 1.6; }
.notice { border-color: #f7c46c; background: #fff7e8; }
.notice.ok { border-color: #7be188; background: #e8ffea; }
.notice ul { margin: 6px 0; padding-left: 20px; }
