/* Winnie 工作台 · 扁平化主题。只管外观：颜色、字、间距、动效。权限与结构在模板和服务端。 */
:root { color-scheme: light dark;
  --paper: #f2f0ea; --surface: #ffffff; --ink: #0f1115; --muted: #5d626c; --line: #e2dfd6;
  --action: #ff5b2e; --action-ink: #0f1115; --link: #2d5bff; --tint: #ecebe4;
  --ok: #0b6b47; --ok-bg: #dff5ea; --warn: #8a5200; --warn-bg: #ffefc9; --danger: #b42a2a; --danger-bg: #fde3e1;
  --head: #0f1115; --head-ink: #ffffff; --block-a: #ff5b2e; --block-b: #2d5bff; --block-c: #12a26b; --block-d: #ffc42e;
  --r: .9rem; --r-sm: .55rem;
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--ink); background: var(--paper); -webkit-text-size-adjust: 100%; }
@media (prefers-color-scheme: dark) {
  :root { --paper: #0d0e11; --surface: #17191e; --ink: #f3f2ee; --muted: #a2a6af; --line: #2a2d35;
    --tint: #1f2228; --link: #8aa4ff; --ok: #4fd3a0; --ok-bg: #12382b; --warn: #ffc866; --warn-bg: #3a2c0c;
    --danger: #ff8a85; --danger-bg: #3d1716; --head: #000000; }
}
body { line-height: 1.6; font-size: 1rem; }
::selection { background: var(--block-d); color: #0f1115; }

/* 顶栏：一整块纯色 */
header { background: var(--head); color: var(--head-ink); position: sticky; top: 0; z-index: 4; }
.bar { min-height: 3.9rem; gap: 1rem; }
.brand { white-space: nowrap; flex: none; gap: .65rem; font-size: 1.05rem; letter-spacing: .01em; color: var(--head-ink); text-decoration: none; font-weight: 800; }
.mark { width: 1.25rem; height: 1.25rem; border-radius: .3rem; background: var(--action); transition: transform .35s cubic-bezier(.2,.9,.2,1.2), border-radius .35s; }
.brand:hover .mark { transform: rotate(45deg); border-radius: 50%; }
nav { gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
header nav a { color: var(--head-ink); text-decoration: none; padding: .45rem .8rem; border-radius: 999px; font-weight: 600; font-size: .93rem; transition: background .18s, color .18s; }
header nav a:hover { background: #ffffff1f; }
header nav form { margin: 0; }
header button.quiet { color: var(--head-ink); border-color: #ffffff40; min-height: 2.3rem; padding: .35rem .9rem; }
header button.quiet:hover { background: #ffffff1f; border-color: #ffffff40; color: var(--head-ink); }

a { color: var(--link); text-underline-offset: .22em; text-decoration-thickness: .09em; }
:focus-visible, a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .scroll-table:focus-visible {
  outline: 3px solid var(--block-d); outline-offset: 2px; }

main { padding-block: clamp(1.4rem, 5vh, 3.5rem) 4rem; }
h1 { font-size: clamp(1.8rem, 5vw, 3rem); line-height: 1.12; letter-spacing: -.04em; font-weight: 800; margin: .2rem 0 1.3rem; }
h2 { font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; margin: 1.6rem 0 .7rem; }
h3 { font-size: 1rem; font-weight: 700; margin: 1.1rem 0 .5rem; }
.intro, .muted, .person { color: var(--muted); }
.person { font-weight: 600; margin: 0; }
.intro { margin-bottom: 1.8rem; font-size: 1.05rem; }
.muted { font-size: .875rem; margin: 1rem 0 0; }

/* 面板与卡片：纯色块，无阴影 */
.sheet { background: var(--surface); border-radius: calc(var(--r) * 1.4); padding: clamp(1.5rem, 5vw, 3rem); border: 1px solid var(--line); }
.login-sheet { margin-top: clamp(1rem, 8vh, 5rem); position: relative; overflow: hidden; }
.login-sheet::before { content: ""; position: absolute; left: 0; top: 0; width: 5.5rem; height: .5rem; background: var(--action); border-radius: 0 0 .5rem 0; }

button, .destination { font: inherit; }
button { cursor: pointer; color: var(--action-ink); background: var(--action); border: 2px solid var(--action);
  padding: .6rem 1.25rem; border-radius: 999px; min-height: 2.75rem; font-weight: 700;
  transition: transform .12s ease, background .18s, color .18s, border-color .18s; }
button:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
button:active { transform: scale(.97); }
button.quiet { background: transparent; border-color: var(--line); color: var(--ink); }
button.quiet:hover { background: var(--tint); border-color: var(--tint); color: var(--ink); }
button.danger, .danger > button { background: #b42a2a; border-color: #b42a2a; color: #fff; }
button[disabled] { opacity: .5; cursor: not-allowed; }
form + form { margin-top: .75rem; }

.notice, .code { background: var(--tint); padding: .9rem 1.1rem; border-radius: var(--r-sm); }
.code { background: var(--ink); color: var(--paper); border-radius: var(--r); padding: 1.2rem 1.4rem; margin-bottom: 1.2rem; }
.code p { margin: 0; font-size: .82rem; opacity: .7; }
.code output { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: clamp(1.9rem, 8vw, 3rem); letter-spacing: .14em; font-weight: 700; }

.destination { padding: 1.3rem 1.5rem; gap: 2rem; max-width: 34rem; font-weight: 700; font-size: 1.08rem;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; margin-bottom: .8rem;
  transition: transform .2s cubic-bezier(.2,.8,.2,1), background .2s, color .2s, border-color .2s; }
.destination:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); transform: translateX(6px); }
.arrow { color: var(--action); font-size: 1.3rem; transition: transform .2s; }
.destination:hover .arrow { transform: translate(3px, -3px); }

/* 表格 */
.scroll-table, .report-frame { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.scroll-table { margin-block: 1rem; }
th, td { text-align: left; padding: .85rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--tint); color: var(--muted); font-size: .8rem; font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
thead th:first-child { border-top-left-radius: var(--r); } thead th:last-child { border-top-right-radius: var(--r); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s; } tbody tr:hover { background: var(--tint); }
.back { display: inline-block; margin-block: .75rem; font-weight: 600; text-decoration: none; }
.back:hover { text-decoration: underline; }
.report-frame { margin-top: 1.2rem; }
.skip { z-index: 5; background: var(--block-d); color: #0f1115; padding: .5rem .8rem; border-radius: 0 0 .5rem 0; font-weight: 700; }

/* 岗位工作台 */
.rw-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: .3rem; }
.rw-subnav { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.6rem; }
.rw-subnav a { text-decoration: none; padding: .5rem 1rem; border-radius: 999px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); font-weight: 700; font-size: .92rem; transition: background .18s, color .18s, border-color .18s, transform .18s; }
.rw-subnav a:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); transform: translateY(-2px); }
.rw-pill { display: inline-flex; align-items: center; padding: .22rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--ok-bg); color: var(--ok); }
.rw-pill-warn { background: var(--warn-bg); color: var(--warn); }
.rw-pill-danger { background: var(--danger-bg); color: var(--danger); }
.rw-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 1rem; margin-block: 1rem; }
.rw-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.3rem 1.35rem; position: relative; overflow: hidden;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), border-color .2s; }
.rw-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: .35rem; background: var(--block-b); }
.rw-grid > .rw-card:nth-child(4n+1)::before { background: var(--block-a); }
.rw-grid > .rw-card:nth-child(4n+3)::before { background: var(--block-c); }
.rw-grid > .rw-card:nth-child(4n+4)::before { background: var(--block-d); }
.rw-card:hover { transform: translateY(-3px); border-color: var(--ink); }
.rw-card h2 { font-size: 1.12rem; margin: 0 0 .7rem; }
.rw-kpis { display: flex; flex-wrap: wrap; gap: .7rem; margin-block: .7rem; }
.rw-kpi { flex: 1 1 6.5rem; background: var(--tint); padding: .8rem .95rem; border-radius: var(--r-sm); font-size: .82rem; color: var(--muted); font-weight: 600; }
.rw-kpi strong { display: block; font-size: 1.7rem; line-height: 1.15; color: var(--ink); font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.rw-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: .75rem; align-items: end; margin-block: .75rem; }
.rw-field { display: flex; flex-direction: column; gap: .3rem; font-size: .86rem; font-weight: 600; color: var(--muted); }
.rw-field input, .rw-field select, .rw-field textarea {
  font: inherit; font-weight: 400; padding: .6rem .8rem; border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); width: 100%;
  transition: border-color .15s, background .15s; }
