:root {
  --navy: #14253d;
  --navy-2: #1b3554;
  --blue: #276ef1;
  --cyan: #0fa3b1;
  --green: #15803d;
  --amber: #d97706;
  --red: #dc2626;
  --ink: #172033;
  --muted: #697586;
  --line: #dfe5ec;
  --surface: #ffffff;
  --bg: #eef2f6;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(31, 49, 73, .08);
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; color: var(--ink); background: var(--bg); font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif; font-size: 14px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 232px; color: #e7edf5; background: linear-gradient(180deg, var(--navy), #0d1a2b); display: flex; flex-direction: column; z-index: 30; }
.brand { min-height: 82px; padding: 18px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(255,255,255,.09); }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 9px; color: white; background: var(--blue); font: 800 21px/1 system-ui; }
.brand strong, .brand small { display: block; }
.brand small { margin-top: 3px; color: #9eb0c7; font-size: 12px; }
.nav-list { padding: 14px 10px; flex: 1; overflow-y: auto; }
.nav-item { display: block; padding: 10px 12px; border-radius: 7px; color: #dbe5f1; transition: background .15s ease; }
.nav-item:hover { background: rgba(255,255,255,.09); }
.nav-label { display: block; padding: 18px 12px 5px; color: #7890aa; font-size: 11px; letter-spacing: .1em; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.09); }
.sidebar-footer span, .sidebar-footer small { display: block; }
.sidebar-footer small { color: #9eb0c7; margin: 3px 0 8px; }
.sidebar-footer a { color: #aac6ff; }
.main-area { margin-left: 232px; min-height: 100vh; }
.mobile-header { display: none; }
.page-container { max-width: 1680px; margin: 0 auto; padding: 30px; }
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 20px; }
.page-header h1 { margin: 2px 0 5px; font-size: clamp(25px, 2.2vw, 36px); letter-spacing: -.03em; }
.eyebrow { margin: 0; color: var(--blue); font: 700 11px/1.2 system-ui; letter-spacing: .15em; }
.muted { color: var(--muted); }
.page-header p { margin-bottom: 0; }
.header-actions, .action-strip { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 16px; }
.section-heading h2 { margin: 3px 0 0; font-size: 20px; }
.section-heading p { margin-bottom: 0; }
.button { border: 1px solid transparent; border-radius: 7px; padding: 9px 15px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; min-height: 39px; }
.button-primary { color: white; background: var(--blue); border-color: var(--blue); }
.button-secondary { color: var(--navy); background: white; border-color: #bdc9d8; }
.button-ghost { color: var(--muted); background: transparent; }
.button-danger { color: white; background: var(--red); border-color: var(--red); }
.button-block { width: 100%; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.icon-button { border: 0; color: white; background: transparent; font-size: 22px; }
.messages { position: fixed; right: 24px; top: 18px; z-index: 80; width: min(390px, calc(100vw - 30px)); }
.offline-banner { position: fixed; left: 50%; bottom: 18px; z-index: 90; transform: translateX(-50%); padding: 10px 16px; color: #fff; background: #9a3412; border-radius: 8px; box-shadow: var(--shadow); }
.message { border-radius: 8px; padding: 12px 15px; margin-bottom: 8px; color: #16301d; background: #dcfce7; box-shadow: var(--shadow); border: 1px solid #86efac; }
.message.error { color: #6e1414; background: #fee2e2; border-color: #fca5a5; }
.message.warning { color: #713f12; background: #fef3c7; border-color: #fcd34d; }
.form-control { width: 100%; min-height: 40px; padding: 8px 10px; color: var(--ink); background: white; border: 1px solid #c9d2df; border-radius: 6px; outline: none; }
.form-control:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(39,110,241,.12); }
textarea.form-control { resize: vertical; }
label { display: grid; gap: 6px; color: #3e4c60; font-weight: 600; }
.field-error { color: var(--red); font-weight: 500; }
.block-error { display: block; }
.success-text { color: var(--green); font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: 1 / -1; }
.office-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.office-metrics > div { padding: 14px; background: #f6f8fb; border-radius: 8px; }
.office-metrics span, .office-metrics strong { display: block; }
.office-metrics strong { margin-top: 6px; font-size: 28px; }
.office-log-content { overflow-wrap: anywhere; line-height: 1.8; }
.office-history { padding: 14px 0; border-bottom: 1px solid var(--line); }
.office-history summary { cursor: pointer; font-weight: 700; }
@media (max-width: 600px) { .office-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stack-form { display: grid; gap: 15px; }
.form-actions { display: flex; gap: 10px; align-items: center; }
.inline-form { display: flex; align-items: end; gap: 14px; flex-wrap: wrap; }
.inline-form label { min-width: 190px; }
.narrow-panel { max-width: 820px; }
.filter-bar { display: flex; align-items: end; gap: 11px; flex-wrap: wrap; margin-bottom: 18px; padding: 15px; background: #dfe6ee; border-radius: 9px; }
.filter-bar label { min-width: 150px; font-size: 12px; }
.checkbox-label { display: flex; flex-direction: row; align-items: center; min-height: 40px; min-width: auto !important; }
.form-check-input { width: 17px; height: 17px; accent-color: var(--blue); }
.compact-filter { width: fit-content; background: transparent; padding: 0; }
.project-title { display: flex; justify-content: space-between; align-items: center; font-size: 18px; }
.project-meta { display: flex; gap: 18px; color: var(--muted); font-size: 13px; }
.project-meta .tonnage-warning { color: var(--red); font-weight: 700; }
.status-dot { display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 50%; background: var(--green); }
.status-dot.status-paused { background: var(--amber); }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.ring-card { display: flex; align-items: center; gap: 18px; }
.ring-card p { color: var(--muted); margin: 0 0 6px; }
.ring-card strong { font-size: 20px; }
.progress-ring { --value: 0; width: 92px; aspect-ratio: 1; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--blue) calc(min(var(--value), 100) * 1%), #e5eaf0 0); position: relative; }
.progress-ring::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: white; }
.progress-ring span { position: relative; font: 800 22px/1 system-ui; }
.progress-ring small { font-size: 11px; margin-left: 2px; }
.progress-ring.accent { background: conic-gradient(var(--cyan) calc(min(var(--value), 100) * 1%), #e5eaf0 0); }
.compact-kpi { display: grid; align-content: center; min-height: 134px; }
.compact-kpi span { color: var(--muted); }
.compact-kpi strong { margin-top: 8px; font: 800 34px/1 system-ui; color: var(--navy); }
.compact-kpi small { margin-top: 3px; color: var(--muted); }
.compact-kpi .date-value { font-size: 28px; }
.process-grid { display: grid; grid-template-columns: repeat(4, minmax(190px, 1fr)); gap: 13px; }
.process-card { border: 1px solid var(--line); border-left: 4px solid var(--blue); padding: 15px; border-radius: 8px; background: #fafbfd; }
.process-card.level-yellow { border-left-color: var(--amber); background: #fffbeb; }
.process-card.level-red { border-left-color: var(--red); background: #fff5f5; }
.process-head, .process-detail, .schedule-note { display: flex; justify-content: space-between; gap: 10px; }
.process-head span { font: 800 20px/1 system-ui; }
.progress-track { height: 8px; margin: 13px 0 9px; border-radius: 9px; overflow: hidden; background: #dfe5ec; }
.progress-track span { display: block; height: 100%; background: var(--blue); border-radius: inherit; }
.level-yellow .progress-track span { background: var(--amber); }
.level-red .progress-track span { background: var(--red); }
.process-detail, .schedule-note { color: var(--muted); font-size: 12px; }
.pending { color: var(--amber); }
.schedule-note { margin-top: 9px; }
.schedule-note b { display: inline-grid; width: 19px; height: 19px; place-items: center; color: white; background: var(--red); border-radius: 50%; }
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.data-table th { padding: 10px 12px; color: #5d6a7d; background: #f2f5f8; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12px; }
.data-table td { padding: 12px; border-bottom: 1px solid #e8edf2; vertical-align: middle; }
.data-table tbody tr:hover { background: #f8fafc; }
.performance-red { background: #feecec !important; }
.performance-yellow { background: #fffae8 !important; }
.money-cell { color: var(--blue); font-weight: 800; }
.status-pill { display: inline-flex; align-items: center; width: fit-content; padding: 4px 8px; border-radius: 99px; color: #506071; background: #e7ebf0; font-size: 12px; white-space: nowrap; }
.status-pill.green, .status-pill.approved, .status-pill.locked, .status-pill.add, .status-pill.resolved { color: #116532; background: #dcfce7; }
.status-pill.yellow, .status-pill.pending, .status-pill.review, .status-pill.open, .status-pill.update { color: #8a4b08; background: #fef3c7; }
.status-pill.red, .status-pill.returned, .status-pill.rejected, .status-pill.error { color: #a71d1d; background: #fee2e2; }
.table-pager { display: flex; justify-content: center; gap: 6px; margin-top: 14px; color: var(--muted); }
.pager-dot { width: 8px; height: 8px; border: 0; border-radius: 50%; padding: 0; background: #c6cfda; }
.pager-dot.active { background: var(--blue); }
.empty-state { padding: 22px; text-align: center; color: var(--muted); }
.card-list { display: grid; gap: 12px; }
.approval-card { display: flex; justify-content: space-between; align-items: center; color: inherit; }
.approval-card h3 { margin: 9px 0 5px; }
.approval-card p { margin: 0; color: var(--muted); }
.approval-number { display: grid; justify-items: end; }
.approval-number strong { font: 800 28px/1 system-ui; color: var(--blue); }
.approval-number small { margin-top: 5px; color: var(--muted); }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.detail-list { margin: 0; }
.detail-list div { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; }
.danger-zone { border-color: #fecaca; }
.danger-zone h2 { color: var(--red); }
.danger-zone form { display: grid; gap: 10px; }
.notice { margin-top: 16px; padding: 13px 15px; border-radius: 8px; border: 1px solid #bfdbfe; color: #1e4f85; background: #eff6ff; }
.notice.warning { color: #713f12; border-color: #fcd34d; background: #fffbeb; }
.chip-row { display: flex; gap: 7px; margin-bottom: 14px; flex-wrap: wrap; }
.chip-row .chip { color: #536274; background: #e2e8f0; }
.chip-row .chip.active { color: white; background: var(--blue); }
.action-strip { padding: 14px 18px; }
.text-link { color: var(--blue); font-weight: 700; }
.split-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.split-grid h3 { margin-top: 0; }
.stack-list { display: grid; gap: 9px; }
.list-card { display: flex; justify-content: space-between; gap: 16px; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfd; }
.list-card p { margin: 6px 0; color: #4d5b6c; }
.list-card small { color: var(--muted); }
.list-card-side { display: grid; justify-items: end; gap: 6px; }
.decision-buttons { display: flex; gap: 5px; }
.mini-button { border: 0; border-radius: 5px; padding: 4px 7px; color: white; }
.mini-button.success { background: var(--green); }
.mini-button.danger { background: var(--red); }
.mini-button.neutral { color: var(--navy); background: #dfe6ee; }
.row-actions { display: flex; gap: 6px; }
.tag-note { display: block; margin-top: 3px; color: var(--muted); }
.credential-card { max-width: 680px; }
.credential-card dl { display: grid; gap: 1px; background: var(--line); }
.credential-card dl div { display: grid; grid-template-columns: 150px 1fr; padding: 15px; background: white; }
.credential-card dt { color: var(--muted); }
.credential-card dd { margin: 0; font-weight: 700; }
.credential-password { color: var(--blue); font: 800 24px/1 system-ui; letter-spacing: .04em; }
.payroll-summary { display: grid; grid-template-columns: minmax(190px, .8fr) 2fr; gap: 28px; background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: white; }
.payroll-summary > div { display: grid; align-content: center; }
.payroll-summary > div span, .payroll-summary > div small { color: #b9c9dc; }
.payroll-summary > div strong { margin: 8px 0; font: 800 38px/1 system-ui; }
.payroll-summary dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 0; background: rgba(255,255,255,.14); }
.payroll-summary dl div { padding: 14px; background: var(--navy-2); }
.payroll-summary dt { color: #b9c9dc; font-size: 12px; }
.payroll-summary dd { margin: 6px 0 0; font-size: 18px; font-weight: 700; }
.payroll-summary dd small { display: block; margin-top: 3px; color: #b9c9dc; font-size: 11px; font-weight: 400; }
.upload-form { display: flex; justify-content: space-between; align-items: end; gap: 16px; }
.upload-form > div { display: grid; gap: 8px; flex: 1; }
.summary-chips { display: flex; gap: 7px; }
.chip { padding: 6px 9px; border-radius: 6px; background: #e7ebf0; }
.chip.add { color: var(--green); background: #dcfce7; }
.chip.update { color: var(--amber); background: #fef3c7; }
.chip.error { color: var(--red); background: #fee2e2; }
.confirm-import { margin-top: 18px; display: flex; align-items: center; gap: 12px; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 15%, #264d77, #101f33 60%); }
.login-card { width: min(420px, 100%); padding: 32px; background: white; border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.login-card h1 { margin: 18px 0 6px; }
.login-card > .muted { display: block; margin-bottom: 22px; }
.login-brand { display: flex; align-items: center; }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 15%, #264d77, #101f33 60%); }
.auth-page .app-shell { min-height: auto; width: 100%; }
.auth-page .sidebar, .auth-page .mobile-header { display: none; }
.auth-page .main-area { margin: 0; min-height: auto; }
.auth-page .page-container { padding: 0; }
.auth-card { width: min(420px, 100%); margin: auto; padding: 30px; background: white; border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.24); }
.auth-card h1 { margin: 18px 0 5px; }
.auth-card form p { display: grid; gap: 5px; }
.auth-card .button { width: 100%; margin-top: 8px; }
.auth-brand { display: flex; gap: 11px; align-items: center; }
.component-lookup { position: relative; }
.search-results { position: absolute; inset: 68px 0 auto; z-index: 20; display: grid; max-height: 280px; overflow-y: auto; background: white; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.search-results:empty { display: none; }
.search-results button { display: flex; justify-content: space-between; gap: 14px; padding: 11px 13px; text-align: left; color: var(--ink); background: white; border: 0; border-bottom: 1px solid var(--line); }
.search-results button:hover { background: #eff6ff; }
.search-results span { color: var(--muted); font-size: 12px; }
.participant-box { margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; }
.participant-box legend { padding: 0 6px; font-weight: 700; }
.participant-list { display: grid; gap: 8px; max-height: 340px; overflow-y: auto; margin-bottom: 8px; }
.participant-row { display: grid; grid-template-columns: 22px 1fr 120px; align-items: center; gap: 10px; padding: 7px 9px; background: #f6f8fb; border-radius: 6px; }
.participant-row.allocation-row { grid-template-columns: minmax(0, 1fr) 120px; }
.participant-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--blue); }
.scan-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); gap: 18px; align-items: start; }
.qr-reader { min-height: 320px; display: grid; place-items: center; margin: 16px 0; overflow: hidden; color: var(--muted); background: #0f172a; border-radius: 10px; }
.qr-reader video { object-fit: cover; }
.scan-panel > label { margin: 12px 0; }
.scan-result { display: grid; gap: 7px; max-height: 260px; overflow-y: auto; margin-top: 14px; }
.scan-message { padding: 9px 11px; border-radius: 6px; }
.scan-message.success { color: #116532; background: #dcfce7; }
.scan-message.error { color: #a71d1d; background: #fee2e2; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 12px 0; padding: 4px; background: #e2e8f0; border-radius: 8px; }
.segmented button { padding: 9px; border: 0; border-radius: 6px; background: transparent; }
.segmented button.active { color: white; background: var(--blue); }
.timeline { display: grid; }
.timeline article { display: grid; grid-template-columns: 145px 1fr; gap: 18px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.timeline time, .timeline p, .timeline small { color: var(--muted); }
.timeline p { margin: 5px 0; }
.timeline small { display: block; }
.kpi-danger strong { color: var(--red); }
.label-sheet { display: grid; justify-content: start; gap: 5mm; }
.label-sheet.a4 { grid-template-columns: repeat(2, var(--label-width)); }
.qr-label { width: var(--label-width); height: var(--label-height); display: grid; grid-template-columns: 43% 1fr; gap: 2mm; overflow: hidden; padding: 2mm; color: #000; background: #fff; border: .3mm solid #111; page-break-inside: avoid; break-inside: avoid; }
.qr-label img { width: 100%; aspect-ratio: 1; align-self: center; }
.qr-label > div { min-width: 0; display: grid; align-content: center; gap: .6mm; font-size: 7.5pt; line-height: 1.15; }
.qr-label strong { font-size: 12pt; }
.qr-label span, .qr-label b, .qr-label small { display: block; overflow-wrap: anywhere; }
.qr-label b { color: #111; }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .process-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 780px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .mobile-header { height: 56px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; color: white; background: var(--navy); }
  .page-container { padding: 18px 13px; }
  .page-header, .project-title, .upload-form { align-items: stretch; flex-direction: column; }
  .kpi-grid, .process-grid, .split-grid, .form-grid, .payroll-summary, .detail-grid { grid-template-columns: 1fr; }
  .payroll-summary dl { grid-template-columns: repeat(2, 1fr); }
  .span-2 { grid-column: auto; }
  .project-meta { flex-wrap: wrap; }
  .messages { right: 15px; }
  .scan-layout { grid-template-columns: 1fr; }
  .participant-row { grid-template-columns: 22px 1fr 90px; }
  .participant-row.allocation-row { grid-template-columns: minmax(0, 1fr) 90px; }
  .qr-reader { min-height: 280px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
@media print { .sidebar, .mobile-header, .page-header, .no-print, .credential-card .header-actions { display: none !important; } .main-area { margin: 0; } .page-container { max-width: none; padding: 0; } .credential-card { box-shadow: none; border: 1px solid #999; } .label-page { background: white; } .label-sheet { gap: 0; } .label-sheet.a4 { gap: 3mm; } .qr-label { border-color: #000; } }
