:root {
  --ink: #17212b;
  --muted: #66727d;
  --line: #dce2e7;
  --surface: #ffffff;
  --canvas: #f4f6f7;
  --teal: #087f78;
  --teal-dark: #06635e;
  --teal-soft: #e6f3f1;
  --red: #b42318;
  --red-soft: #fff0ed;
  --amber: #9a6700;
  --amber-soft: #fff7d6;
  --shadow: 0 14px 40px rgba(23, 33, 43, 0.11);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--canvas); }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .58; }
:focus-visible { outline: 3px solid rgba(8, 127, 120, .26); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.eyebrow { margin: 0 0 5px; color: var(--teal-dark); font-size: 12px; font-weight: 700; }

.auth-page {
  display: grid;
  place-items: center;
  background: linear-gradient(90deg, #edf2f2 0 42%, #f7f8f8 42% 100%);
}
.auth-shell { width: min(920px, calc(100% - 32px)); padding: 56px 0; }
.auth-panel { width: min(420px, 100%); margin-left: auto; padding: 42px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.auth-mark { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 28px; background: var(--teal); color: #fff; border-radius: 4px; font-size: 20px; font-weight: 700; }
.auth-panel h1, .feedback-header h1, .feedback-result h1 { margin: 0; font-size: 28px; font-weight: 700; }
.auth-intro { margin: 12px 0 26px; color: var(--muted); font-size: 14px; }
.auth-form { display: grid; gap: 18px; }
.auth-form label, .feedback-form > label { display: grid; gap: 7px; color: #34404b; font-size: 13px; font-weight: 600; }
.auth-form input, .feedback-form input, .feedback-form textarea, .filters input, .filters select { width: 100%; border: 1px solid #c9d1d7; border-radius: 5px; background: #fff; color: var(--ink); }
.auth-form input, .feedback-form input, .filters input, .filters select { height: 40px; padding: 0 11px; }
.auth-form button, .feedback-form > button { min-height: 42px; border: 0; border-radius: 5px; background: var(--teal); color: #fff; font-weight: 700; }
.auth-form button:hover, .feedback-form > button:hover { background: var(--teal-dark); }
.form-error { padding: 10px 12px; border-left: 3px solid var(--red); background: var(--red-soft); color: var(--red); font-size: 13px; }

.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 74px; padding: 14px clamp(20px, 4vw, 56px); border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar h1 { margin: 0; font-size: 21px; font-weight: 700; }
.account-area { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; }
.text-button { border: 0; background: transparent; color: var(--teal-dark); padding: 6px; }
.workspace { width: min(1680px, calc(100% - 36px)); margin: 0 auto; padding: 24px 0 48px; }
.summary-strip { display: grid; grid-template-columns: repeat(4, minmax(120px, 180px)) 1fr; align-items: stretch; min-height: 78px; margin-bottom: 18px; border-block: 1px solid var(--line); background: rgba(255,255,255,.56); }
.summary-strip > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 17px 20px; border-right: 1px solid var(--line); }
.summary-strip span { color: var(--muted); font-size: 12px; }
.summary-strip strong { font-family: "Segoe UI", sans-serif; font-size: 25px; }
.summary-strip .risk strong { color: var(--red); }
.sync-status { align-self: center; justify-self: end; margin: 0; padding: 0 16px; color: var(--muted); font-size: 12px; }
.control-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 20px 0 12px; }
.segmented { display: inline-flex; align-items: center; min-height: 38px; padding: 3px; border: 1px solid #cbd3d9; border-radius: 6px; background: #e9edef; }
.segmented button { height: 30px; padding: 0 13px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 13px; }
.segmented button.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(23,33,43,.14); }
.segmented b { display: inline-block; min-width: 20px; margin-left: 5px; padding: 1px 5px; border-radius: 10px; background: #dfe5e8; font-family: "Segoe UI", sans-serif; font-size: 11px; }
.segmented .is-active b { background: var(--teal-soft); color: var(--teal-dark); }
.filters { display: flex; align-items: center; gap: 8px; }
.search-field { width: min(360px, 34vw); }
.filters select { width: 128px; }
.icon-button { width: 40px; height: 40px; border: 1px solid #c9d1d7; border-radius: 5px; background: #fff; color: var(--teal-dark); font-size: 21px; }
.board-panel { border-top: 3px solid var(--teal); background: var(--surface); }
.board-panel[hidden] { display: none; }
.section-heading { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 13px; border-bottom: 1px solid var(--line); }
.section-heading h2 { margin: 0; font-size: 16px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; min-width: 1240px; border-collapse: collapse; table-layout: fixed; }
th { position: sticky; top: 0; z-index: 1; padding: 10px 9px; border-bottom: 1px solid #bcc7ce; background: #f1f4f5; color: #46525d; text-align: left; font-size: 12px; font-weight: 700; }
td { padding: 8px 9px; border-bottom: 1px solid #e6eaed; vertical-align: top; font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
tbody tr:hover { background: #f8fbfb; }
tbody tr.is-complete { color: #7b858e; background: #f7f8f8; }
tbody tr.is-mandatory { box-shadow: inset 3px 0 var(--red); }
th:nth-child(1), .cell-code { width: 122px; }
th:nth-child(2), .cell-person { width: 80px; }
.cell-reason { width: 240px; }
.cell-supplier { width: 210px; }
.cell-money { width: 108px; text-align: right; white-space: nowrap; font-family: "Segoe UI", sans-serif; font-variant-numeric: tabular-nums; }
.cell-action { width: 130px; }
.cell-note { width: 230px; }
.cell-requirement { width: 210px; }
.cell-action, .cell-requirement { display: grid; gap: 6px; align-content: start; }
.cell-action small, .cell-requirement small { color: var(--muted); font-size: 10px; }
.status-toggle { display: inline-flex; align-items: center; gap: 6px; color: #46525d; white-space: nowrap; }
.status-toggle input { accent-color: var(--teal); }
.compact-button { width: fit-content; min-height: 28px; padding: 0 9px; border: 1px solid #8fbab6; border-radius: 4px; background: var(--teal-soft); color: var(--teal-dark); font-size: 11px; }
.cell-note textarea { width: 100%; min-height: 50px; resize: vertical; padding: 7px; border: 1px solid #cbd3d9; border-radius: 4px; font-size: 12px; }
.tag { display: inline-flex; width: fit-content; padding: 2px 6px; border-radius: 3px; background: #edf1f3; color: #4e5b65; font-size: 10px; font-weight: 700; }
.tag-risk { background: var(--red-soft); color: var(--red); }
.tag-history { background: var(--amber-soft); color: var(--amber); }
.empty-state { height: 140px; color: var(--muted); text-align: center; vertical-align: middle; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 420px; padding: 12px 15px; border-radius: 5px; background: #173c39; color: #fff; box-shadow: var(--shadow); font-size: 13px; }
.toast.is-error { background: #7c241d; }

.feedback-page { background: #eef2f2; }
.feedback-shell { width: min(620px, calc(100% - 28px)); margin: 32px auto; padding: 30px; border-top: 4px solid var(--teal); background: var(--surface); box-shadow: var(--shadow); }
.feedback-header { padding-bottom: 21px; border-bottom: 1px solid var(--line); }
.feedback-header > p:last-child { margin: 8px 0 0; color: var(--muted); font-family: "Segoe UI", sans-serif; font-size: 13px; }
.voucher-context { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 0 0 24px; }
.voucher-context div { padding: 13px 0; border-bottom: 1px solid var(--line); }
.voucher-context .wide { grid-column: 1 / -1; }
.voucher-context dt { margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.voucher-context dd { margin: 0; font-size: 13px; }
.feedback-form { display: grid; gap: 20px; }
.feedback-form fieldset { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; }
.feedback-form legend { margin-bottom: 8px; color: #34404b; font-size: 13px; font-weight: 700; }
.radio-option { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; font-size: 13px; }
.radio-option:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.radio-option input { width: auto; height: auto; accent-color: var(--teal); }
.feedback-form textarea { padding: 10px; resize: vertical; }
.feedback-result { margin-top: 12vh; text-align: center; }
.feedback-result p:last-child { color: var(--muted); line-height: 1.7; }
.result-mark { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 20px; border-radius: 50%; background: var(--teal); color: #fff; font-size: 26px; }
.result-mark.muted { background: #6d7881; }

@media (max-width: 860px) {
  .summary-strip { grid-template-columns: repeat(2, 1fr); }
  .summary-strip > div:nth-child(2) { border-right: 0; }
  .sync-status { grid-column: 1 / -1; justify-self: start; padding: 11px 16px; }
  .control-row { align-items: stretch; flex-direction: column; }
  .filters { width: 100%; }
  .search-field { width: 100%; }
}

@media (max-width: 560px) {
  .auth-page { background: var(--canvas); }
  .auth-shell { padding: 20px 0; }
  .auth-panel { padding: 28px 22px; }
  .topbar { align-items: flex-start; padding: 13px 16px; }
  .workspace { width: calc(100% - 20px); padding-top: 14px; }
  .summary-strip > div { padding: 13px 12px; }
  .summary-strip strong { font-size: 21px; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; }
  .filters { flex-wrap: wrap; }
  .filters select { width: calc(100% - 48px); }
  .feedback-shell { margin: 12px auto; padding: 22px 18px; }
  .voucher-context { grid-template-columns: 1fr; }
  .voucher-context .wide { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