.rw-field input:hover, .rw-field select:hover, .rw-field textarea:hover { border-color: var(--muted); }
.rw-field input:focus, .rw-field select:focus, .rw-field textarea:focus { border-color: var(--ink); outline: none; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--action); }
.rw-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .85rem; align-items: center; }
.rw-actions a { font-weight: 700; text-decoration: none; }
.rw-actions a:hover { text-decoration: underline; }
.rw-list { list-style: none; padding: 0; margin: .5rem 0 0; }
.rw-list li { padding: .6rem 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; font-size: .93rem; }
.rw-list li:last-child { border-bottom: 0; }
.rw-list li > span:last-child { color: var(--muted); }

/* 进场动效：纯样式，不依赖脚本。只做位移不做透明度，动画被浏览器暂停时内容也始终可见。 */
@keyframes rise { from { transform: translateY(18px); } }
@keyframes drop { from { transform: translateY(-12px); } }
@keyframes slide { from { transform: translateX(-10px); } }
@keyframes spread { from { letter-spacing: .5em; } }
header .bar > * { animation: drop .45s cubic-bezier(.2,.8,.2,1) backwards; }
header .bar > :nth-child(2) { animation-delay: .06s; }
main > *, main .dashboard > *, main .rw-grid > .rw-card { animation: rise .55s cubic-bezier(.2,.8,.2,1) backwards; }
main > :nth-child(2), main .dashboard > :nth-child(2), main .rw-grid > :nth-child(2) { animation-delay: .05s; }
main > :nth-child(3), main .dashboard > :nth-child(3), main .rw-grid > :nth-child(3) { animation-delay: .1s; }
main > :nth-child(4), main .dashboard > :nth-child(4), main .rw-grid > :nth-child(4) { animation-delay: .15s; }
main > :nth-child(5), main .dashboard > :nth-child(5), main .rw-grid > :nth-child(5) { animation-delay: .2s; }
main > :nth-child(n+6), main .dashboard > :nth-child(n+6), main .rw-grid > :nth-child(n+6) { animation-delay: .25s; }
main tbody tr { animation: slide .35s ease-out backwards; }
main tbody tr:nth-child(2) { animation-delay: .03s; } main tbody tr:nth-child(3) { animation-delay: .06s; }
main tbody tr:nth-child(4) { animation-delay: .09s; } main tbody tr:nth-child(5) { animation-delay: .12s; }
main tbody tr:nth-child(n+6) { animation-delay: .15s; }
.code output { display: inline-block; animation: spread .7s cubic-bezier(.2,.8,.2,1) backwards; }

