/* ==========================================================================
   AI 视频 · 售前报价台   styles.css
   ========================================================================== */

:root {
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-2: #f1f2f4;
  --bg: #f5f6f8;
  --card: #ffffff;
  --brand: #141b2d;
  --accent: #ff5a1f;
  --accent-soft: #fff3ed;
  --accent-line: #ffc9b3;
  --ok: #047857;
  --ok-soft: #ecfdf5;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 4px 16px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 18px 48px rgba(16, 24, 40, 0.18);
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB",
    system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.hidden {
  display: none !important;
}

/* ------------------------------ 顶栏 ------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

.topbar-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 20px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ff7a3d, #ff3d00);
  display: grid;
  place-items: center;
  font-size: 15px;
  box-shadow: 0 2px 8px rgba(255, 90, 31, 0.45);
}

.brand small {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: #9aa3b5;
  letter-spacing: 1.4px;
  line-height: 1;
  margin-top: 3px;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}

.tab {
  border: 0;
  background: transparent;
  color: #b6bfd0;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  transition: 0.15s;
}

.tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.tab.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  font-weight: 600;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #b6bfd0;
}

.topbar-right select {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  padding: 6px 10px;
  border-radius: 7px;
  outline: none;
  cursor: pointer;
}

.topbar-right select option {
  color: var(--ink);
}

/* ------------------------------ 布局 ------------------------------ */

.wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px 20px 60px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 384px;
  gap: 20px;
  align-items: start;
}

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.section {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line-2);
}

.section:last-child {
  border-bottom: 0;
}

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

.section-head h2 {
  font-size: 14.5px;
  margin: 0;
  font-weight: 650;
  letter-spacing: 0.2px;
}

.section-head .step {
  font-size: 11px;
  color: #fff;
  background: var(--ink);
  width: 18px;
  height: 18px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.section-head .hint {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

/* ------------------------------ 选项 ------------------------------ */

.opt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(186px, 1fr));
  gap: 10px;
}

.opt {
  position: relative;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  padding: 11px 13px;
  cursor: pointer;
  transition: 0.14s;
}

.opt:hover {
  border-color: #cbd0d8;
  background: #fcfcfd;
}

.opt.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(255, 90, 31, 0.1);
}

.opt .t {
  font-weight: 600;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.opt .d {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.45;
}

.opt .p {
  margin-top: 7px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.tagchip {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  letter-spacing: 0.3px;
  vertical-align: 1px;
}

.opt:hover .tagchip {
  background: #1f2937;
}

.gift-chip {
  background: var(--ok, #15803d);
  color: #fff;
  white-space: nowrap;
}

.list-tools, .list-tools .pager, .list-tools .bulk-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.list-tools {
  justify-content: space-between;
  padding: 10px 0 0;
  font-size: 13px;
}
.list-tools input[type="number"] { width: 58px; }
.list-tools .bulk-tools label, .approval-pick { display: inline-flex; align-items: center; gap: 5px; }
.approval-pick { margin-right: 10px; }

.model-billing-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 12px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #e5b75c;
  border-left: 4px solid #ad670a;
  border-radius: 8px;
  background: #fff4d7;
  color: #503006;
  font-size: 13px;
}

.model-billing-note strong { font-size: 15px; }

.tiers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

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

/* 数字输入 */
.num-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field > label {
  font-size: 12px;
  color: var(--muted);
}

.field input[type="number"],
.field input[type="text"],
.field select,
.field textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  outline: none;
  background: #fff;
  transition: 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 90, 31, 0.12);
}

.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.stepper button {
  width: 34px;
  height: 36px;
  border: 0;
  background: #fafafa;
  cursor: pointer;
  font-size: 16px;
  color: var(--ink-2);
  line-height: 1;
}

.stepper button:hover {
  background: #f1f2f4;
}

