:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fafd;
  --border: #e6eaf2;
  --border-strong: #d8deea;
  --text: #1b2436;
  --text-soft: #475267;
  --muted: #7c8699;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eaf1ff;
  --green: #15803d;
  --green-soft: #e8f7ee;
  --red: #dc2626;
  --red-soft: #fdecec;
  --amber: #c2410c;
  --amber-soft: #fff4e5;
  --purple: #7c3aed;
  --purple-soft: #f1eaff;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

svg {
  flex: none;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

#app {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */

.sidebar {
  width: 228px;
  flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px 24px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 19px;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.28);
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  padding: 5px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

.brand-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-company {
  margin: -14px 6px 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--text-soft);
  white-space: nowrap;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-soft);
  font-size: 13.5px;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  color: #8b95a8;
}

.nav-item:hover {
  background: #f5f7fc;
  color: var(--text);
}

.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.nav-item.active svg {
  color: var(--primary);
}

.sidebar-foot {
  margin-top: auto;
  padding: 16px 8px 4px;
  border-top: 1px solid var(--border);
}

.today {
  font-size: 12px;
  color: var(--text-soft);
  font-weight: 600;
}

.version {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}

/* ---------- Main ---------- */

.main {
  flex: 1;
  min-width: 0;
  padding: 26px 32px 56px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.topbar-title h1 {
  margin: 0;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.topbar-title p {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------- Stats ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.stat-card {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 17px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

button.stat-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}

.stat-card.selected {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1), var(--shadow-sm);
}

.stat-card.static {
  cursor: default;
}

.stat-icon {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 11px;
  display: grid;
  place-items: center;
}

.stat-icon svg {
  width: 20px;
  height: 20px;
}

.stat-icon.blue {
  background: var(--primary-soft);
  color: var(--primary);
}

.stat-icon.amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.stat-icon.red {
  background: var(--red-soft);
  color: var(--red);
}

.stat-icon.green {
  background: var(--green-soft);
  color: var(--green);
}

.stat-body {
  min-width: 0;
}

.stat-label {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}

.stat-value {
  font-size: 27px;
  line-height: 1.25;
  font-weight: 700;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.stat-value.small {
  font-size: 21px;
  padding-top: 4px;
}

.stat-hint {
  font-size: 11px;
  color: #9aa3b5;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Panel & toolbar ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.search-box {
  position: relative;
  width: min(340px, 42vw);
}

.search-box svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: #9aa3b5;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.search-box input::placeholder {
  color: #a3abbb;
}

.select {
  height: 36px;
  padding: 0 30px 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237c8699' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 10px center;
  appearance: none;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.toolbar-spacer {
  flex: 1;
}

.result-count {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.quick-filter-bar {
  padding: 10px 16px;
  background: #fbfcff;
  border-bottom: 1px solid var(--border);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 600;
}

.filter-chip button {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 15px;
  line-height: 1;
  padding: 0;
  opacity: 0.65;
}

.filter-chip button:hover {
  opacity: 1;
}

.bulk-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 9px 16px;
  background: #f5f9ff;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 12.5px;
}

.bulk-select {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.bulk-count {
  color: var(--primary-dark);
  font-weight: 600;
  white-space: nowrap;
}

.bulk-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.row-check {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--primary);
  vertical-align: middle;
  cursor: pointer;
}

.data-table .select-col {
  width: 38px;
  padding-right: 4px;
  padding-left: 12px;
  text-align: center;
}

.data-table:not(.has-select) .select-col {
  display: none;
}

.data-table tbody tr.row-selected td {
  background: #f2f7ff;
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1080px;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 13px;
  background: #fafbfe;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 12px 13px;
  border-bottom: 1px solid #f0f3f8;
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr {
  transition: background 0.12s;
}

.data-table tbody tr:hover {
  background: #fafcff;
}

.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.data-table .actions-col {
  text-align: right;
  width: 148px;
}

.order-no {
  border: none;
  background: transparent;
  padding: 0;
  color: var(--primary);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.order-no:hover {
  text-decoration: underline;
}

.supplier-name {
  font-weight: 600;
  color: var(--text);
}

.cell-sub {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 1px;
}

.cell-sub.ok {
  color: var(--green);
}

.cell-sub.warn {
  color: var(--amber);
}

.delivered-cell {
  color: var(--green);
  font-weight: 600;
}

.open-cell {
  color: var(--amber);
  font-weight: 600;
}

.open-cell.done {
  color: var(--green);
}

.delivery-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.delivery-note-field {
  flex: 1;
  min-width: 200px;
}

.delivery-input {
  width: 120px;
  text-align: right;
}

.delivery-history {
  margin-top: 14px;
}

.delivery-history h4 {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.delivery-log {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 12.5px;
  background: var(--surface-soft);
}

.delivery-log-date {
  flex: none;
  color: var(--muted);
}

.delivery-log-item {
  font-weight: 600;
  white-space: nowrap;
}

.delivery-log-note {
  flex: 1;
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delivery-log .icon-btn {
  margin-left: auto;
  flex: none;
}

.cell-items {
  max-width: 230px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-soft);
}

.money {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.row-actions {
  display: flex;
  gap: 2px;
  justify-content: flex-end;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #8b95a8;
  display: inline-grid;
  place-items: center;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.icon-btn:hover {
  background: #f1f5fc;
  border-color: var(--border);
  color: var(--text-soft);
}

.icon-btn.danger:hover {
  background: var(--red-soft);
  border-color: #f8d5d5;
  color: var(--red);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.75;
}

.badge.neutral {
  background: #f1f3f9;
  color: #5b6478;
}

.badge.info {
  background: var(--primary-soft);
  color: var(--primary);
}

.badge.purple {
  background: var(--purple-soft);
  color: var(--purple);
}

.badge.success,
.badge.ok {
  background: var(--green-soft);
  color: var(--green);
}

.badge.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.danger {
  background: var(--red-soft);
  color: var(--red);
}

.badge.muted {
  background: #f3f4f6;
  color: #8b93a3;
}

.progress-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-inline .bar {
  width: 64px;
  height: 6px;
  border-radius: 999px;
  background: #edf1f8;
  overflow: hidden;
}

.progress-inline .bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
  transition: width 0.25s;
}

.progress-inline em {
  font-style: normal;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 32px;
}

.row-overdue td:first-child {
  box-shadow: inset 3px 0 0 #ef4444;
}

.empty-state {
  padding: 64px 24px;
  text-align: center;
}

.empty-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: #f2f5fb;
  color: #9aa6bb;
  display: grid;
  place-items: center;
}

.empty-icon svg {
  width: 26px;
  height: 26px;
}

.empty-state h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.empty-state p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.22);
}

.btn.primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn.ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-soft);
}

.btn.ghost:hover:not(:disabled) {
  background: #f6f8fc;
  color: var(--text);
}

.btn.soft {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.btn.soft:hover:not(:disabled) {
  background: #dfe9ff;
}

.btn.success {
  background: var(--green-soft);
  color: var(--green);
  border-color: #cdebd8;
}

.btn.success:hover:not(:disabled) {
  background: #d7f1e1;
}

.btn.danger-ghost {
  background: transparent;
  border-color: #f3dada;
  color: var(--red);
}

.btn.danger-ghost:hover:not(:disabled) {
  background: var(--red-soft);
}

.btn.small {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 8px;
}

.btn.full {
  width: 100%;
}

/* ---------- Forms ---------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.form-grid .span-2 {
  grid-column: span 2;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
}

.field > span em,
.items-head em,
.items-table th em {
  color: var(--red);
  font-style: normal;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field textarea {
  resize: vertical;
  min-height: 64px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.field input::placeholder,
.field textarea::placeholder {
  color: #a7aebe;
}

.inline-field {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-field select {
  flex: 1;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.hint {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

/* ---------- Settings ---------- */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.settings-card {
  overflow: visible;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 20px 0;
}

.panel-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.panel-head p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.panel-body {
  padding: 18px 20px 20px;
}

.tips {
  margin: 0;
  padding-left: 18px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.9;
}

/* ---------- Modals ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.modal-card {
  position: relative;
  width: min(660px, calc(100vw - 32px));
  max-height: min(90vh, 940px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-card.wide {
  width: min(960px, calc(100vw - 32px));
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 19px 22px 15px;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.modal-sub {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.foot-spacer {
  flex: 1;
}

/* ---------- Order form ---------- */

.items-editor {
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.items-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
}

.items-head h3 {
  margin: 0;
  font-size: 13.5px;
}

.items-table-wrap {
  overflow-x: auto;
}

.items-table {
  width: 100%;
  min-width: 1060px;
  border-collapse: collapse;
}

.items-table th {
  padding: 8px 10px;
  background: #fcfdff;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.items-table td {
  padding: 7px 8px;
  border-bottom: 1px solid #f2f4f9;
  vertical-align: middle;
}

.items-table tbody tr:last-child td {
  border-bottom: none;
}

.items-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 13px;
  color: var(--text-soft);
}

.items-table th:nth-child(1) {
  width: 20%;
}

.items-table th:nth-child(2) {
  width: 14%;
}

.items-table th:nth-child(3) {
  width: 14%;
}

.items-table th:nth-child(4) {
  width: 6%;
}

.items-table th:nth-child(5) {
  width: 12%;
}

.items-table th:nth-child(6),
.items-table th:nth-child(7) {
  width: 9%;
}

.items-table th:nth-child(8) {
  width: 10%;
}

.cell-date {
  min-width: 128px;
  padding: 0 6px;
}

.delivery-range {
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--text-soft);
}

.cell-input {
  width: 100%;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.cell-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.cell-input::placeholder {
  color: #a7aebe;
}

.order-total-line {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding: 13px 16px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.order-total-line > span:first-child {
  color: var(--muted);
  font-size: 12.5px;
}

.order-total-line strong {
  font-size: 20px;
  color: var(--primary-dark);
  font-variant-numeric: tabular-nums;
}

.total-upper {
  color: var(--muted);
  font-size: 12px;
}

/* ---------- Detail ---------- */

.detail-head-main {
  min-width: 0;
}

.detail-title-line {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.info-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 14px 16px;
}

.info-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.4px;
  margin-bottom: 10px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}

.info-row {
  min-width: 0;
}

.info-row > span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.info-row > div {
  font-size: 13px;
  margin-top: 1px;
  word-break: break-all;
}

.detail-section {
  margin-top: 20px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.section-head h3 {
  margin: 0;
  font-size: 14px;
}

.section-head > span {
  font-size: 12px;
  color: var(--muted);
}

.table-wrap.bordered {
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.data-table.compact {
  min-width: 620px;
}

.data-table.compact th {
  background: var(--surface-soft);
  font-size: 11.5px;
}

.data-table.compact td {
  font-size: 12.5px;
  padding: 9px 11px;
}

.data-table.compact tfoot td {
  background: #fbfcff;
  font-weight: 600;
}

.note-box {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  padding: 11px 14px;
  border-radius: var(--radius);
  background: #fffbf2;
  border: 1px solid #f4e8cf;
  font-size: 12.5px;
}

.note-box > span {
  color: #a16207;
  font-weight: 600;
  flex: none;
}

.note-box p {
  margin: 0;
  color: var(--text-soft);
}

.feedback-table {
  margin-top: 10px;
}

.confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

#feedbackItemsBody input {
  width: 100%;
  min-width: 100px;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  outline: none;
}

#feedbackItemsBody input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.progress-panel {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.progress-pct {
  font-size: 18px;
  color: var(--primary-dark);
  font-variant-numeric: tabular-nums;
}

.progress-big {
  height: 9px;
  border-radius: 999px;
  background: #e8edf6;
  overflow: hidden;
}

.progress-big span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
  transition: width 0.3s;
}

.progress-form {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 2fr auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
}

.progress-form .field > span {
  font-size: 11.5px;
}

.progress-form .field input,
.progress-form .field select {
  min-height: 35px;
  height: 35px;
  padding: 0 10px;
  font-size: 12.5px;
}

.progress-form .btn {
  height: 35px;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.timeline {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-strong);
  max-height: 210px;
  overflow-y: auto;
}

.timeline-item {
  position: relative;
  display: flex;
  gap: 11px;
  padding-left: 4px;
  padding-bottom: 13px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item .dot {
  width: 8px;
  height: 8px;
  flex: none;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.timeline-time {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.timeline-text {
  font-size: 12.5px;
  color: var(--text-soft);
  margin-top: 1px;
  word-break: break-word;
}

/* ---------- Login ---------- */

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(1200px 600px at 20% 10%, #dbeafe 0, transparent 55%),
    radial-gradient(900px 500px at 85% 90%, #e0e7ff 0, transparent 50%), #eef2f9;
}

.login-card {
  width: min(360px, calc(100vw - 32px));
  padding: 32px 28px 28px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-mark {
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.3);
}

.login-logo {
  display: block;
  width: 190px;
  max-width: 100%;
  height: auto;
  margin: 0 auto 12px;
}

.portal-login-logo {
  width: 210px;
}

.login-card h2 {
  margin: 0;
  font-size: 18px;
}

.login-card > p {
  margin: 5px 0 20px;
  color: var(--muted);
  font-size: 12.5px;
}

.login-card input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-card input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.login-card .btn {
  margin-top: 12px;
  height: 42px;
}

.login-error {
  min-height: 18px;
  margin-top: 7px;
  color: var(--red);
  font-size: 12px;
  text-align: left;
}

/* ---------- Toast ---------- */

.toast-wrap {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}

.toast {
  min-width: 220px;
  max-width: 380px;
  padding: 11px 15px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  color: var(--text-soft);
  display: flex;
  align-items: flex-start;
  gap: 9px;
  animation: toast-in 0.22s ease-out;
}

.toast::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--green);
}

.toast.error::before {
  background: var(--red);
}

.toast.warning::before {
  background: var(--amber);
}

.toast.leaving {
  animation: toast-out 0.2s ease-in forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(14px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(14px);
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .progress-form {
    grid-template-columns: 1fr 1fr;
  }

  .progress-form .progress-note {
    grid-column: span 2;
  }

  .progress-form .btn {
    grid-column: span 2;
    justify-self: start;
  }
}

@media (max-width: 900px) {
  #app {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    padding: 12px 16px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    gap: 16px;
  }

  .brand {
    padding: 0;
  }

  .brand-sub,
  .brand-company,
  .sidebar-foot {
    display: none;
  }

  .nav {
    flex-direction: row;
    margin-left: auto;
  }

  .nav-item {
    width: auto;
    padding: 8px 11px;
  }

  .nav-item span {
    display: none;
  }

  .main {
    padding: 20px 16px 44px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .detail-meta {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
}

@media (max-width: 620px) {
  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 13px;
    gap: 10px;
  }

  .stat-icon {
    width: 34px;
    height: 34px;
  }

  .stat-value {
    font-size: 22px;
  }

  .stat-value.small {
    font-size: 17px;
  }

  .stat-hint {
    display: none;
  }

  .toolbar {
    flex-wrap: wrap;
  }

  .bulk-actions {
    width: 100%;
    margin-left: 0;
  }

  .search-box {
    width: 100%;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .span-2 {
    grid-column: span 1;
  }

  .progress-form {
    grid-template-columns: 1fr;
  }

  .progress-form .progress-note,
  .progress-form .btn {
    grid-column: span 1;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    padding: 10px;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-head,
  .modal-foot {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* ---------- Print ---------- */

#printArea {
  display: none;
}

/* 打印样式未放在 @media print 内：屏幕上隐藏，但打印前需按真实宽度测量高度，
   以便内容过多时自动缩放，保证始终只占一张 A4 纸 */
.print-sheet {
  width: 182mm;
  font-family: "SimSun", "Songti SC", "Microsoft YaHei", serif;
  color: #000;
  font-size: 12px;
  line-height: 1.6;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

  .print-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
  }

  .print-company-name {
    font-family: "SimHei", "Microsoft YaHei", sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
  }

  .print-logo {
    display: block;
    width: 46mm;
    height: auto;
  }

  .print-confirm {
    margin-top: 12px;
    padding: 6px 10px 9px;
    border: 1px solid #000;
    font-size: 11.5px;
    line-height: 1.75;
  }

  .print-confirm-head {
    font-weight: 700;
  }

  .print-choice {
    margin-left: 18px;
    font-weight: 400;
    letter-spacing: 1px;
  }

  .print-confirm-item {
    margin-top: 1px;
  }

  .print-confirm-feedback {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    margin-top: 2px;
  }

  .print-confirm-feedback i {
    flex: 1;
    height: 15px;
    border-bottom: 1px solid #000;
  }

  .print-company-meta {
    margin-top: 6px;
    font-size: 11px;
    color: #333;
    line-height: 1.7;
  }

  .print-title {
    text-align: right;
    flex: none;
  }

  .print-title h1 {
    margin: 0;
    font-family: "SimHei", "Microsoft YaHei", sans-serif;
    font-size: 25px;
    letter-spacing: 8px;
    line-height: 1.2;
  }

  .print-title div {
    margin-top: 3px;
    font-size: 9px;
    letter-spacing: 2.5px;
    color: #555;
  }

  .print-rule {
    height: 2px;
    background: #000;
    margin: 10px 0 14px;
  }

  .print-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 12px;
  }

  .print-block h3 {
    margin: 0 0 6px;
    padding-left: 6px;
    border-left: 3px solid #000;
    font-size: 13px;
    line-height: 1.3;
  }

  .print-line {
    display: flex;
    gap: 8px;
    font-size: 11.5px;
    line-height: 1.9;
    word-break: break-all;
  }

  .print-line > span {
    display: inline-block;
    min-width: 58px;
    color: #333;
    flex: none;
  }

  .print-items {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    margin-top: 4px;
  }

  .print-items th,
  .print-items td {
    border: 1px solid #000;
    padding: 5px 6px;
    font-size: 11.5px;
    vertical-align: middle;
    word-break: break-word;
  }

  .print-items th:nth-child(1) { width: 6%; }
  .print-items th:nth-child(2) { width: 21%; }
  .print-items th:nth-child(3) { width: 17%; }
  .print-items th:nth-child(4) { width: 6%; }
  .print-items th:nth-child(5) { width: 12%; }
  .print-items th:nth-child(6) { width: 9%; }
  .print-items th:nth-child(7) { width: 12%; }
  .print-items th:nth-child(8) { width: 17%; }

  .print-items th {
    background: #f2f2f2;
    font-weight: 700;
  }

  .print-items thead {
    display: table-header-group;
  }

  .print-items tr {
    break-inside: avoid;
  }

  .print-items .c {
    text-align: center;
  }

  .print-items .r {
    text-align: right;
  }

  .print-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid #000;
    border-top: none;
    padding: 7px 8px;
    font-size: 11.5px;
  }

  .print-total-small {
    white-space: nowrap;
    font-weight: 700;
  }

  .print-notes {
    margin-top: 10px;
    font-size: 11.5px;
    min-height: 20px;
    word-break: break-word;
  }

  .print-sign {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 26px 42px;
    margin-top: 42px;
    font-size: 12px;
  }

  .print-sign-item {
    display: flex;
    align-items: flex-end;
    gap: 6px;
  }

  .print-sign-item > span {
    flex: none;
  }

  .sign-line {
    flex: 1;
    border-bottom: 1px solid #000;
    height: 18px;
  }

  .print-footer {
    margin-top: 26px;
    padding-top: 8px;
    border-top: 1px dashed #999;
    font-size: 10px;
    color: #555;
    text-align: center;
  }

@media print {
  @page {
    size: A4 portrait;
    margin: 12mm 14mm;
  }

  html,
  body {
    background: #fff !important;
    overflow: visible !important;
    height: auto !important;
  }

  #app,
  .modal,
  .login-overlay,
  .toast-wrap {
    display: none !important;
  }

  #printArea {
    display: block;
  }
}

/* ---------- 供应商门户 ---------- */

.login-card input + input {
  margin-top: 10px;
}

.login-switch {
  margin-top: 14px;
  font-size: 13px;
}

.login-switch a {
  color: var(--primary);
  text-decoration: none;
}

.login-switch a:hover {
  text-decoration: underline;
}

.portal-login-mark {
  background: linear-gradient(135deg, #22c55e, #15803d);
  box-shadow: 0 8px 18px rgba(21, 128, 61, 0.3);
}

#portal {
  min-height: 100vh;
}

.portal-top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.portal-mark {
  background: linear-gradient(135deg, #22c55e, #15803d);
  box-shadow: 0 6px 14px rgba(21, 128, 61, 0.28);
}

.portal-title {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portal-sub {
  font-size: 12px;
  color: var(--muted);
}

.portal-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  flex: none;
}

.portal-user strong {
  color: var(--text);
  font-size: 14px;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portal-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 24px 64px;
}

.portal-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.portal-head h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.portal-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.portal-actions {
  display: flex;
  gap: 8px;
  flex: none;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.portal-main .panel {
  margin-top: 18px;
}

#portal #ordersTable th:nth-child(4),
#portal #ordersTable td:nth-child(4) {
  white-space: nowrap;
}

@media (max-width: 720px) {
  .portal-top {
    padding: 10px 14px;
    flex-wrap: wrap;
  }

  .portal-main {
    padding: 16px 12px 48px;
  }

  .portal-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .portal-user {
    width: 100%;
    justify-content: flex-end;
  }
}

/* 供应商打印：增加已交/未交两列 */
.print-items.with-delivery th:nth-child(1) { width: 6%; }
.print-items.with-delivery th:nth-child(2) { width: 16%; }
.print-items.with-delivery th:nth-child(3) { width: 12%; }
.print-items.with-delivery th:nth-child(4) { width: 6%; }
.print-items.with-delivery th:nth-child(5) { width: 13%; }
.print-items.with-delivery th:nth-child(6) { width: 9%; }
.print-items.with-delivery th:nth-child(7) { width: 8%; }
.print-items.with-delivery th:nth-child(8) { width: 8%; }
.print-items.with-delivery th:nth-child(9) { width: 9%; }
.print-items.with-delivery th:nth-child(10) { width: 13%; }

@media print {
  #portal,
  .portal-top,
  .portal-main {
    display: none !important;
  }
}

/* 供应商登录账号设置（管理员端） */
.login-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-strong);
}

.login-section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.login-section-head span {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.login-section-head small {
  font-size: 12px;
  color: var(--muted);
}

.field-hint {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  word-break: break-all;
}

.drawing-link {
  margin-left: 6px;
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}

.drawing-link:hover {
  text-decoration: underline;
}

/* ---------- 数据备份列表 ---------- */
.backup-meta {
  margin: 14px 0 10px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--muted);
}

.backup-wrap {
  margin-top: 4px;
}

.backup-wrap .data-table td {
  vertical-align: middle;
}

.backup-wrap .row-actions {
  gap: 6px;
}

/* ---------- 登录账号与操作日志 ---------- */

.signed-user {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-soft);
}

.signed-user strong {
  color: var(--text);
}

.signed-user-sub {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.logout-btn {
  width: 100%;
  margin-top: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 12px;
  color: var(--text-soft);
}

.logout-btn:hover {
  color: var(--red);
  border-color: var(--red);
  background: var(--red-soft);
}

.audit-time-col {
  width: 168px;
  white-space: nowrap;
}

.audit-user-col {
  width: 110px;
}

.audit-action-col {
  width: 130px;
}

.audit-detail {
  color: var(--text-soft);
  line-height: 1.6;
  word-break: break-word;
}

#auditTable td {
  vertical-align: top;
}

/* ---------- 订单管理：供应商文件夹 ---------- */

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  padding: 16px;
}

.supplier-folder {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.supplier-folder:hover {
  border-color: #b9ccf7;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.1);
  transform: translateY(-1px);
}

.supplier-folder:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.25);
  outline-offset: 2px;
}

