:root {
  --nav: #152c40;
  --nav-muted: #92a8bc;
  --ink: #192c3e;
  --muted: #728295;
  --line: #e3eaf0;
  --canvas: #f3f6f9;
  --brand: #087d7e;
  --brand-light: #e7f5f2;
  --red: #b53c3c;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font:
    14px/1.65 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Microsoft YaHei",
    sans-serif;
}
a {
  color: var(--brand);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--brand);
  color: #fff;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 9px 17px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  min-height: 40px;
}
button:hover,
.button:hover {
  filter: brightness(0.95);
  text-decoration: none;
}
.secondary {
  background: #fff;
  color: var(--ink);
  border-color: #ccd8e1;
}
.danger {
  background: #fff0f0;
  color: var(--red);
  border-color: #f0caca;
}
.text-button {
  background: transparent;
  color: var(--brand);
  padding: 3px 8px;
  min-height: 30px;
}
.sidebar {
  background: var(--nav);
  color: #fff;
  width: 240px;
  position: fixed;
  inset: 0 auto 0 0;
  padding: 28px 17px;
  overflow: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: 24px;
  font-weight: 750;
  letter-spacing: 1px;
  padding: 0 12px;
}
.brand small {
  display: block;
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 400;
  color: #a7bed0;
}
.brand-mark {
  width: 39px;
  height: 43px;
  border-radius: 9px;
  background: #25a69b;
  display: grid;
  place-items: center;
  font-size: 28px;
}
.edition {
  margin: 24px 10px 15px;
  padding: 8px;
  border: 1px solid #375063;
  border-radius: 6px;
  color: #a7bed0;
  font-size: 11px;
}
nav a {
  display: block;
  padding: 9px 13px;
  border-radius: 6px;
  color: #d2dfeb;
  margin: 2px 0;
}
nav a:hover,
nav a.active {
  background: #25475b;
  text-decoration: none;
  color: #fff;
}
.nav-label {
  display: block;
  color: var(--nav-muted);
  font-size: 11px;
  letter-spacing: 2px;
  margin: 23px 12px 6px;
}
.sidebar-footer {
  font-size: 11px;
  color: var(--nav-muted);
  margin: 28px 12px;
}
main {
  margin-left: 240px;
}
.topbar {
  height: 68px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}