/* 登录页与首页的背景：两层缓慢漂浮的纯色几何块，纯装饰。不支持 :has() 的浏览器不显示，页面照常可用。 */
main, footer { position: relative; z-index: 1; }
@keyframes drift-a { to { transform: translate3d(1.2%, -1.6%, 0) rotate(1.5deg); } }
@keyframes drift-b { to { transform: translate3d(-1.4%, 1.2%, 0) rotate(-2deg); } }
body:has([data-testid="p1-login-panel"], [data-testid="p3-home-region"], [data-testid="rw-home-region"])::before,
body:has([data-testid="p1-login-panel"], [data-testid="p3-home-region"], [data-testid="rw-home-region"])::after {
  content: ""; position: fixed; inset: -4%; z-index: 0; pointer-events: none; background-repeat: no-repeat; }
body:has([data-testid="p1-login-panel"], [data-testid="p3-home-region"], [data-testid="rw-home-region"])::before {
  background-image:
    radial-gradient(circle, var(--block-a) 0 69%, transparent 70%),
    radial-gradient(circle, transparent 0 43%, var(--block-b) 44% 69%, transparent 70%),
    linear-gradient(var(--block-d), var(--block-d)),
    radial-gradient(circle, var(--block-c) 0 69%, transparent 70%);
  background-size: 9rem 9rem, 7rem 7rem, 6rem 1.8rem, 4rem 4rem;
  background-position: 0% 10%, 99% 8%, 0% 58%, 99% 46%;
  animation: drift-a 14s ease-in-out infinite alternate; }
