:root {
  --bg: #f3f6f4;
  --panel: #ffffff;
  --ink: #14201b;
  --muted: #5b6b63;
  --line: #d7e2db;
  --accent: #0f766e;
  --accent-2: #115e59;
  --warn: #b45309;
  --danger: #b91c1c;
  --ok: #047857;
  --shadow: 0 10px 30px rgba(20, 32, 27, 0.08);
  --radius: 14px;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #d9f3ee 0%, transparent 55%),
    radial-gradient(900px 420px at 100% 0%, #e7eef8 0%, transparent 50%),
    var(--bg);
  min-height: 100vh;
}

.wrap { max-width: 980px; margin: 0 auto; padding: 28px 16px 48px; }
.hero { margin-bottom: 18px; }
.brand { font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
h1 { margin: 6px 0 8px; font-size: 28px; }
.sub { color: var(--muted); margin: 0; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-top: 16px;
}

.grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 720px) { .grid { grid-template-columns: 1fr; } }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input, select, textarea, button {
  font: inherit;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 72px; resize: vertical; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
.btn:hover { background: var(--accent-2); }
.btn.secondary { background: #e8f0ec; color: var(--ink); }
.btn.danger { background: var(--danger); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.msg {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #ecfdf5;
  color: var(--ok);
  display: none;
}
.msg.error { background: #fef2f2; color: var(--danger); display: block; }
.msg.show { display: block; }

.auth-boot-spinner {
  width: 28px;
  height: 28px;
  margin-top: 14px;
  border: 3px solid #d7e2db;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: auth-spin 0.8s linear infinite;
}
@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #eef2f0;
}
.badge.none { background: #eef2f0; color: #334155; }
.badge.requested { background: #fff7ed; color: var(--warn); }
.badge.issued { background: #ecfdf5; color: var(--ok); }
.badge.rejected { background: #fef2f2; color: var(--danger); }
.badge.new { background: #ecfeff; color: #0e7490; margin-left: 6px; }
.row-new { background: #ecfdf5; }
.row-new td { border-bottom-color: #a7f3d0; }
.progress-wrap { margin-top: 8px; max-width: 220px; }
.progress-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.progress-bar {
  height: 8px;
  background: #e8efeb;
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}
.progress-bar span.over { background: var(--warn); }

.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  cursor: pointer;
  margin-bottom: 0;
}
.check-label input { width: auto; }

.profile-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; max-height: 220px; overflow: auto; }
.profile-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8faf9;
}
.profile-item .title { font-weight: 600; }
.profile-item .row { margin-top: 8px; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

.hidden { display: none !important; }
.hint { font-size: 13px; color: var(--muted); margin-top: 8px; }
.hint.warn-hint { color: #be123c; font-weight: 600; }
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
  display: none; align-items: center; justify-content: center; padding: 16px; z-index: 20;
}
.modal-mask.show { display: flex; }
.modal {
  width: min(520px, 100%);
  background: #fff;
  border-radius: 14px;
  padding: 18px;
  border: 1px solid var(--line);
}
.preview-panel {
  width: min(920px, 100%);
  max-width: min(920px, 100%);
  max-height: min(92vh, 900px);
  overflow: auto;
  padding: 16px 18px 18px;
}
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.preview-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.preview-body { padding-top: 14px; }
.invoice-preview-frame {
  margin-top: 10px;
  min-height: 220px;
  max-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a0a;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.invoice-preview-frame--lg {
  min-height: 420px;
  max-height: min(70vh, 720px);
}
.invoice-preview-frame img {
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
  display: block;
}
.invoice-preview-frame--lg img {
  max-height: min(70vh, 720px);
}
.invoice-preview-frame iframe,
.invoice-preview-frame embed {
  width: 100%;
  height: 360px;
  border: 0;
  background: #fff;
}
.invoice-preview-frame--lg iframe,
.invoice-preview-frame--lg embed {
  height: min(70vh, 720px);
}
@media (max-width: 640px) {
  .invoice-preview-frame,
  .invoice-preview-frame iframe,
  .invoice-preview-frame embed {
    min-height: 180px;
    height: 220px;
    max-height: 240px;
  }
}

.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-tab {
  border: 1px solid var(--line);
  background: #f8faf9;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}
.filter-tab:hover { background: #eef6f2; }
.filter-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.pagination { justify-content: center; margin-top: 12px; }

.empty-state {
  margin-top: 14px;
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #f8faf9;
  text-align: center;
}
.empty-state a { color: var(--accent); font-weight: 600; }

.row-rejected { background: #fef2f2; }
.row-rejected td { border-bottom-color: #fecaca; }

.alert-box {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fef2f2;
  color: var(--danger);
  font-size: 13px;
  border: 1px solid #fecaca;
}

.btn-copy {
  margin-left: 6px;
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
  padding: 0 4px;
  text-decoration: underline;
}
.btn-copy:hover { color: var(--accent-2); }

.profile-item.is-default { border-color: var(--accent); background: #ecfdf5; }

/* 订单状态列 */
.status-cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 200px;
}
.status-cell .status-meta {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}
.status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.btn.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
}
.btn.linkish {
  background: transparent;
  color: var(--accent);
  padding: 6px 4px;
  text-decoration: underline;
  box-shadow: none;
}
.btn.linkish:hover {
  background: transparent;
  color: var(--accent-2);
}

.info-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8faf9;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.info-card .info-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  font-size: 14px;
  line-height: 1.4;
}
.info-card .info-row .k {
  color: var(--muted);
  font-size: 13px;
}
.info-card .info-row .v {
  color: var(--ink);
  word-break: break-all;
}
