:root {
  --canvas: #f3f0e9;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #202824;
  --muted: #68726c;
  --line: #d8d9d2;
  --green: #1d6b4d;
  --green-dark: #163c2d;
  --green-soft: #dcebe2;
  --amber: #a85e08;
  --amber-soft: #fff0d5;
  --red: #a23b32;
  --red-soft: #f9e1de;
  --radius-sm: .35rem;
  --radius: .65rem;
  --radius-lg: 1rem;
  --shadow: 0 12px 34px rgba(28, 42, 35, .08);
  --z-base: 0;
  --z-sticky: 20;
  --z-banner: 40;
  --fast: 160ms;
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif; line-height: 1.6; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--green); }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.18; text-wrap: balance; }
p, li { text-wrap: pretty; }
h1 { font-size: clamp(2rem, 5vw, 3.7rem); }
h2 { font-size: clamp(1.25rem, 2vw, 1.65rem); }
:focus-visible { outline: 3px solid #e2a43a; outline-offset: 3px; }
.skip-link { position: fixed; z-index: var(--z-banner); left: 1rem; top: -5rem; padding: .7rem 1rem; background: var(--ink); color: white; }
.skip-link:focus { top: 1rem; }
.demo-banner { position: relative; z-index: var(--z-banner); padding: .4rem 1rem; background: var(--amber-soft); border-bottom: 1px solid #e5c58e; color: #71420e; text-align: center; font-size: .78rem; font-weight: 700; }
.site-header { min-height: 4.5rem; padding: .8rem clamp(1rem, 4vw, 3.5rem); background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; background: var(--green-dark); color: white; font-weight: 900; border-radius: var(--radius-sm); }
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); font-size: .55rem; }
.header-actions { display: flex; align-items: center; gap: 1rem; }
.identity { color: var(--muted); font-size: .85rem; }
.admin-nav { padding: 0 clamp(1rem, 4vw, 3.5rem); background: var(--green-dark); display: flex; gap: .2rem; }
.admin-nav a { padding: .7rem 1rem; color: #e6f2eb; text-decoration: none; font-weight: 700; font-size: .88rem; border-bottom: 3px solid transparent; }
.admin-nav a:hover { border-color: #74b595; }
.page-shell, .employee-shell { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(2rem, 5vw, 4.5rem) 0; min-height: 70vh; }
.employee-shell { width: min(780px, calc(100% - 2rem)); }
.site-footer { padding: 2rem 1rem; color: var(--muted); text-align: center; font-size: .78rem; }
.eyebrow { margin-bottom: .55rem; color: var(--green); font-size: .72rem; font-weight: 900; text-transform: uppercase; }
.muted { color: var(--muted); }
.button { display: inline-flex; min-height: 2.65rem; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .65rem 1rem; background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; font-weight: 800; transition: transform var(--fast) ease-out, opacity var(--fast) ease-out; }
.button:hover { transform: translateY(-1px); }
.button-primary { border-color: var(--green); background: var(--green); color: white; }
.button-quiet { min-height: 2.2rem; padding: .4rem .75rem; }
.button-wide { width: 100%; }
.button-small { min-height: 2.1rem; padding: .35rem .65rem; font-size: .8rem; }
.button-danger { border-color: #d7aaa5; color: var(--red); }
.panel, .login-card, .success-card, .report-form fieldset { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.flash-stack { position: fixed; z-index: var(--z-sticky); right: 1rem; top: 7rem; }
.flash { padding: .75rem 1rem; border-radius: var(--radius); background: var(--green-dark); color: white; box-shadow: var(--shadow); }
.form-error { margin: 0 0 1rem; padding: .85rem 1rem; background: var(--red-soft); border: 1px solid #e4ada7; border-radius: var(--radius); color: #762921; }
.form-error p:last-child, .form-error ul:last-child { margin-bottom: 0; }
.stack-form, .config-form { display: grid; gap: 1rem; }
label { display: grid; gap: .4rem; font-weight: 800; font-size: .9rem; }
label small { color: var(--muted); font-weight: 500; }
input, select, textarea { width: 100%; border: 1px solid #bfc5c0; border-radius: var(--radius-sm); padding: .7rem .8rem; background: white; color: var(--ink); }
textarea { resize: vertical; }

.login-page { background: var(--green-dark); }
.login-page .site-header, .login-page .site-footer { display: none; }
.login-page .page-shell { width: 100%; padding: 0; }
.login-layout { min-height: calc(100dvh - 2rem); display: grid; grid-template-columns: 1.15fr .85fr; }
.login-intro { padding: clamp(3rem, 8vw, 8rem); display: flex; flex-direction: column; justify-content: center; color: #edf5f0; border-right: 1px solid #315443; }
.login-intro h1 { max-width: 720px; margin-bottom: 1.5rem; font-weight: 900; }
.login-intro > p:not(.eyebrow) { max-width: 570px; color: #b9cbc1; }
.login-card { align-self: center; justify-self: center; width: min(450px, calc(100% - 2rem)); padding: clamp(1.5rem, 4vw, 2.7rem); box-shadow: 0 20px 60px rgba(0,0,0,.23); }
.login-card h2 { margin-bottom: .5rem; }
.demo-accounts { margin-top: 1.5rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.demo-accounts > p { margin-bottom: .55rem; color: var(--muted); font-size: .78rem; }
.demo-accounts button { width: 100%; margin-top: .45rem; padding: .7rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #f7f6f1; display: flex; justify-content: space-between; cursor: pointer; }
.demo-accounts button span { color: var(--muted); }

.stage-rail { list-style: none; margin: 2rem 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); position: relative; }
.stage-rail::before { content: ""; position: absolute; z-index: var(--z-base); left: 8%; right: 8%; top: 1.1rem; border-top: 2px solid var(--line); }
.stage-rail li { position: relative; z-index: 1; display: grid; justify-items: center; gap: .4rem; color: var(--muted); font-size: .78rem; text-align: center; }
.stage-rail li > span { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border: 2px solid var(--line); border-radius: 50%; background: var(--surface); font-size: .65rem; font-weight: 900; }
.stage-rail li.active > span { border-color: var(--green); background: var(--green); color: white; }
.stage-rail-light::before { border-color: #4d705f; }
.stage-rail-light li { color: #c5d6cd; }
.stage-rail-light li > span { background: var(--green-dark); border-color: #6f8f7e; color: white; }

.form-hero { padding: 1rem 0 1.5rem; }
.form-hero h1 { margin-bottom: .7rem; }
.form-hero p:last-child { color: var(--muted); }
.report-form { display: grid; gap: 1rem; }
.report-form fieldset { margin: 0; padding: clamp(1rem, 4vw, 2rem); }
.report-form legend { padding: 0 .4rem; font-size: 1.05rem; font-weight: 900; }
.report-form legend span { color: var(--green); margin-right: .5rem; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.report-form fieldset > label { margin-top: 1rem; }
.upload-placeholder { margin-top: 1rem; padding: 1rem; border: 1px dashed #9eb5a8; border-radius: var(--radius); background: var(--green-soft); display: grid; }
.upload-placeholder span { color: var(--muted); font-size: .82rem; }

.success-card { max-width: 760px; margin: 2rem auto; padding: clamp(2rem, 6vw, 4rem); text-align: center; }
.success-icon { display: grid; place-items: center; width: 4.5rem; height: 4.5rem; margin: 0 auto 1.5rem; border-radius: 50%; background: var(--green); color: white; font-size: 2rem; }
.reference { width: min(330px, 100%); margin: 1.5rem auto; padding: 1rem; background: #f3f5f0; border: 1px solid var(--line); border-radius: var(--radius); display: grid; }
.reference span { color: var(--muted); font-size: .75rem; }
.reference strong { font-size: 1.55rem; font-variant-numeric: tabular-nums; }

.dashboard-head, .detail-head, .section-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; }
.dashboard-head { margin-bottom: 2rem; }
.dashboard-head h1 { margin-bottom: .5rem; }
.dashboard-head p:last-child { margin-bottom: 0; color: var(--muted); }
.live-chip, .status { display: inline-flex; white-space: nowrap; border-radius: 999px; padding: .3rem .65rem; background: var(--green-soft); color: var(--green-dark); font-size: .72rem; font-weight: 900; }
.metric-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .8rem; margin-bottom: 1rem; }
.metric-grid article { padding: 1.15rem; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--green); border-radius: var(--radius); }
.metric-grid span, .metric-grid small { display: block; color: var(--muted); font-size: .75rem; }
.metric-grid strong { display: block; margin: .25rem 0; font-size: clamp(1.8rem, 3vw, 2.5rem); font-variant-numeric: tabular-nums; }
.metric-grid .metric-alert { border-top-color: var(--red); }
.metric-grid .metric-alert strong { color: var(--red); }
.progress-panel, .table-panel, .bar-panel { padding: clamp(1rem, 3vw, 1.5rem); margin-top: 1rem; }
.section-head h2 { margin-bottom: 0; }
.section-head > span { color: var(--muted); font-size: .8rem; }
.stage-rail-dashboard li { grid-template-columns: auto; }
.stage-rail-dashboard li strong { font-size: .82rem; }
.stage-rail-dashboard li em { color: var(--ink); font-size: 1.5rem; font-style: normal; font-weight: 900; font-variant-numeric: tabular-nums; }
.distribution-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.bar-panel h2 { font-size: 1rem; }
.bar-row { margin-top: .75rem; }
.bar-row > div { display: flex; justify-content: space-between; font-size: .75rem; }
.bar-row strong { font-variant-numeric: tabular-nums; }
meter { width: 100%; height: .55rem; border: 0; background: #e8e9e3; }
meter::-webkit-meter-bar { background: #e8e9e3; border: 0; }
meter::-webkit-meter-optimum-value { background: var(--green); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th, td { padding: .8rem .65rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .7rem; }
.description-cell { min-width: 260px; max-width: 420px; }
.status-under_review { background: #e4ecef; color: #365c68; }
.status-rectifying { background: var(--amber-soft); color: var(--amber); }
.status-closed { background: var(--green-soft); color: var(--green); }
.back-link { display: inline-block; margin-bottom: 1rem; text-decoration: none; font-weight: 800; }
.detail-head { margin-bottom: 1.5rem; }
.detail-head h1 { margin-bottom: .4rem; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr); gap: 1rem; }
.report-copy, .action-panel, .timeline { padding: clamp(1rem, 3vw, 1.5rem); }
.report-copy dl { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; margin-top: 1.5rem; }
.report-copy dl div { padding: .7rem; background: #f5f4ef; border-radius: var(--radius-sm); }
dt { color: var(--muted); font-size: .72rem; }
dd { margin: .2rem 0 0; font-weight: 800; }
.timeline { margin-top: 1rem; }
.timeline article { position: relative; display: grid; grid-template-columns: 1rem 1fr; gap: .7rem; padding-bottom: 1rem; }
.timeline article > span { width: .7rem; height: .7rem; margin-top: .4rem; border-radius: 50%; background: var(--green); }
.timeline time { float: right; color: var(--muted); font-size: .75rem; font-variant-numeric: tabular-nums; }
.timeline p { margin: .2rem 0 0; color: var(--muted); font-size: .85rem; }
.search-form { display: flex; gap: .5rem; margin-bottom: 1rem; }
.search-form label { flex: 1; }
.employee-list article { padding: .8rem 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.employee-list article > div { display: grid; }
.employee-list span { color: var(--muted); font-size: .78rem; }
.employee-list details { margin-top: .35rem; }
.employee-list summary { color: var(--green); cursor: pointer; font-size: .76rem; font-weight: 800; }
.inline-edit { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: .5rem; align-items: end; margin-top: .6rem; padding: .7rem; background: #f5f4ef; border-radius: var(--radius-sm); }
.inline-edit label { font-size: .72rem; }
.inline-edit input, .inline-edit select { padding: .45rem; }
.config-form { padding: clamp(1rem, 4vw, 2rem); }
.config-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.check-label { display: flex; align-items: center; }
.check-label input { width: 1rem; height: 1rem; }
.empty-state { padding: 1rem; background: #f5f4ef; border-radius: var(--radius); color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-intro { padding: 3rem 1.5rem; }
  .login-card { margin: 2rem auto; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .distribution-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .config-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .demo-banner { font-size: .68rem; }
  .site-header { min-height: 3.8rem; }
  .identity { display: none; }
  .brand small { display: none; }
  .admin-nav { overflow-x: auto; }
  .page-shell, .employee-shell { width: min(100% - 1.25rem, 1180px); padding: 1.7rem 0; }
  .form-grid, .report-copy dl { grid-template-columns: 1fr; }
  .metric-grid { gap: .5rem; }
  .metric-grid article { padding: .8rem; }
  .metric-grid article:first-child { grid-column: span 2; }
  .dashboard-head, .detail-head { align-items: start; }
  .stage-rail-dashboard li strong { font-size: .68rem; }
  .mobile-submit { position: sticky; z-index: var(--z-sticky); bottom: 0; margin: 0 -.65rem -1rem; padding: .7rem .65rem calc(.7rem + env(safe-area-inset-bottom)); background: rgba(243,240,233,.96); }
  .inline-edit { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