.stepper input {
  width: 74px;
  height: 36px;
  border: 0;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: center;
  outline: none;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.chips {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
}

.chip:hover {
  border-color: #cbd0d8;
}

.chip.on {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

/* 复选行 */
.check-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 8px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 12px;
  cursor: pointer;
  background: #fff;
  transition: 0.14s;
}

.check:hover {
  border-color: #cbd0d8;
}

.check.on {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.check input {
  margin: 3px 0 0;
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  cursor: pointer;
}

.check .ct {
  font-size: 13px;
  font-weight: 550;
  line-height: 1.35;
}

.check .cd {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.4;
}

.check .cp {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
}

/* ------------------------------ 右侧结算 ------------------------------ */

.summary {
  position: sticky;
  top: 76px;
  overflow: hidden;
}

.summary-head {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.summary-head h3 {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.3px;
}

.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--line-2);
  color: var(--ink-2);
  font-weight: 600;
}

.total-box {
  padding: 18px 20px 16px;
  background: linear-gradient(180deg, #fffdfb, #fff8f4);
  border-bottom: 1px solid var(--line-2);
}

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

.total-box .amt {
  font-size: 42px;
  font-weight: 750;
  letter-spacing: -1.2px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  margin: 2px 0 4px;
}

.total-box .amt .cur {
  font-size: 21px;
  font-weight: 600;
  margin-right: 2px;
  vertical-align: 6px;
}

.total-box .sub {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

.total-box .sub b {
  color: var(--ink-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.margin-bar {
  padding: 12px 20px;
  border-bottom: 1px solid var(--line-2);
  background: #fbfcfd;
}

.margin-bar .row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.margin-bar .row b {
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.bar {
  height: 6px;
  background: var(--line-2);
  border-radius: 99px;
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--ok);
  transition: width 0.25s, background 0.25s;
}

.bar > i.warn {
  background: #f59e0b;
}

.bar > i.danger {
  background: var(--danger);
}

.warns {
  padding: 10px 14px 2px;
}

.warn-item {
  display: flex;
  gap: 8px;
  font-size: 12px;
  line-height: 1.5;
  padding: 7px 10px;
  border-radius: 8px;
  margin-bottom: 6px;
}

.warn-item.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.warn-item.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.warn-item.info {
  background: #eff6ff;
  color: #1d4ed8;
}

.summary-actions {
  padding: 14px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
  transition: 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.btn:hover {
  background: #fafafa;
  border-color: #cbd0d8;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 10px rgba(255, 90, 31, 0.28);
}

.btn.primary:hover {
  background: #f04e14;
}

.btn.dark {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.btn.dark:hover {
  background: #1f2937;
}

.btn.sm {
  padding: 6px 10px;
  font-size: 12.5px;
  font-weight: 500;
  border-radius: 7px;
}

.btn.danger-text {
  color: var(--danger);
}

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

/* 明细 */
.detail {
  border-top: 1px solid var(--line-2);
  padding: 12px 20px 4px;
  max-height: 320px;
  overflow: auto;
}

.detail.hidden {
  display: none;
}

.detail .line {
  display: flex;
  gap: 10px;
  font-size: 12.5px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line-2);
}

.detail .line:last-child {
  border-bottom: 0;
}

.detail .line .n {
  color: var(--ink-2);
}

.detail .line .a {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

.detail .line.free .a {
  color: var(--muted);
  font-weight: 500;
}

.toggle-detail {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 8px 20px;
  text-align: left;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.toggle-detail:hover {
  color: var(--ink);
}

/* ------------------------------ 记录页 ------------------------------ */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.stat .k {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.stat .v {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.stat .s {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 1px;
}

.stat .v.ok {
  color: var(--ok);
}

.stat .v.warn {
  color: var(--warn);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-2);
  flex-wrap: wrap;
}

.panel-head h2 {
  font-size: 14px;
  margin: 0;
  font-weight: 650;
}

.panel-head .right {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.panel-head select {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 9px;
  background: #fff;
  outline: none;
}

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

table.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 860px;
}

table.grid th {
  text-align: left;
  font-weight: 600;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.3px;
  padding: 10px 14px;
  background: #fafbfc;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.grid td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}

table.grid tr:hover td {
  background: #fcfcfd;
}

table.grid .num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

table.grid .no {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--ink);
  white-space: nowrap;
}

table.grid .muted {
  color: var(--muted);
  font-size: 12px;
}

.status-select {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  background: #fff;
  outline: none;
  cursor: pointer;
  font-weight: 500;
}

.status-select[data-s="成交"] {
  color: var(--ok);
  border-color: #a7f3d0;
  background: var(--ok-soft);
}

.status-select[data-s="流失"] {
  color: var(--danger);
  border-color: #fecaca;
  background: var(--danger-soft);
}

.status-select[data-s="跟进中"] {
  color: var(--warn);
  border-color: #fde68a;
  background: var(--warn-soft);
}

.empty {
  padding: 54px 20px;
  text-align: center;
  color: var(--muted);
}

.empty .ico {
  font-size: 30px;
  opacity: 0.5;
  margin-bottom: 8px;
}

/* ------------------------------ 设置页 ------------------------------ */

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

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

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 16px;
}

.form-actions {
  padding: 14px 20px;
  border-top: 1px solid var(--line-2);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.price-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.price-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  background: #fafbfc;
  border-bottom: 1px solid var(--line);
}

.price-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--line-2);
}

.price-table input {
  width: 88px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 7px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  background: #fafbfc;
  outline: none;
}

.price-table input:focus {
  border-color: var(--accent);
  background: #fff;
}

.price-table input.name {
  width: 100%;
  text-align: left;
}

.tabs-mini {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.tabs-mini button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  padding: 5px 12px;
  font-size: 12.5px;
  cursor: pointer;
  color: var(--ink-2);
}

.tabs-mini button.on {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  font-weight: 500;
}

/* ------------------------------ 报价单 ------------------------------ */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 32, 0.55);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  padding: 26px 16px 60px;
  animation: fade 0.15s ease;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.sheet-actions {
  position: sticky;
  top: 0;
  z-index: 2;
  align-self: flex-start;
  background: #fff;
  border-radius: 10px 10px 0 0;
  padding: 12px 18px;
  display: flex;
  gap: 8px;
  align-items: center;
  box-shadow: var(--shadow);
  width: 794px;
  max-width: 100%;
  flex-wrap: wrap;
}

.sheet-actions .sp {
  margin-left: auto;
}

.a4 {
  width: 794px;
  max-width: 100%;
  background: #fff;
  padding: 46px 52px 40px;
  box-shadow: var(--shadow-lg);
  border-radius: 0 0 10px 10px;
  color: #1a1f2b;
}

.a4 .sheet-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 2px solid #1a1f2b;
}

.a4 .shop {
  display: flex;
  gap: 11px;
  align-items: center;
}

.a4 .shop .logo {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: linear-gradient(135deg, #ff7a3d, #ff3d00);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 17px;
}

.a4 .shop .nm {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.a4 .shop .tag {
  font-size: 11px;
  color: #7b8494;
  letter-spacing: 0.5px;
}

.a4 .doc-ttl {
  text-align: right;
}

.a4 .doc-ttl h1 {
  font-size: 21px;
  margin: 0 0 4px;
  letter-spacing: 2px;
  font-weight: 700;
}

.a4 .doc-ttl .meta {
  font-size: 11.5px;
  color: #5b6472;
  line-height: 1.7;
  font-variant-numeric: tabular-nums;
}

.a4 .parties {
  display: flex;
  gap: 26px;
  padding: 18px 0 6px;
  font-size: 12.5px;
}

.a4 .parties div {
  flex: 1;
}

.a4 .parties .lb {
  color: #8b93a1;
  font-size: 11px;
  margin-bottom: 2px;
}

.a4 .parties .vl {
  font-weight: 600;
  font-size: 13px;
}

.a4 .spec {
  display: flex;
  gap: 0;
  margin: 14px 0 18px;
  border: 1px solid #e6e8ec;
  border-radius: 8px;
  overflow: hidden;
  font-size: 12px;
}

.a4 .spec > div {
  flex: 1;
  padding: 9px 13px;
  border-right: 1px solid #e6e8ec;
}

.a4 .spec > div:last-child {
  border-right: 0;
}

.a4 .spec .k {
  color: #8b93a1;
  font-size: 10.5px;
}

.a4 .spec .v {
  font-weight: 600;
  font-size: 12.5px;
  margin-top: 1px;
}

.a4 table.items {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.a4 table.items th {
  background: #f4f5f7;
  color: #4b5563;
  font-weight: 600;
  font-size: 11px;
  text-align: left;
  padding: 9px 12px;
  border-top: 1px solid #e6e8ec;
  border-bottom: 1px solid #e6e8ec;
}

.a4 table.items th:last-child,
.a4 table.items td:last-child {
  text-align: right;
}

.a4 table.items td {
  padding: 9px 12px;
  border-bottom: 1px solid #eef0f3;
  vertical-align: top;
}

.a4 table.items .nm {
  font-weight: 550;
}

.a4 table.items .ds {
  color: #8b93a1;
  font-size: 11px;
  margin-top: 1px;
}

.a4 table.items .grp td {
  background: #fafbfc;
  font-size: 11px;
  color: #8b93a1;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 6px 12px;
}

.a4 .totals {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.a4 .totals table {
  font-size: 12.5px;
  min-width: 290px;
}

.a4 .totals td {
  padding: 5px 0 5px 26px;
}

.a4 .totals td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.a4 .totals tr.grand td {
  border-top: 1px solid #1a1f2b;
  padding-top: 9px;
  font-size: 15px;
  font-weight: 700;
}

.a4 .totals tr.grand td:last-child {
  font-size: 20px;
  color: #d94a12;
}

.a4 .notes {
  margin-top: 22px;
  border-top: 1px dashed #d9dde3;
  padding-top: 14px;
  font-size: 11.5px;
  color: #5b6472;
  line-height: 1.85;
}

.a4 .notes h4 {
  font-size: 11px;
  margin: 0 0 7px;
  color: #1a1f2b;
  letter-spacing: 0.5px;
}

.a4 .notes ol {
  margin: 0;
  padding-left: 17px;
}

.a4 .notes .custom {
  margin-top: 10px;
  padding: 9px 12px;
  background: #fff8f4;
  border-left: 2px solid #ff5a1f;
  color: #7a3b1e;
  border-radius: 0 6px 6px 0;
}

.a4 .foot {
  margin-top: 26px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 11px;
  color: #8b93a1;
  border-top: 1px solid #eef0f3;
  padding-top: 12px;
}

.a4 .stamp {
  text-align: right;
}

.a4 .stamp .sig {
  font-size: 13px;
  color: #1a1f2b;
  font-weight: 600;
  margin-bottom: 2px;
}

/* 打印 */
@media print {
  body {
    background: #fff;
  }

  .topbar,
  .wrap,
  .sheet-actions,
  .toast {
    display: none !important;
  }

  .overlay {
    position: static;
    background: #fff;
    padding: 0;
    display: block;
    overflow: visible;
  }

  .overlay.hidden,
  .overlay.quote-locked {
    display: none !important;
  }

  .a4 {
    width: 100%;
    box-shadow: none;
    border-radius: 0;
    padding: 12mm 14mm;
  }

  @page {
    size: A4;
    margin: 0;
  }
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 12px);
  background: #1a1f2b;
  color: #fff;
  padding: 10px 18px;
  border-radius: 9px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: 0.22s;
  z-index: 300;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: #d3d7de;
  border-radius: 99px;
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* ==========================================================================
   第二阶段：登录、权限、审批、账号管理
   ========================================================================== */

/* ---------- 通用小件 ---------- */

.block {
  width: 100%;
}

.tiny {
  font-size: 12px;
}

.select,
.input-sm {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  outline: none;
}

.input-sm {
  width: 140px;
}

.select:focus,
.input-sm:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 90, 31, 0.12);
}

.hint-line {
  font-size: 12px;
  color: var(--muted);
  margin: 10px 0 0;
  line-height: 1.6;
}

.sub-title {
  font-size: 13px;
  font-weight: 650;
  margin: 0 0 12px;
}

.inline-warn {
  margin: 12px 0 0;
  font-size: 12.5px;
  line-height: 1.6;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--warn-soft);
  color: var(--warn);
}

.inline-warn.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ---------- 登录 / 强制改密 ---------- */

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(1000px 500px at 15% -10%, #1f2937 0%, transparent 60%),
    radial-gradient(800px 400px at 90% 110%, #3b1d0c 0%, transparent 55%),
    var(--brand);
}

.auth-card {
  width: 100%;
  max-width: 396px;
  background: #fff;
  border-radius: 14px;
  padding: 28px 28px 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 16px;
}

.auth-brand .brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff7a3d, #ff3d00);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 16px;
  box-shadow: 0 3px 10px rgba(255, 90, 31, 0.4);
}

.auth-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.auth-sub {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1.6px;
  margin-top: 2px;
}

.auth-tip {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0 0 18px;
  line-height: 1.6;
}

.auth-card .field {
  margin-bottom: 13px;
}

.auth-card .field > span {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.auth-card .field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  outline: none;
  transition: 0.15s;
}

.auth-card .field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 90, 31, 0.12);
}

.auth-error {
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12.5px;
  padding: 9px 12px;
  border-radius: 8px;
  margin: 4px 0 12px;
  line-height: 1.5;
}

.auth-foot {
  font-size: 11.5px;
  color: var(--muted);
  margin: 16px 0 0;
  padding-top: 13px;
  border-top: 1px solid var(--line-2);
  line-height: 1.6;
}

/* ---------- 顶栏用户区 ---------- */

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  color: #e6eaf2;
}

.user-chip b {
  font-weight: 600;
}

.user-chip span {
  color: #9aa3b5;
  font-size: 11.5px;
}

.link-btn {
  border: 0;
  background: transparent;
  color: #b6bfd0;
  font-size: 12.5px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
}

.link-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.tab-badge {
  display: inline-block;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  margin-left: 3px;
  text-align: center;
  vertical-align: 1px;
}

/* ---------- 弹窗（改密码） ---------- */

.modal-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-2);
}