.user {
  display: flex;
  gap: 12px;
  align-items: center;
}
.user form {
  margin: 0;
}
.page {
  padding: 30px 36px;
  max-width: 1600px;
  margin: auto;
}
.page-heading {
  margin-bottom: 25px;
}
.eyebrow {
  font-size: 10px;
  color: var(--brand);
  letter-spacing: 2px;
  font-weight: 700;
}
h1 {
  font-size: 27px;
  font-weight: 650;
  margin: 5px 0;
}
h2 {
  font-size: 18px;
  margin: 0 0 16px;
}
h3 {
  font-size: 15px;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 24px;
  margin: 20px 0;
  box-shadow: 0 3px 12px #20374d04;
}
.narrow {
  max-width: 830px;
}
.login-card {
  max-width: 440px;
  margin: 55px auto;
  padding: 35px;
}
.login-card button {
  width: 100%;
  margin-top: 12px;
}
.muted {
  color: var(--muted);
}
.notice {
  padding: 13px 17px;
  border-radius: 8px;
  background: #edf4fb;
  border: 1px solid #d7e6f5;
  color: #355771;
  margin: 14px 0;
}
.success {
  background: var(--brand-light);
  color: #286558;
  border-color: #c6e9dc;
}
.warning {
  background: #fff7e8;
  color: #8a6426;
  border-color: #f0deba;
}
.toolbar,
.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
  margin-bottom: 19px;
}
.section-heading h2 {
  margin: 0;
}
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(650px, 75%);
}
.search input {
  min-width: 180px;
}
.search select {
  width: 150px;
}
label {
  display: block;
  color: #475b6c;
  margin-bottom: 16px;
}
input,
select,
textarea {
  display: block;
  width: 100%;
  border: 1px solid #cfdbe4;
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  padding: 9px 11px;
  margin-top: 6px;
  min-height: 40px;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #91d2c9;
  outline-offset: 1px;
}
input[type="checkbox"] {
  width: 17px;
  min-height: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--brand);
}
select[multiple] {
  min-height: 130px;
}
textarea {
  resize: vertical;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 22px;
}
.full {
  grid-column: 1/-1;
}
.form-grid button {
  justify-self: start;
}
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 18px 0;
}
.actions form {
  margin: 0;
}
.inline {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin: 3px 0;
}
.inline input {
  max-width: 170px;
  margin: 0;
}
.table-scroll {
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
th {
  font-size: 12px;
  background: #f7f9fb;
  color: #667c8d;
  font-weight: 600;
  white-space: nowrap;
  text-align: left;
}
td,
th {
  padding: 13px 14px;
  border-bottom: 1px solid #e9eef3;
  vertical-align: middle;
}
tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover {
  background: #fbfcfd;
}
.empty {
  text-align: center;
  padding: 48px !important;
  color: #8999a7;
}
/* .badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 5px;
  background: var(--brand-light);
  color: #197467;
  font-size: 11px;
} */
 .badge {
  padding: 4px 12px;
  border-radius: 999px;
  background: #edf9f0;
  color: #16803c;
}

/* 停用：红色、圆润 */
.badge.muted {
  background: #fff1f0;
  color: #dc2626;
  opacity: 1;
}
.pagination {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 17px;
  margin-bottom: 24px;
}
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
}
.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.stat strong {
  display: block;
  font-size: 25px;
  letter-spacing: -0.4px;
  font-weight: 650;
  margin: 10px 0 2px;
  font-variant-numeric: tabular-nums;
}
.stat small {
  color: var(--brand);
  font-size: 11px;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 22px 0;
}
.detail-grid dt {
  color: var(--muted);
  font-size: 12px;
}
.detail-grid dd {
  margin: 4px 0;
  font-size: 16px;
}
.document-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.document-head h2 {
  font-size: 24px;
  margin: 6px 0;
}
.document-head small {
  color: var(--muted);
}
.document-sheet {
  max-width: 1000px;
}
.signature-block {
  border-top: 1px dashed #cdd7df;
  margin-top: 30px;
  padding-top: 15px;
}
.signature-image {
  max-width: 360px;
  width: 100%;
  height: auto;
}
.signature-block small {
  font-size: 9px;
  overflow-wrap: anywhere;
  color: var(--muted);
}
#signature-pad {
  display: block;
  width: 100%;
  max-width: 900px;
  height: 220px;
  border: 2px dashed #bdcdd7;
  border-radius: 8px;
  background: #fafcfd;
  touch-action: none;
  margin: 16px 0;
}
.status-strip {
  display: flex;
  gap: 20px;
  align-items: center;
}
.parts-row {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}
.parts-row input:first-child {
  flex: 2;
}
.parts-row input {
  width: 20%;
  flex: 1;
}
.permission-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 22px;
  margin-bottom: 22px;
}
.permission-grid .check {
  padding: 8px;
  background: #f7f9fb;
  border-radius: 6px;
  flex-wrap: wrap;
}
.permission-grid small {
  display: block;
  color: #8a99a5;
  font-size: 10px;
}
.subrow {
  background: #f8fafb;
  color: #667c8d;
}
summary {
  cursor: pointer;
  font-weight: 600;
}
details[open] > summary {
  margin-bottom: 20px;
}
footer {
  padding: 20px 36px;
  color: #94a0ac;
  font-size: 11px;
}
.select-search {
  font-size: 12px;
  min-height: 34px;
  padding: 5px 9px;
  background: #f8fafb;
}
.search-hint {
  font-size: 11px;
  color: var(--muted);
}
[hidden] {
  display: none !important;
}
@media (max-width: 1100px) {
  .sidebar {
    width: 210px;
  }
  main {
    margin-left: 210px;
  }
  .page {
    padding: 25px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .permission-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 720px) {
  .sidebar {
    position: relative;
    width: 100%;
    padding: 15px;
  }
  .brand {
    font-size: 20px;
  }
  .edition,
  .sidebar-footer,
  .nav-label {
    display: none;
  }
  .sidebar nav {
    display: flex;
    overflow: auto;
    white-space: nowrap;
    margin-top: 14px;
  }
  .sidebar nav a {
    font-size: 12px;
    padding: 6px 10px;
  }
  main {
    margin: 0;
  }
  .topbar {
    padding: 0 17px;
    height: auto;
    min-height: 54px;
    gap: 10px;
  }
  .user {
    font-size: 10px;
  }
  .page {
    padding: 20px 14px;
  }
  .card {
    padding: 17px;
  }
  .form-grid,
  .permission-grid {
    grid-template-columns: 1fr;
  }
  .full {
    grid-column: auto;
  }
  .toolbar,
  .document-head {
    align-items: stretch;
    flex-direction: column;
  }
  .search {
    width: 100%;
    flex-wrap: wrap;
  }
  .search input {
    flex: 1;
  }
  .stats-grid {
    gap: 9px;
  }
  .stat {
    padding: 15px;
  }
  .stat strong {
    font-size: 21px;
  }
  .parts-row {
    flex-wrap: wrap;
  }
  .detail-grid {
    grid-template-columns: 1fr 1fr;
    gap: 13px;
  }
  table {
    font-size: 12px;
  }
  td,
  th {
    padding: 10px 9px;
  }
  footer {
    padding: 20px;
  }
  h1 {
    font-size: 23px;
  }
  .inline {
    flex-wrap: wrap;
  }
  .document-head h2 {
    font-size: 21px;
  }
}
@media print {
  body {
    background: #fff;
    color: #000;
  }
  .sidebar,
  .topbar,
  .page-heading,
  .no-print,
  footer,
  .notice {
    display: none !important;
  }
  main {
    margin: 0;
  }
  .page {
    padding: 0;
    max-width: none;
  }
  .document-sheet {
    border: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
    max-width: none;
  }
  .document-sheet h2 {
    font-size: 24px;
  }
  a {
    color: #000;
  }
  .signature-image {
    max-width: 300px;
  }
  .signature-block {
    break-inside: avoid;
  }
  .card {
    break-inside: avoid;
  }
  .document-sheet small {
    color: #555;
  }
}
/* Narrow-screen finance tables scroll inside their own card, not the page. */
.form-grid > * {
  min-width: 0;
}
@media (max-width: 720px) {
  .card > table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }
  .form-grid select {
    max-width: 100%;
  }
}

.status-disabled {
  border: 1px solid #c93131 !important;
  color: #a52626;
  background: #fff5f5;
}
.employee-status {
  border: 1px solid #dce4ea;
  padding: 16px;
  border-radius: 8px;
}
input[readonly] {
  background: #f3f6f8;
  color: #526978;
}
