:root {
  --bg: #e8eef3;
  --fg: #0b1f2a;
  --accent: #1e5a78;
  --accent-deep: #164860;
  --danger: #9a3b3b;
  --muted: #5a6f7a;
  --card: #f7fafc;
  --border: rgba(11, 31, 42, 0.12);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background:
    radial-gradient(ellipse at 12% 0%, rgba(30,90,120,0.14), transparent 42%),
    radial-gradient(ellipse at 88% 100%, rgba(20,70,90,0.1), transparent 38%),
    linear-gradient(160deg, #e8eef3 0%, #f4f7fa 45%, #e6edf2 100%);
  color: var(--fg);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: min(1760px, 98vw); margin: 0 auto; padding: 16px; }
.top {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 12px; border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 16px;
}
.brand h1 { margin: 4px 0 0; font-size: 22px; font-weight: 600; }
.brand-text-wrap { text-align: center; margin-bottom: 8px; }
.brand-text {
  font-size: clamp(18px, 4.5vw, 24px);
  font-weight: 700;
  color: #1a3a7a;
  letter-spacing: 0.06em;
  line-height: 1.35;
}
.brand-text-header {
  font-size: 15px;
  font-weight: 700;
  color: #1a3a7a;
  letter-spacing: 0.04em;
  line-height: 1.3;
}
.nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.nav a {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--fg);
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav a.active, .nav a:hover { background: var(--accent); color: #f2f7fa; text-decoration: none; }
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #8a3535;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.nav a.active .nav-badge,
.nav a:hover .nav-badge {
  background: #fff;
  color: #8a3535;
}
.alert-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(138,53,53,0.28);
  background: #f8eaea;
  color: #6e2a2a;
}
.alert-banner strong { margin-right: 8px; }
.alert-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.alert-ack-form { margin: 0; }
.viewer-banner {
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(90,111,122,0.25);
  background: rgba(90,111,122,0.08);
  color: var(--muted);
  font-size: 13px;
}
.due-remain {
  display: inline-block;
  margin-left: 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.due-remain.is-soon { color: #8a3535; }
.due-remain.is-overdue { color: #8a3535; }
.row-soon td { background: rgba(138,53,53,0.04); }
.row-alert td { background: rgba(138,53,53,0.08); }
.card {
  background: color-mix(in srgb, var(--card) 92%, white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 10px 40px -28px rgba(11,31,42,0.45);
}
.card h2 { margin: 0 0 12px; font-size: 18px; }
.card-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 10px; margin-bottom: 12px;
}
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 12px; }
@media (min-width: 800px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .span-2 { grid-column: span 2; }
  .span-3 { grid-column: span 3; }
}
.stat { font-size: 22px; font-weight: 600; margin-top: 4px; }
.stat-box {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: rgba(255,255,255,0.65);
}
.muted { color: var(--muted); }
label { display: block; font-size: 13px; margin-bottom: 4px; color: var(--muted); }
input, select, textarea, button {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 8px 10px;
  background: #fff;
  color: var(--fg);
}
input, select, textarea { width: 100%; }
button, .btn {
  display: inline-block;
  background: var(--accent);
  color: #f2f7fa;
  border: none;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
}
button:hover, .btn:hover { background: var(--accent-deep); text-decoration: none; }
button.secondary, .btn.secondary, .secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
}
button.secondary:hover, .btn.secondary:hover, .secondary:hover {
  background: rgba(11,31,42,0.05);
}
button.danger, .danger {
  background: var(--danger);
  color: #fff;
  border: none;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.remember-row {
  display: flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; user-select: none;
}
.remember-row input { width: auto; margin: 0; accent-color: var(--accent); }
.row { display: grid; gap: 12px; }
.filters {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
}
.filters input, .filters select { width: auto; min-width: 160px; flex: 1; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.num { font-size: 12px; white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.contracts-table { table-layout: auto; }
.contracts-table th,
.contracts-table td {
  vertical-align: middle;
}
.contracts-table .col-contract {
  min-width: 200px;
  max-width: 320px;
  width: 22%;
}
.contracts-table .col-supplier {
  min-width: 140px;
  max-width: 220px;
  width: 14%;
}
.contracts-table .contract-no {
  display: inline-block;
  word-break: break-all;
}
.contracts-table .contract-title {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  white-space: normal;
  word-break: break-word;
}
.contracts-table .money-cell {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.contracts-table .pay-cell {
  width: 1%;
  white-space: nowrap;
}
.contracts-table .pay-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.contracts-table .pay-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1.35;
}
.contracts-table .pay-label {
  color: var(--muted);
  flex: 0 0 auto;
}
.contracts-table .pay-val {
  font-variant-numeric: tabular-nums;
  font-weight: 560;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  color: var(--accent-deep);
  cursor: pointer;
  text-align: left;
  border-radius: 4px;
}
.contracts-table .pay-val:hover {
  background: rgba(30, 90, 120, 0.1);
  text-decoration: underline;
}
/* 无应付：灰；有待付：已付绿/应付红；已付清：已付与应付均绿 */
.contracts-table .pay-line.pay-tone-muted .pay-label,
.contracts-table .pay-line.pay-tone-muted .pay-val {
  color: #9aa8b0;
}
.contracts-table .pay-line.pay-tone-paid .pay-label,
.contracts-table .pay-line.pay-tone-paid .pay-val {
  color: #1f7a4d;
}
.contracts-table .pay-line.pay-tone-unpaid .pay-label,
.contracts-table .pay-line.pay-tone-unpaid .pay-val {
  color: #b42318;
}
.contracts-table .pay-line.pay-tone-muted .pay-val:hover {
  background: rgba(154, 168, 176, 0.16);
}
.contracts-table .pay-line.pay-tone-paid .pay-val:hover {
  background: rgba(31, 122, 77, 0.12);
}
.contracts-table .pay-line.pay-tone-unpaid .pay-val:hover {
  background: rgba(180, 35, 24, 0.1);
}
.contracts-table .pay-input {
  width: 108px;
  padding: 2px 6px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.contracts-table .pay-extra {
  font-size: 11px;
  margin-top: 1px;
}
.contracts-table .created-cell {
  white-space: nowrap;
  font-size: 12px;
}
.contracts-table .created-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.35;
}
.contracts-table .created-date {
  font-variant-numeric: tabular-nums;
}
.contracts-table .created-time {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(11,31,42,0.08);
}
.pill-active { background: #dcefe6; color: #1f5c45; }
.pill-inquiring { background: #2f6fa0; color: #ffffff; }
.pill-won { background: #7a4aa8; color: #ffffff; }
.pill-contract { background: #2a9a7a; color: #ffffff; }
.pill-completed { background: #8fcd9a; color: #163f22; }
.pill-cancelled { background: #b04a4a; color: #ffffff; }
.pill-draft { background: #c49a3c; color: #ffffff; }
.pill-cat {
  display: inline-block;
  margin: 0 4px 4px 0;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(30, 90, 120, 0.12);
  color: var(--accent-deep);
}
.cat-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 8px;
}
.cat-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--fg);
  cursor: pointer;
  user-select: none;
}
.cat-check input { width: auto; margin: 0; accent-color: var(--accent); }
.cat-new-block { margin-top: 8px; }
.cat-new-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.cat-new-list { display: grid; gap: 8px; }
.cat-new-row {
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: 480px;
}
.cat-new-row input { flex: 1; min-width: 0; }
.schedule-section { margin-bottom: 8px; }
.schedule-subhead {
  margin: 16px 0 10px;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.schedule-subhead:first-of-type { margin-top: 4px; }
.schedule-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}
.schedule-table th,
.schedule-table td {
  vertical-align: middle;
  padding: 10px 10px;
  box-sizing: border-box;
}
.schedule-table .col-num,
.schedule-table td.col-num,
.schedule-table th.col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.schedule-table .col-action,
.schedule-table td.col-action,
.schedule-table th.col-action,
.schedule-table td.schedule-action {
  text-align: center;
  white-space: nowrap;
}
.schedule-table td.schedule-action .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
}
.schedule-table-nodes col.c-node { width: 28%; }
.schedule-table-nodes col.c-paytype { width: 14%; }
.schedule-table-nodes col.c-num { width: 14%; }
.schedule-table-nodes col.c-action { width: 16%; }
.schedule-table-dated col.c-due { width: 16%; }
.schedule-table-dated col.c-contract { width: 18%; }
.schedule-table-dated col.c-supplier { width: 12%; }
.schedule-table-dated col.c-owner { width: 8%; }
.schedule-table-dated col.c-paytype { width: 10%; }
.schedule-table-dated col.c-num { width: 9%; }
.schedule-table-dated col.c-action { width: 10%; }
.schedule-table-open col.c-contract { width: 18%; }
.schedule-table-open col.c-supplier { width: 12%; }
.schedule-table-open col.c-owner { width: 8%; }
.schedule-table-open col.c-paytype { width: 10%; }
.schedule-table-open col.c-num { width: 9%; }
.schedule-table-open col.c-fill { width: 24%; }
.schedule-group-banner td {
  background: rgba(30,90,120,0.07);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left !important;
  font-size: 14px;
}
.schedule-group-banner td strong {
  margin-right: 8px;
  color: var(--accent-deep);
  font-size: 15px;
}
.schedule-group-banner td .muted {
  margin-right: 4px;
}
.schedule-group-banner + tr td {
  border-top: none;
}
.schedule-due-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0;
}
.schedule-due-form input[type="date"] {
  width: auto;
  min-width: 150px;
}
.text-danger { color: #8a3535; }
.final-hint {
  margin: 0 0 10px;
  font-size: 12px;
  min-height: 1.2em;
}
.cat-accordion { display: grid; gap: 8px; }
.cat-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.72);
  overflow: hidden;
}
.cat-panel > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  user-select: none;
  font-weight: 600;
}
.cat-panel > summary::-webkit-details-marker { display: none; }
.cat-panel > summary::before {
  content: "▸";
  color: var(--accent);
  margin-right: 2px;
  transition: transform 0.15s ease;
}
.cat-panel[open] > summary::before { content: "▾"; }
.cat-panel > summary:hover { background: rgba(30,90,120,0.06); }
.cat-panel-name { flex: 1; min-width: 0; }
.cat-panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  font-weight: 400;
}
.cat-rename-form,
.cat-delete-form {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
}
.cat-rename-form input {
  width: 110px;
  min-width: 0;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 400;
}
.cat-panel-actions button {
  padding: 4px 10px;
  font-size: 12px;
}
.cat-count {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #f2f7fa;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.cat-panel .table-scroll { padding: 0 10px 10px; }
.cat-empty { margin: 0; padding: 0 14px 14px; font-size: 13px; }
.status-inline-form { margin: 0; }
.status-inline.pill-select {
  width: auto;
  min-width: 96px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}
.status-inline.pill-active { background: #dcefe6; color: #1f5c45; }
.status-inline.pill-inquiring { background: #2f6fa0; color: #ffffff; }
.status-inline.pill-won { background: #7a4aa8; color: #ffffff; }
.status-inline.pill-contract { background: #2a9a7a; color: #ffffff; }
.status-inline.pill-completed { background: #8fcd9a; color: #163f22; }
.status-inline.pill-cancelled { background: #b04a4a; color: #ffffff; }
.status-inline.pill-draft { background: #c49a3c; color: #ffffff; }
a.th-sort {
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  font-weight: 600;
}
a.th-sort:hover { color: var(--accent); text-decoration: none; }
a.th-sort.is-active { color: var(--accent-deep); }
.pay-box {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: rgba(11,31,42,0.02);
}
.pay-toolbar {
  flex-wrap: wrap;
  gap: 8px;
}
.invoice-upload-form {
  margin-top: 10px;
}
.invoice-upload-hint {
  margin: 8px 0 0;
  color: var(--accent-deep);
}
.invoice-box {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: rgba(11,31,42,0.02);
}
.invoice-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 10px;
}
.invoice-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  display: grid;
  gap: 8px;
}
.invoice-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: baseline;
}
.invoice-thumb {
  display: block;
  max-width: 220px;
}
.invoice-thumb img {
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f7fafc;
}
.invoice-date-cell,
.invoice-cell {
  white-space: nowrap;
  vertical-align: middle;
}
.invoice-date-cell .btn-fill-invoice {
  padding: 4px 10px;
  font-size: 12px;
}
.invoice-date-dialog-meta {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(30,90,120,0.06);
  font-size: 13px;
  line-height: 1.55;
}
.invoice-date-dialog-meta strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
  color: var(--accent-deep);
}
.card.contracts-card {
  overflow: visible;
}
.contracts-card .table-scroll {
  overflow-x: auto;
  max-width: 100%;
}
.pay-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  margin-bottom: 8px;
}
@media (min-width: 900px) {
  .pay-row { grid-template-columns: 1fr 1.2fr 1fr 1fr 1fr 1.2fr; }
}
.pay-date-row { display: flex; gap: 6px; align-items: center; }
.pay-date-row input { flex: 1; min-width: 0; }
.pay-due-wrap { display: grid; gap: 4px; }
.pay-due-wrap input[type="text"] { font-size: 13px; }
.schedule-due-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.schedule-due-form input[type="text"] { min-width: 140px; flex: 1; }
.bar-chart {
  display: flex; align-items: flex-end; gap: 10px; overflow-x: auto;
  min-height: 200px; padding-top: 8px;
}
.bar-item { flex: 1; min-width: 48px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bar {
  width: 28px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
}
.bar-val, .bar-label { font-size: 11px; color: var(--muted); text-align: center; }
.pie-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 28px;
  margin-top: 8px;
}
.pie-chart {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(11,31,42,0.08);
}
.pie-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-width: 220px;
  display: grid;
  gap: 8px;
}
.pie-legend li {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.55);
}
.pie-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-block;
}
.pie-label { font-weight: 600; }
.pie-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 13px;
}
.pie-meta .muted { font-size: 12px; }
.item-log-meta {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(30,90,120,0.06);
  font-size: 13px;
  line-height: 1.5;
}
.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  max-height: min(55vh, 480px);
  overflow: auto;
}
.log-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.65);
}
.log-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}
.log-action {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(30,90,120,0.12);
  color: var(--accent-deep);
  font-weight: 600;
}
.log-summary { font-size: 14px; }
.log-meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}
.log-detail {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--fg);
  font-size: 13px;
  line-height: 1.55;
}
.log-detail li { margin: 2px 0; }
.export-list { display: grid; gap: 10px; max-width: 640px; }
.export-item {
  display: block;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.7);
  color: var(--fg);
}
.export-item:hover { border-color: var(--accent); text-decoration: none; }
.export-item strong { display: block; margin-bottom: 4px; color: var(--accent); }
.export-item span { font-size: 13px; color: var(--muted); }
.flash {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 14px;
}
.flash.ok { background: #dcefe6; color: #1f5c45; }
.flash.err { background: #f0dede; color: #8a3535; }
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(ellipse at 18% 15%, rgba(30,90,120,0.28), transparent 48%),
    radial-gradient(ellipse at 85% 85%, rgba(15,55,75,0.35), transparent 42%),
    linear-gradient(145deg, #0b1f2a 0%, #143447 55%, #1a4054 100%);
}
.login-box {
  width: 100%;
  max-width: 420px;
  background: rgba(243,247,250,0.96);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.28);
}
.msg-mask {
  position: fixed; inset: 0; background: rgba(11,31,42,0.35);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.msg-box {
  background: #fff; border-radius: 12px; padding: 18px; max-width: 360px; width: 100%;
  box-shadow: 0 16px 40px rgba(0,0,0,0.2);
}
.msg-box.err { border-top: 4px solid var(--danger); }
.msg-box.ok { border-top: 4px solid var(--accent); }
.msg-box button { width: 100%; margin-top: 12px; }
.search-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.search-bar input[type="search"],
.search-bar select {
  width: auto;
  min-width: 140px;
}
.search-bar-wrap input[type="search"] { min-width: 200px; flex: 1; }
.mono {
  font-variant-numeric: tabular-nums;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  white-space: nowrap;
}
.user-edit-table td { vertical-align: middle; }
.user-edit-table input,
.user-edit-table select {
  width: 100%;
  min-width: 0;
  margin: 0;
}
.user-edit-table input:focus,
.user-edit-table select:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-color: var(--accent);
}
.form-mask[hidden] { display: none !important; }
.form-box {
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 16px 40px rgba(0,0,0,0.2);
}
.form-box-wide {
  max-width: 720px;
  max-height: min(90vh, 860px);
  overflow: auto;
}
.form-box-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.form-box-head h3 { margin: 0; font-size: 18px; }
.form-stack { display: grid; gap: 12px; }
.form-stack label { color: var(--fg); }
code {
  font-family: Consolas, "Courier New", monospace;
  background: rgba(11,31,42,0.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}
@media (max-width: 640px) {
  .wrap { padding: 12px; }
  .brand h1 { font-size: 18px; }
  .filters input, .filters select { min-width: 0; width: 100%; }
  .search-bar input[type="search"],
  .search-bar select,
  .search-bar-wrap input[type="search"] {
    width: 100%;
    min-width: 0;
  }
}

/* 采购计划补充 */
.plans-table { font-size: 13px; table-layout: auto; }
.plans-table th, .plans-table td { padding: 8px 6px; vertical-align: middle; }
.plans-table .col-check { width: 36px; text-align: center; }
.plans-table .col-check input { width: auto; }
.plans-table .col-mat {
  min-width: 200px;
  max-width: 280px;
}
.plans-table .th-mat-sorts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  align-items: center;
  white-space: nowrap;
}
.plans-table .mat-name {
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.plans-table button.mat-log-btn {
  display: inline;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
}
.plans-table button.mat-log-btn:hover {
  text-decoration: underline;
  background: rgba(30, 90, 120, 0.1);
}
.plans-table .mat-code { font-size: 12px; color: var(--muted); margin-top: 2px; word-break: break-all; }
.plans-table .col-qty {
  width: 96px;
  min-width: 86px;
  max-width: 120px;
  white-space: nowrap;
  vertical-align: middle;
}
.plans-table .th-qty {
  display: grid;
  gap: 2px;
  line-height: 1.25;
  font-size: 12px;
}
.plans-table .th-qty .muted { font-weight: 500; }
.plans-table .qty-stack {
  display: grid;
  gap: 2px;
  line-height: 1.3;
}
.plans-table .qty-need,
.plans-table .qty-arrival {
  display: grid;
  grid-template-columns: minmax(2.6em, max-content) auto;
  column-gap: 4px;
  align-items: baseline;
  white-space: nowrap;
}
.plans-table .qty-need {
  font-weight: 650;
}
.plans-table .qty-stack .aq-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.plans-table .qty-stack .aq-unit {
  font-size: 12px;
  min-width: 1.2em;
}
.plans-table .qty-arrival .plan-val,
.plans-table .qty-arrival .mono {
  white-space: nowrap;
  word-break: keep-all;
  font-size: 12px;
  padding: 0;
  text-align: right;
}
.plans-table .col-dates {
  width: 118px;
  min-width: 110px;
  max-width: 130px;
  white-space: nowrap;
  vertical-align: middle;
}
.plans-table .th-dates {
  display: grid;
  gap: 2px;
  line-height: 1.25;
  font-size: 12px;
}
.plans-table .th-dates .muted { font-weight: 500; }
.plans-table .date-stack {
  display: grid;
  gap: 2px;
  line-height: 1.3;
}
.plans-table .date-need {
  font-weight: 650;
  white-space: nowrap;
}
.plans-table .date-arrival .plan-val,
.plans-table .date-arrival .mono {
  white-space: nowrap;
  word-break: keep-all;
  font-size: 12px;
  padding: 0;
}
.plans-table .col-price {
  min-width: 108px;
  width: 118px;
  white-space: nowrap;
}
.plans-table .col-price .plan-price-edit,
.plans-table .col-price .mono {
  white-space: nowrap;
  word-break: keep-all;
  display: inline-block;
  max-width: none;
}
.plans-table .col-project {
  font-size: 12px;
  line-height: 1.45;
  min-width: 160px;
  max-width: 320px;
  word-break: break-word;
}
.plans-table .col-remark {
  font-size: 12px;
  line-height: 1.45;
  min-width: 180px;
  max-width: 260px;
  word-break: break-word;
  white-space: normal;
}
.plans-table .status-inline { min-width: 104px; }
.plans-table tr.row-pending > td { background: #e8c96a; color: #3d2e0a; }
.plans-table tr.row-inquiring > td { background: #6fa8d0; color: #10283a; }
.plans-table tr.row-won > td { background: #b48ad4; color: #2d1545; }
.plans-table tr.row-contract > td { background: #5cbc9d; color: #0d3a2e; }
.plans-table tr.row-done > td {
  background: #9fd6aa !important;
  color: #163f22;
  border-bottom-color: #7bb888;
}
.plans-table tr.row-skip > td { background: #d98989; color: #3a1212; }
.plans-table tr.row-pending > td .mat-name,
.plans-table tr.row-inquiring > td .mat-name,
.plans-table tr.row-won > td .mat-name,
.plans-table tr.row-contract > td .mat-name,
.plans-table tr.row-done > td .mat-name,
.plans-table tr.row-skip > td .mat-name { color: inherit; font-weight: 700; }
.plans-table tr.row-pending > td .muted,
.plans-table tr.row-pending > td .mat-code { color: #6a5220; }
.plans-table tr.row-inquiring > td .muted,
.plans-table tr.row-inquiring > td .mat-code { color: #1f4560; }
.plans-table tr.row-won > td .muted,
.plans-table tr.row-won > td .mat-code { color: #4a2a6a; }
.plans-table tr.row-contract > td .muted,
.plans-table tr.row-contract > td .mat-code { color: #1a5a48; }
.plans-table tr.row-skip > td .muted,
.plans-table tr.row-skip > td .mat-code { color: #6a2a2a; }
.plans-table tr.row-done > td .muted,
.plans-table tr.row-done > td .mat-code { color: #2f6a3d; }
.plans-table tr.row-done > td .mono { color: #1d4e2a; }
.plans-table tr.row-pending > td input,
.plans-table tr.row-pending > td select,
.plans-table tr.row-inquiring > td input,
.plans-table tr.row-inquiring > td select,
.plans-table tr.row-won > td input,
.plans-table tr.row-won > td select,
.plans-table tr.row-contract > td input,
.plans-table tr.row-contract > td select,
.plans-table tr.row-skip > td input,
.plans-table tr.row-skip > td select,
.plans-table tr.row-done > td input,
.plans-table tr.row-done > td select {
  background: #ffffff;
  color: #0b1f2a;
}
.plans-table tr.row-done > td .status-inline.pill-completed,
.plans-table tr.row-done > td .plan-status-edit.pill-completed {
  background: #6fb87d;
  color: #14361c;
  border-color: #5aa56a;
}
.plans-table tr.row-pending:hover > td { background: #dfbd58; }
.plans-table tr.row-inquiring:hover > td { background: #609bc4; }
.plans-table tr.row-won:hover > td { background: #a87ac8; }
.plans-table tr.row-contract:hover > td { background: #4aaf90; }
.plans-table tr.row-skip:hover > td { background: #cd7878; }
.plans-table tr.row-done:hover > td { background: #8ec99b !important; }
.arrival-inline-form { margin: 0; }
.arrival-inline {
  width: 138px; max-width: 100%;
  font-size: 12px; padding: 4px 6px;
}
.category-inline {
  width: auto; min-width: 96px; max-width: 120px;
  font-size: 12px; padding: 4px 6px;
}
.batch-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 12px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: rgba(255,255,255,0.7);
}
.batch-bar select { width: auto; min-width: 120px; }
.batch-bar input[type="date"] { width: auto; min-width: 140px; }
.batch-bar .batch-note-input {
  width: 160px;
  min-width: 120px;
  max-width: 220px;
}
.filter-grid {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  margin-bottom: 10px;
  align-items: end;
}
.filter-grid .span-2 { grid-column: span 2; }
.filter-actions { display: flex; flex-direction: column; min-width: 0; }
.filter-actions-btns {
  display: flex; flex-wrap: nowrap; gap: 8px; align-items: center;
}
.filter-actions-btns .btn,
.filter-actions-btns button {
  white-space: nowrap;
}
.note-inline { width: 100%; min-width: 100px; font-size: 12px; padding: 4px 6px; }
.price-inline-form { margin: 0; }
.price-inline {
  width: 88px;
  min-width: 72px;
  padding: 4px 6px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.rate-inline { width: 64px; min-width: 52px; }

/* 点击修改：含税单价 / 税率 / 采购备注（对齐合同台账 pay-edit） */
.plans-table .plan-edit-cell { white-space: nowrap; }
.plans-table .plan-note-cell { white-space: normal; min-width: 160px; max-width: 280px; }
.plans-table .plan-val {
  font-variant-numeric: tabular-nums;
  font-weight: 560;
  border: none;
  background: transparent;
  padding: 2px 4px;
  margin: 0;
  color: inherit;
  cursor: pointer;
  text-align: left;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.35;
  max-width: 100%;
  word-break: break-word;
  white-space: normal;
}
.plans-table .plan-val:hover {
  background: rgba(30, 90, 120, 0.12);
  text-decoration: underline;
}
.plans-table .plan-val.is-empty {
  color: var(--muted);
  font-weight: 500;
}
/* 到货数量配色：须压过 .plan-val { color: inherit } */
.plans-table .plan-val.qty-arrival-zero,
.plans-table .qty-arrival-zero {
  color: #8a9aa3;
  font-weight: 500;
}
.plans-table .plan-val.qty-arrival-partial,
.plans-table .qty-arrival-partial {
  color: #c62828;
  font-weight: 650;
}
.plans-table .plan-val.qty-arrival-full,
.plans-table .qty-arrival-full {
  color: #0b5d1e;
  font-weight: 700;
}
.plans-table .plan-input {
  width: 108px;
  padding: 2px 6px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.plans-table .plan-input-rate { width: 64px; }
.plans-table .plan-input-note {
  width: 100%;
  min-width: 140px;
  max-width: 240px;
}
.plans-table .plan-input-date { width: 138px; }
.plans-table .plan-input-cat { width: 118px; min-width: 108px; }
.plans-table .plan-input-status { width: 118px; min-width: 108px; }
.plans-table .plan-input-planner { width: 118px; min-width: 108px; }
.plans-table .plan-planner-edit,
.plans-table td.plan-edit-cell:has(.plan-planner-edit) {
  white-space: nowrap;
  word-break: keep-all;
}
.plans-table .plan-status-edit.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  word-break: keep-all;
}
.plans-table .plan-status-edit.pill:hover {
  filter: brightness(0.96);
  text-decoration: none;
}
.plans-table .plan-cat-edit,
.plans-table .pill-cat {
  font-weight: 600;
  white-space: nowrap;
  word-break: keep-all;
  display: inline-block;
}
.import-drop {
  border: 1.5px dashed rgba(30,90,120,0.35);
  border-radius: 12px;
  padding: 28px 16px;
  text-align: center;
  background: rgba(255,255,255,0.65);
  margin-bottom: 16px;
}
.import-drop input[type=file] { max-width: 100%; }

.plans-table .note-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.plans-table .note-row .plan-note-edit,
.plans-table .note-row .plan-note-text {
  flex: 1 1 auto;
  min-width: 0;
}
.plans-table .skip-evidence-box {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}
.plans-table .skip-evidence-box[hidden] { display: none !important; }
.plans-table .skip-evidence-btn {
  padding: 3px 8px;
  font-size: 12px;
  white-space: nowrap;
}
.skip-evidence-meta {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(30,90,120,0.06);
  font-size: 13px;
  line-height: 1.5;
}
.skip-evidence-upload-form {
  margin-bottom: 12px;
}
.skip-evidence-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  max-height: min(55vh, 480px);
  overflow: auto;
}
.skip-evidence-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  display: grid;
  gap: 8px;
}
.skip-evidence-item-meta {
  display: grid;
  gap: 2px;
}
.skip-evidence-item .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.skip-evidence-thumb {
  display: block;
  max-width: 220px;
}
.skip-evidence-thumb img {
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f7fafc;
}