.modal-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

.modal-body {
  padding: 16px 20px 6px;
}

.modal-body .field {
  margin-bottom: 12px;
}

.modal-body .field > span {
  font-size: 12px;
  color: var(--muted);
}

.modal-body .field input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  outline: none;
}

.modal-body .field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 90, 31, 0.12);
}

.modal-foot {
  padding: 14px 20px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- 审批卡片 ---------- */

.approval-card {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-2);
}

.approval-card:last-child {
  border-bottom: 0;
}

.approval-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.approval-main {
  flex: 1;
  min-width: 240px;
}

.approval-title {
  font-weight: 650;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.approval-title .no {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.approval-meta {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.7;
}

.approval-meta b {
  color: var(--ink-2);
  font-weight: 600;
}

.approval-money {
  text-align: right;
  min-width: 130px;
}

.approval-money .big {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

.approval-money .cut {
  font-size: 12px;
  color: var(--danger);
  font-weight: 600;
}

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

.approval-actions input {
  flex: 1;
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  outline: none;
  font-size: 13px;
}

.approval-actions input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 90, 31, 0.12);
}

/* ---------- 审批状态徽章 ---------- */

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.pill.pending {
  background: var(--warn-soft);
  color: var(--warn);
}

.pill.approved {
  background: var(--ok-soft);
  color: var(--ok);
}

.pill.rejected {
  background: var(--danger-soft);
  color: var(--danger);
}

.pill.none {
  background: var(--line-2);
  color: var(--muted);
}

/* ---------- 报价单锁定横幅 ---------- */

.lock-banner {
  background: var(--danger);
  color: #fff;
  font-size: 13px;
  line-height: 1.6;
  padding: 11px 18px;
  border-radius: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lock-banner b {
  font-weight: 700;
}

/* 打印时不要把锁定横幅印出来（既然已禁止打印，这里只是兜底） */
@media print {
  .lock-banner {
    display: none !important;
  }
}

/* ---------- 账号表 ---------- */

#accountTable td {
  vertical-align: middle;
}

.role-tag {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--line-2);
  color: var(--ink-2);
  white-space: nowrap;
}