.supplier-folder.has-overdue {
  border-left: 3px solid #ef4444;
}

.supplier-folder.has-due {
  border-left: 3px solid #f59e0b;
}

.supplier-folder.all-orders {
  background: linear-gradient(135deg, #eff5ff, #f8fbff);
  border-color: #cfe0ff;
}

.supplier-folder.all-orders .folder-icon {
  background: var(--primary);
  color: #fff;
}

.folder-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  flex: none;
}

.folder-icon svg {
  width: 24px;
  height: 24px;
}

.folder-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.folder-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-sub {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-soft);
}

.folder-meta .ok {
  color: var(--green);
}

.folder-meta .danger {
  color: var(--red);
}

.folder-meta .warn {
  color: var(--amber);
}

.folder-arrow {
  flex: none;
  color: #9aa3b5;
  font-size: 22px;
  line-height: 1;
}

.order-folder-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fbfcff, #fff);
  flex-wrap: wrap;
}

.folder-head-info {
  flex: 1;
  min-width: 160px;
}

.folder-head-title {
  font-size: 15px;
  font-weight: 600;
}

.folder-head-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

#orderListPanel.supplier-scope #ordersTable {
  table-layout: fixed;
  min-width: 818px;
}

#orderListPanel.supplier-scope #ordersTable th:nth-child(3),
#orderListPanel.supplier-scope #ordersTable td:nth-child(3),
#orderListPanel.supplier-scope #ordersTable th:nth-child(6),
#orderListPanel.supplier-scope #ordersTable td:nth-child(6) {
  display: none;
}