body:has([data-testid="p1-login-panel"], [data-testid="p3-home-region"], [data-testid="rw-home-region"])::after {
  background-image:
    linear-gradient(var(--block-b), var(--block-b)),
    conic-gradient(from 150deg at 50% 0, var(--block-c) 0 60deg, transparent 60deg),
    radial-gradient(circle, transparent 0 43%, var(--block-a) 44% 69%, transparent 70%),
    linear-gradient(var(--ink), var(--ink));
  background-size: 8rem 8rem, 10rem 9rem, 6rem 6rem, 3.2rem 3.2rem;
  background-position: 90% 88%, 12% 92%, 60% 97%, 30% 4%;
  opacity: .9; animation: drift-b 19s ease-in-out infinite alternate; }
@media (prefers-color-scheme: dark) {
  body:has([data-testid="p1-login-panel"], [data-testid="p3-home-region"], [data-testid="rw-home-region"])::before,
  body:has([data-testid="p1-login-panel"], [data-testid="p3-home-region"], [data-testid="rw-home-region"])::after { opacity: .4; }
}
@media (max-width: 60rem) {
  body:has([data-testid="p1-login-panel"], [data-testid="p3-home-region"], [data-testid="rw-home-region"])::before,
  body:has([data-testid="p1-login-panel"], [data-testid="p3-home-region"], [data-testid="rw-home-region"])::after { opacity: .18; }
}

/* “样本不足”标签原配色对比度不够，加深文字 */
:root .psb-light-insufficient { color: #475569; }

/* 深色模式下，各页面专用样式里写死的浅色底改用主题色（带色的状态标签保持原样，深浅底上都可读） */
@media (prefers-color-scheme: dark) {
  :root .psb-stat, :root .psb-warning-note, :root .psb-table th, :root .psb-cat-tag { background: var(--tint); color: var(--ink); }
  :root .psb-warning-note { border-left-color: var(--muted); }
  :root .psb-table th, :root .psb-table td { border-bottom-color: var(--line); }
  :root .psb-stat-val, :root .psb-year-group summary, :root .segment-final { color: var(--ink); }
  :root .psb-stat-label, :root .psb-muted, :root .psb-date, :root .segment-partial { color: var(--muted); }
  :root .psb-proj-link, :root .psb-progress-text { color: var(--link); }
  :root .psb-tab { color: var(--ink); border-color: var(--line); }
  :root .psb-tab-active { background: var(--link); border-color: var(--link); color: #0f1115; }
}

@media (max-width: 44rem) {
  th, td { padding: .65rem .75rem; font-size: .9rem; }
  .rw-card { padding: 1.05rem 1.05rem 1.05rem 1.25rem; }
  /* 窄屏：卡片里的宽表格自己横向滚动，不被卡片圆角裁掉 */
  :root .rw-card table { display: block; max-width: 100%; overflow-x: auto; white-space: nowrap; }
  .bar { min-height: 3.4rem; }
  header nav a { padding: .35rem .6rem; font-size: .86rem; }
  header nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
  header nav a, header nav button { white-space: nowrap; }
  .rw-subnav { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .4rem; scrollbar-width: none; }
  .rw-subnav a { white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