.role-tag.owner {
  background: #1a1f2b;
  color: #fff;
}

.role-tag.manager {
  background: #eef2ff;
  color: #3730a3;
}

.role-tag.agent {
  background: #f0fdf4;
  color: #166534;
}

.acc-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

/* 审计详情多行折叠 */
.audit-detail {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.6;
  max-width: 520px;
}

.audit-detail details summary {
  cursor: pointer;
  color: var(--muted);
}

.audit-detail ul {
  margin: 6px 0 0;
  padding-left: 16px;
}

/* ==========================================================================
   第三阶段：客户链接、业绩排行
   ========================================================================== */

/* ---------- 分享弹窗 ---------- */

.share-box {
  display: flex;
  gap: 8px;
  align-items: center;
}

.share-box input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 12.5px;
  font-family: ui-monospace, Consolas, monospace;
  background: #fafbfc;
  outline: none;
}

.share-box input:focus {
  border-color: var(--accent);
  background: #fff;
}

.share-meta {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.9;
}

.share-meta b {
  color: var(--ink-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.share-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  background: #f8f9fb;
  border-radius: 8px;
  padding: 9px 12px;
  line-height: 1.65;
}

.share-hint.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

/* 查看次数徽章（记录表里） */
.view-count {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  color: var(--ok);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.view-count.zero {
  color: var(--muted);
  font-weight: 500;
}

/* ---------- 业绩排行 ---------- */

tr.top1 td {
  background: #fffbeb !important;
}

tr.top1 .rank {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #fff;
}

tr.top2 .rank {
  background: linear-gradient(135deg, #cbd5e1, #94a3b8);
  color: #fff;
}

tr.top3 .rank {
  background: linear-gradient(135deg, #fdba74, #f97316);
  color: #fff;
}

.rank {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--line-2);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.lb-name {
  font-weight: 600;
}

.lb-role {
  font-size: 10.5px;
  color: var(--muted);
  margin-left: 5px;
  font-weight: 400;
}

.lb-deal {
  font-weight: 650;
  color: var(--ok);
}

.lb-bar-cell {
  min-width: 96px;
}

.lb-bar {
  height: 5px;
  background: var(--line-2);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 4px;
}

.lb-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #34d399, #059669);
  border-radius: 99px;
}

.lb-bar > i.warn {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.lb-bar > i.danger {
  background: linear-gradient(90deg, #f87171, #dc2626);
}

.tiny-num {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.lead-selection { min-width: 165px; }
.lead-selection summary { color: var(--ink); cursor: pointer; }
.lead-selection ul { margin: 5px 0; padding-left: 18px; }
.lead-message { margin-top: 4px; overflow-wrap: anywhere; }
.tab.nav-link { text-decoration: none; display: inline-flex; align-items: center; }
.customer-notice { margin: 12px 0 0; }
.customer-selection .summary-actions { margin-top: 12px; }
.price-actions { white-space: nowrap; }
.package-editor-card { border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; }
.package-editor-card > summary { cursor: pointer; padding: 12px 14px; }
.package-editor-card > summary .tiny { margin-left: 10px; }
.package-editor-card[open] > summary { border-bottom: 1px solid var(--line); }
.package-editor-body { padding: 14px; }
.package-editor-body > .field { margin-top: 12px; }
.package-editor-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.package-picks { border: 0; margin: 14px 0 0; padding: 0; min-width: 0; }
.package-picks legend { padding: 0; margin-bottom: 5px; font-weight: 600; }
.package-pick-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,185px),1fr)); gap: 4px 12px; }
.package-pick-list label { display: flex; align-items: flex-start; gap: 5px; overflow-wrap: anywhere; }

/* ---------- 审批回执页 /a/<token> ---------- */
.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn.danger:hover { background: #a11818; }
.approve-wrap { max-width: 720px; }
.approve-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.approve-head h2 { margin: 4px 0 0; font-size: 20px; }
.approve-kicker { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--accent); text-transform: uppercase; }
.approve-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 12px 18px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.approve-grid .k { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.approve-grid .v { font-size: 14px; overflow-wrap: anywhere; }
.approve-grid .v.total { font-size: 22px; font-weight: 700; color: var(--accent); }
.approve-grid .wide { grid-column: 1 / -1; }
.approve-note { margin-top: 14px; }
.approve-note label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.approve-note textarea { width: 100%; box-sizing: border-box; }
.approve-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.approve-actions .btn { min-width: 132px; }
.approve-wrap .pill { align-self: flex-start; }
