:root {
  color-scheme: light;
  --bg: #f2f6f5;
  --panel: #fff;
  --ink: #172e37;
  --muted: #526770;
  --line: #d7e2e1;
  --brand: #08675f;
  --brand-hover: #064e49;
  --brand-soft: #e4f3f0;
  --ok: #186541;
  --ok-soft: #e5f5eb;
  --warn: #84500c;
  --warn-soft: #fff2d9;
  --bad: #a03533;
  --bad-soft: #fceceb;
  --side: #132a35;
  --side-active: #244650;
  --radius: 14px;
  --gutter: clamp(18px, 2.5vw, 42px);
  --shadow: 0 2px 8px rgb(22 51 56 / 4%);
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.65 Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: var(--bg); color: var(--ink);
}
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: var(--brand); text-decoration: none; text-underline-offset: .16em; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 3px solid #147b8f; outline-offset: 3px; }
#view:focus:not(:focus-visible) { outline: none; }
.skip-link { position: fixed; inset: 6px auto auto 8px; z-index: 15; padding: 8px 16px; border-radius: 7px; background: white; font-weight: 700; transform: translateY(-155%); }
.skip-link:focus { transform: none; }

.shell { display: flex; min-height: 100vh; }
.side {
  position: sticky; top: 0; flex: 0 0 238px; align-self: flex-start; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; background: var(--side); color: #e5f0f1;
}
.side-head { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 25px 22px 23px; border-bottom: 1px solid #30464f; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 12px; color: #113f40; background: #8ad7c8; font: bold 34px/1 Georgia, serif; }
.brand-name { color: #fff; font-size: 24px; letter-spacing: -.045em; font-weight: 720; line-height: 1.05; }
.brand-product { display: block; margin-top: 5px; color: #b5cccf; font-size: 11px; font-weight: 500; line-height: 1.4; letter-spacing: .06em; }
#nav { display: flex; flex-direction: column; gap: 19px; overflow-y: auto; overscroll-behavior: contain; padding: 19px 13px 32px; scrollbar-color: #4a666e transparent; scrollbar-width: thin; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { margin: 0 0 4px; padding: 0 12px; color: #a6c1c4; font-size: 12px; letter-spacing: .05em; font-weight: 600; }
#nav a { display: block; position: relative; padding: 7px 12px; border-radius: 6px; color: #e6eff0; line-height: 1.5; }
#nav a:hover { background: #1c3943; color: #fff; text-decoration: none; }
#nav a.on, #nav a[aria-current=page] { background: var(--side-active); color: #fff; font-weight: 660; box-shadow: inset 3px 0 #87d9c9; }
#nav a:focus-visible, .menu-toggle:focus-visible { outline-color: #a7eee1; }
.menu-toggle { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 18px; min-height: 64px; padding: 10px var(--gutter); background: #fff; border-bottom: 1px solid var(--line); }
.crumbs { min-width: 0; color: var(--muted); font-size: 14px; }
.crumbs a { font-weight: 600; }
.userbox { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 13px; }
.userbox b { color: var(--ink); }
.roles { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.actor { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.actor input { width: 90px; }
.view { width: 100%; max-width: 1600px; margin-inline: auto; padding: clamp(20px, 2.2vw, 36px) var(--gutter) 48px; }
h1, h2, h3 { color: var(--ink); text-wrap: pretty; }
h1 { margin: 0 0 18px; font-size: clamp(25px, 2.3vw, 35px); line-height: 1.25; font-weight: 720; letter-spacing: -.035em; }
h2 { margin: 0 0 14px; font-size: 19px; line-height: 1.45; font-weight: 680; letter-spacing: -.02em; }
h3 { margin: 16px 0 9px; font-size: 16px; line-height: 1.5; font-weight: 660; }
.small { font-size: 13px; }
.muted, .empty { color: var(--muted); }
.empty { margin: 0; padding: 12px 0; }
.empty a { margin-left: 6px; }
.panel { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(16px, 1.55vw, 25px); margin: 0 0 18px; box-shadow: var(--shadow); }
.panel > :last-child { margin-bottom: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.row, .spread { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.spread { justify-content: space-between; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 128px), 1fr)); gap: 10px; margin: 10px 0; }
.stat { padding: 12px 14px; border-radius: 9px; border: 1px solid var(--line); background: #f5f9f8; }
.stat b { display: block; font-size: clamp(19px, 1.7vw, 25px); font-variant-numeric: tabular-nums; line-height: 1.4; }
.stat span { font-size: 13px; color: var(--muted); }
.view, .panel, td, .todo-card, .crumbs, .notice, .toast { overflow-wrap: anywhere; }
.table-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 11px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { background: #f1f6f5; color: #415b62; font-size: 13px; font-weight: 650; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:focus-within { background: #f2f8f6; }
@media (hover:hover) { tbody tr:hover { background: #f6faf9; } }
.tag { display: inline-block; padding: 2px 9px; background: #edf2f2; color: #495f66; border-radius: 999px; font-size: 12px; font-weight: 580; line-height: 1.55; white-space: nowrap; }
.tag.ok { color: var(--ok); background: var(--ok-soft); }
.tag.warn { color: var(--warn); background: var(--warn-soft); }
.tag.bad { color: var(--bad); background: var(--bad-soft); }
.tag.info { color: var(--brand); background: var(--brand-soft); }
.tag.external { color: #285574; background: #e4eef6; }
.tag.neutral { color: #44555c; background: #e9eeee; }
.btn { display: inline-block; padding: 7px 14px; min-height: 38px; line-height: 1.5; background: white; border: 1px solid #b8c9cb; border-radius: 7px; color: #28454d; font-size: 14px; font-weight: 570; text-align: center; cursor: pointer; }
.btn:hover { border-color: var(--brand); color: var(--brand-hover); background: #f3f9f7; text-decoration: none; }
.btn.primary { background: var(--brand); color: white; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: white; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .52; cursor: not-allowed; }
form.inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
form.stack { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); align-items: end; }
form.inline label, form.stack label { min-width: 0; display: flex; flex-direction: column; gap: 5px; color: #3e555e; font-size: 14px; }
form.stack .wide { grid-column: 1 / -1; }
input, select, textarea { min-width: 0; max-width: 100%; background: #fff; border: 1px solid #9fb3b6; border-radius: 7px; padding: 7px 10px; }
input:not([type=checkbox]):not([type=radio]), select { min-height: 38px; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
textarea { min-height: 70px; resize: vertical; }
.tabs { display: flex; gap: 3px; overflow-x: auto; border-bottom: 1px solid #bececf; margin: 12px 0 16px; }
.tabs a { padding: 9px 12px; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.on { border-bottom-color: var(--brand); color: var(--brand); font-weight: 660; text-decoration: none; }
.pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 135px), 1fr)); gap: 10px; }
.stage, .cand { padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.stage b { display: block; font-size: 14px; }
.stage.s-完成, .cand.chosen { border-color: #add5c0; background: var(--ok-soft); }
.stage.s-进行中 { border-color: #e1be85; background: var(--warn-soft); }
.notice { margin-bottom: 12px; border-radius: 8px; border-inline-start: 3px solid #c88b32; padding: 9px 13px; color: var(--warn); background: var(--warn-soft); font-size: 14px; }
.notice.info { border-color: #4e9d91; color: var(--brand); background: var(--brand-soft); }
.notice.bad { border-color: var(--bad); color: var(--bad); background: var(--bad-soft); }
.toast { position: fixed; z-index: 10; right: 20px; bottom: 20px; max-width: 420px; padding: 12px 16px; border-radius: 10px; background: #193239; color: #fff; box-shadow: 0 6px 24px rgb(0 0 0 / 18%); }
.toast.bad { background: #8b302f; }
.toast-next { display: block; margin-top: 4px; font-size: 14px; }
[aria-invalid=true] { border-color: var(--bad) !important; box-shadow: 0 0 0 2px var(--bad-soft); }
[data-field-error] { margin: 0 0 8px; flex-basis: 100%; }
.denied, .checks .no { color: var(--bad); }
.unauth { color: var(--warn); }
.checks .yes { color: var(--ok); }
details > summary { color: var(--brand); cursor: pointer; }
details[open] > summary { margin-bottom: 8px; }
.review { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.pageimg { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
pre.pagetext { white-space: pre-wrap; background: #f1f5f4; border-radius: 7px; padding: 12px; max-height: 420px; overflow: auto; font-size: 13px; }
.cand { margin: 6px 0; }
mark { background: #ffda80; color: #382800; }
.checks li { margin: 2px 0; }
.page-title { margin-bottom: 16px; }

.todo-home h2 { margin: 0; }
.todo-home .spread { margin-bottom: 14px; }
.todo-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.todo-card { display: flex; flex-direction: column; gap: 7px; padding: 14px; border: 1px solid var(--line); border-top: 3px solid #4e9d91; border-radius: 9px; background: white; }
.todo-card h3, .todo-order { margin: 0; }
.todo-order { color: var(--brand); font-weight: 620; }
.todo-meta { display: grid; grid-template-columns: max-content 1fr; gap: 3px 10px; margin: 0; font-size: 14px; }
.todo-meta dt { color: var(--muted); }
.todo-meta dd { min-width: 0; margin: 0; }
.todo-card .btn.primary { align-self: flex-start; margin-top: auto; }
.locate form.inline { align-items: flex-end; }
.locate form.inline label, .filter-row input { flex: 1 1 255px; }
.locate-hits { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.locate-hits:empty { display: none; }
.filter-row { margin-bottom: 10px; }
.login { max-width: 440px; margin: clamp(24px, 5vh, 66px) auto 16px; }
.login form.stack { grid-template-columns: minmax(0, 1fr); }
.login input { width: 100%; }
.shell:has(#nav:empty) { flex-direction: column; }
.shell:has(#nav:empty) .side { position: static; width: 100%; height: auto; flex: none; }
.shell:has(#nav:empty) .side-head { padding: 14px var(--gutter); }
.shell:has(#nav:empty) .brand-mark { width: 37px; height: 37px; font-size: 30px; }
.shell:has(#nav:empty) #nav, .side:has(#nav:empty) .menu-toggle { display: none; }

@media (min-width: 761px) and (max-width: 1100px) {
  .side { flex-basis: 204px; }
  .side-head { padding-inline: 16px; }
}
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .side { position: static; height: auto; width: 100%; flex: none; }
  .side-head { padding: 10px var(--gutter); }
  .brand-mark { width: 34px; height: 34px; font-size: 28px; border-radius: 9px; }
  .brand { gap: 9px; }
  .brand-name { font-size: 20px; }
  .brand-product { margin-top: 2px; }
  .menu-ready .menu-toggle { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 6px 11px; border: 1px solid #71898e; border-radius: 7px; background: transparent; color: #fff; font-size: 14px; cursor: pointer; }
  .menu-icon { width: 15px; height: 12px; position: relative; border-block: 2px solid currentColor; }
  .menu-icon::after { content: ""; position: absolute; inset: 3px 0 auto; border-top: 2px solid currentColor; }
  .menu-toggle[aria-expanded=true] { background: var(--side-active); }
  .menu-ready:not(.menu-open) #nav { display: none; }
  #nav { max-height: 65vh; max-height: 65dvh; padding: 14px var(--gutter) 18px; gap: 12px; }
  .nav-group { display: grid; gap: 2px; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .nav-label { grid-column: 1 / -1; padding-inline: 8px; }
  #nav a { display: flex; align-items: center; min-height: 44px; padding: 6px 9px; }
  .top { min-height: 48px; }
  .review { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  :root { --gutter: 14px; --radius: 11px; }
  body { font-size: 15px; }
  .view { padding-top: 16px; }
  .panel { padding: 14px; margin-bottom: 12px; }
  .top { gap: 6px 12px; padding-block: 8px; }
  form.inline, form.stack { display: grid; grid-template-columns: minmax(0, 1fr); align-items: stretch; gap: 10px; }
  form.inline label, form.stack label, form.inline > div, form.stack > div { width: 100%; flex: none; }
  .locate form.inline label, .filter-row input { flex: 0 1 auto; }
  input:not([type=checkbox]):not([type=radio]), select, textarea { width: 100%; min-height: 44px; font-size: 16px; }
  .btn { min-height: 44px; }
  form .btn.primary, .todo-card .btn.primary { width: 100%; }
  .toast { left: var(--gutter); right: var(--gutter); bottom: 12px; max-width: none; }
  .tag { white-space: normal; }
}
@media (max-width: 480px) {
  .mobile-cards .table-wrap { overflow: visible; }
  .mobile-cards table, .mobile-cards tbody, .mobile-cards tr, .mobile-cards td { display: block; width: 100%; }
  .mobile-cards thead { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  .mobile-cards tr { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; padding: 8px 10px; }
  .mobile-cards td { padding: 3px 0; border: 0; white-space: normal; }
  .mobile-cards td[data-label]::before { content: attr(data-label) "："; font-size: 13px; font-weight: 640; color: var(--muted); }
}
@media (max-width: 400px) {
  form.inline, form.stack { display: flex; flex-direction: column; }
  .locate form.inline label { flex: 0 0 auto; }
  input, select, textarea { width: 100%; }
  input[type=checkbox], input[type=radio] { width: auto; }
  .grid, .todo-cards { grid-template-columns: 1fr; }
}
@media print {
  .skip-link, .side, .menu-toggle, .userbox, .toast { display: none !important; }
  body, .shell, .main, .view { display: block; background: #fff; margin: 0; padding: 0; max-width: none; }
  .top, .panel { box-shadow: none; }
  .table-wrap { overflow: visible; }
}