#orderListPanel.supplier-scope #ordersTable td {
  overflow: hidden;
}

#orderListPanel.supplier-scope #ordersTable th:nth-child(2) {
  width: 142px;
}

#orderListPanel.supplier-scope #ordersTable th:nth-child(5) {
  width: 92px;
}

#orderListPanel.supplier-scope #ordersTable th:nth-child(7) {
  width: 120px;
}

#orderListPanel.supplier-scope #ordersTable td:nth-child(7) {
  white-space: nowrap;
}

#orderListPanel.supplier-scope #ordersTable th:nth-child(8) {
  width: 112px;
}

#orderListPanel.supplier-scope #ordersTable th:nth-child(9) {
  width: 96px;
}

#orderListPanel.supplier-scope #ordersTable th:nth-child(10) {
  width: 84px;
}

#orderListPanel.supplier-scope #ordersTable th:nth-child(11) {
  width: 132px;
}

/* ---------- Excel 导入 ---------- */

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.muted-row td {
  opacity: 0.6;
}

.order-no-text {
  font-weight: 600;
  word-break: break-all;
}

.import-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.import-summary > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafbfe;
}

.import-summary strong {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.import-summary span {
  color: var(--muted);
  font-size: 12px;
}

.import-file {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}

.import-tip {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: #1e4fa8;
  font-size: 12.5px;
  line-height: 1.65;
}

.import-warning {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #f5d9a8;
  border-radius: 10px;
  background: #fff9ec;
  color: #8a5c10;
  font-size: 12.5px;
}

.import-warning ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.import-warning li {
  margin: 2px 0;
}

.import-table-wrap {
  max-height: 46vh;
  overflow: auto;
}

.import-table-wrap table {
  min-width: 720px;
}

.import-error {
  padding: 28px 20px;
  border-radius: 12px;
  background: var(--red-soft);
  color: var(--red);
  text-align: center;
  font-size: 13px;
  line-height: 1.7;
}

.import-loading {
  padding: 42px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.price-import-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.price-import-text {
  width: 100%;
  min-height: 150px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  font-family: Consolas, "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.65;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.price-import-text:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.price-import-text::placeholder {
  color: #a7aebe;
}

.price-import-changes {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

/* ---------- Excel 明细视图 ---------- */

.view-toggle {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #eef2f8;
}

.view-btn {
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 12.5px;
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}

.view-btn:hover {
  color: var(--primary-dark);
}

.view-btn.active {
  background: var(--surface);
  color: var(--primary-dark);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.excel-table {
  min-width: 1193px;
  table-layout: fixed;
}

.excel-table td {
  white-space: nowrap;
}

.excel-table th:nth-child(2),
.excel-table td:nth-child(2) {
  width: 130px;
}

.excel-table th:nth-child(3),
.excel-table td:nth-child(3),
.excel-table th:nth-child(4),
.excel-table td:nth-child(4) {
  width: 92px;
}

.excel-table th:nth-child(5),
.excel-table td:nth-child(5) {
  width: 165px;
}

.excel-table th:nth-child(6),
.excel-table td:nth-child(6),
.excel-table th:nth-child(7),
.excel-table td:nth-child(7) {
  width: 190px;
}

.excel-table th:nth-child(8),
.excel-table td:nth-child(8) {
  width: 52px;
}

.excel-table th:nth-child(9),
.excel-table td:nth-child(9) {
  width: 80px;
}

.excel-table th:nth-child(10),
.excel-table td:nth-child(10) {
  width: 84px;
}

.excel-table th:nth-child(11),
.excel-table td:nth-child(11) {
  width: 80px;
}

.excel-table td:nth-child(5),
.excel-table td:nth-child(6),
.excel-table td:nth-child(7) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.excel-table tbody tr {
  cursor: pointer;
}

.excel-table .cell-code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  color: var(--text-soft);
}

.excel-table .remain-open {
  color: var(--amber);
  font-weight: 600;
}

.excel-table .remain-done {
  color: var(--green);
}

/* ---------- 邮件提醒 ---------- */

.settings-wide {
  grid-column: 1 / -1;
}

.email-test-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.email-test-row input {
  flex: 1;
  min-width: 240px;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.email-test-row input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.email-test-row input::placeholder {
  color: #a7aebe;
}

.email-result {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  font-size: 12.5px;
  line-height: 1.7;
  word-break: break-all;
}

.email-result.ok {
  border-color: #cdebd8;
  background: var(--green-soft);
  color: var(--green);
}

.email-result.error {
  border-color: #f3dada;
  background: var(--red-soft);
  color: var(--red);
}

.email-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 10px;
}

.email-log-head h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
}

.email-log-table {
  table-layout: fixed;
}

.email-log-table th:nth-child(1),
.email-log-table td:nth-child(1) {
  width: 142px;
}

.email-log-table th:nth-child(2),
.email-log-table td:nth-child(2) {
  width: 150px;
}

.email-log-table th:nth-child(3),
.email-log-table td:nth-child(3),
.email-log-table th:nth-child(4),
.email-log-table td:nth-child(4) {
  width: 180px;
}

.email-log-table th:nth-child(6),
.email-log-table td:nth-child(6) {
  width: 150px;
}

.email-time-cell {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.email-address-cell,
.email-subject-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-log-table td {
  vertical-align: top;
}

.email-log-error {
  margin-top: 4px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  color: var(--red);
}

.items-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.name-cell {
  display: flex;
  align-items: center;
  gap: 4px;
}

.name-cell .cell-input {
  flex: 1;
  min-width: 0;
}

.catalog-pick {
  flex: none;
  padding: 3px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--primary);
  font-size: 11.5px;
  line-height: 1.3;
  cursor: pointer;
}

.catalog-pick:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.model-text {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 12.5px;
  word-break: break-all;
}

.price-text {
  font-variant-numeric: tabular-nums;
}

.unpriced-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.cell-sub.unpriced {
  color: var(--amber);
}

.pager {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 12px 4px 2px;
}

.pager-info {
  font-size: 12.5px;
  color: var(--muted);
}

.picker-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.picker-toolbar .search-box {
  flex: 1;
}

.picker-table-wrap {
  max-height: 52vh;
  overflow: auto;
}

#productPickerBody tr {
  cursor: pointer;
}

@media (max-width: 720px) {
  .folder-grid {
    grid-template-columns: 1fr;
  }

  .order-folder-head {
    align-items: flex-start;
  }

  #folderNewOrderBtn,
  #folderImportBtn {
    width: 100%;
  }

  .view-toggle {
    width: 100%;
  }

  .view-toggle .view-btn {
    flex: 1;
  }

  .email-test-row input {
    min-width: 100%;
  }

  .email-test-row .btn {
    flex: 1;
  }

  .import-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 审批 / 价格查询 新增样式 */
.approval-notice {
  margin-bottom: 14px;
  padding: 11px 14px;
  border: 1px solid #f4e8cf;
  border-radius: var(--radius);
  background: #fffbf2;
  color: #8a5a08;
  font-size: 12.5px;
  line-height: 1.65;
}

.approval-notice strong {
  color: #7a4d05;
}

.info-card.approval-card {
  grid-column: 1 / -1;
}

.panel-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.price-query-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 4px 0 12px;
}

.price-query-input {
  display: flex;
  gap: 8px;
  flex: 0 1 520px;
  min-width: 0;
}

.price-query-input input {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  font-size: 13px;
}

.price-query-input input:focus {
  outline: 2px solid var(--primary-soft);
  border-color: var(--primary);
}

.price-query-result {
  font-size: 12.5px;
  color: var(--muted);
  min-width: 120px;
}

.price-query-result.ok {
  color: var(--green);
  font-weight: 600;
}

.price-query-result.error {
  color: var(--red);
}

.price-masked {
  color: var(--muted);
  letter-spacing: 2px;
  font-weight: 700;
}

.price-text.price-revealed {
  color: var(--primary);
}

.unpriced-tag.revealed-tag {
  background: var(--green-soft);
  color: var(--green);
}

tr.row-price-revealed td {
  background: #f2fbf5;
}

@media (max-width: 720px) {
  .price-query-input {
    flex: 1 1 100%;
  }

  .price-query-input .btn {
    flex: 0 0 auto;
  }
}
