/* 角色与托管模式下用 hidden 属性隐藏元素（tab/按钮/本地文件夹区块） */
[hidden] { display: none !important; }

:root {
  --ink: #14212b;
  --muted: #667085;
  --line: #d9e2ec;
  --panel: #ffffff;
  --bg: #f3f7f4;
  --blue: #1769aa;
  --green: #1f7a4d;
  --red: #b42318;
  --amber: #b54708;
  --deep: #123447;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(23, 105, 170, .18), transparent 320px),
    linear-gradient(180deg, #eef6f0 0, var(--bg) 260px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 28px;
  background: linear-gradient(135deg, #0f3d56 0%, #184f3c 100%);
  color: white;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; font-weight: 750; }
h2 { font-size: 19px; margin-bottom: 6px; }
h3 { font-size: 16px; margin: 12px 0 6px; }
p { color: inherit; opacity: .76; line-height: 1.5; }

.tabs {
  display: flex;
  gap: 8px;
  padding: 14px 22px 0;
  max-width: 1540px;
  margin: 0 auto;
  overflow-x: auto;
}

.tab, .config-tab {
  background: rgba(255,255,255,.72);
  color: var(--deep);
  border: 1px solid var(--line);
}
.tab.active, .config-tab.active {
  background: var(--deep);
  color: white;
  border-color: var(--deep);
}

main { padding: 18px 22px 28px; max-width: 1540px; margin: 0 auto; }
.view, .config-view { display: none; }
.view.active, .config-view.active { display: block; }

.hero-panel, .panel {
  background: rgba(255,255,255,.94);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 12px 32px rgba(15, 61, 86, .07);
}

.hero-panel {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  background:
    linear-gradient(135deg, rgba(18, 52, 71, .96), rgba(31, 122, 77, .88)),
    #123447;
  color: white;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: 12px;
  opacity: .7;
}
.hero-date {
  font-size: 30px;
  font-weight: 750;
  opacity: .9;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}
.stat-card strong {
  font-size: 28px;
  color: var(--deep);
}

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

.import-panel {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 18px;
}

.form-grid, .filters {
  display: grid;
  grid-template-columns: 2fr 1.2fr .8fr auto;
  gap: 10px;
  align-items: center;
}

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

.folder-head span {
  display: block;
  color: var(--deep);
  font-weight: 700;
}

.folder-head strong {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-list {
  display: grid;
  gap: 10px;
}

.file-row, .empty-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbfd;
  padding: 12px;
}

.file-row strong {
  display: block;
}

.file-row span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

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

.folder-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.folder-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fbfd;
  padding: 14px;
}

.folder-card h4 {
  margin: 0 0 6px;
}

.folder-card strong, .folder-card span {
  display: block;
}

.folder-card strong {
  margin-top: 10px;
  color: var(--deep);
}

.folder-card span {
  margin-top: 3px;
  font-size: 13px;
}

.ok-text { color: var(--green); }
.warn-text { color: var(--amber); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}
.filters input,
.filters select {
  flex: 0 1 auto;
  min-width: 0;
}
.filters #keyword {
  flex: 1 1 220px;
}
.filters .checkline {
  flex-shrink: 0;
  white-space: nowrap;
}
.filters [data-help] {
  display: inline-flex;
  align-items: center;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.section-head > button {
  min-width: 124px;
}

.section-head.compact {
  align-items: flex-start;
  margin-bottom: 14px;
}

.actions, .api-test-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
  background: white;
}

textarea {
  min-height: 360px;
  margin: 10px 0;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  padding: 9px 13px;
  font: inherit;
  line-height: 1.2;
  min-height: 38px;
  cursor: pointer;
}

button.secondary { background: #e7eef3; color: var(--ink); }
button.danger { background: var(--red); color: #fff; }
button:disabled { opacity: .45; cursor: not-allowed; }

.process-state.active {
  color: var(--blue);
  font-weight: 700;
}

.process-log.quiet {
  color: var(--muted);
}

.config-tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0 8px;
  flex-wrap: wrap;
}

.config-save-status {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 8px 0 16px;
  background: #f8fbfd;
}

.config-save-status strong {
  display: block;
  margin-bottom: 4px;
}

.config-save-status p {
  margin: 2px 0;
  color: #344054;
  opacity: 1;
}

.config-save-status.ok {
  background: #ecfdf3;
  border-color: #b7e4c7;
}

.config-save-status.warn {
  background: #fff4e5;
  border-color: #f2d3a2;
}

.config-save-status.empty {
  color: var(--muted);
}

.checkline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.summary {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 10px;
}

.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  margin: 10px 0;
}

.list-summary {
  display: grid;
  gap: 8px;
}
.list-row {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbfd;
  color: #344054;
  font-size: 14px;
}
.empty { color: var(--muted); }

.batch-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.batch-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fbfdfc;
}

.batch-main {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.batch-main h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.batch-status {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 13px;
  white-space: nowrap;
}

.batch-status.todo {
  background: #fff4e5;
  color: var(--amber);
}

.batch-status.done {
  background: #ecfdf3;
  color: var(--green);
}

.batch-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.batch-metrics span {
  padding: 6px 9px;
  border-radius: 8px;
  background: #eef5f8;
  color: #344054;
  font-size: 13px;
}

.batch-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.batch-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f2f8fc;
  padding: 10px 12px;
  color: #344054;
}

.batch-summary-row strong {
  font-size: 14px;
}

.batch-summary-row span {
  color: var(--muted);
  font-size: 13px;
}

.unified-batch-row {
  background: #fbfdfc;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table { width: 100%; border-collapse: collapse; min-width: 1150px; }
th, td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}
th {
  background: #f7fafc;
  color: #344054;
  position: sticky;
  top: 0;
}
tr:hover { background: #f8fbfd; }

.badge {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef2f6;
  color: #344054;
  font-size: 12px;
}
.badge.cancelled { background: #fee4e2; color: var(--red); }
.badge.ready { background: #ecfdf3; color: var(--green); }
.badge.warn { background: #fff4e5; color: var(--amber); }

.row-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
}
.row-actions button { padding: 6px 8px; font-size: 12px; white-space: nowrap; }

/* ⋯ 更多操作菜单（260915：每行只露下一步，其余收进菜单） */
.row-menu { position: relative; }
.row-menu summary {
  list-style: none;
  cursor: pointer;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  user-select: none;
}
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu[open] summary { background: #eef4f9; }
.row-menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  min-width: 220px;
  display: grid;
  gap: 4px;
  padding: 8px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 40, 60, 0.14);
}
.row-menu-pop button { text-align: left; }
.row-menu-pop button:disabled { opacity: 0.45; cursor: not-allowed; }
.row-menu-head {
  margin: 0 0 2px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px dashed var(--line);
  padding-bottom: 4px;
}

/* 点击行展开详情的行悬停提示 */
tr.shipment-row { cursor: pointer; }
tr.shipment-row:hover td { background: #f6fafc; }

#apiTestResult {
  min-height: 120px;
  max-height: 420px;
  overflow: auto;
  background: #0b1f2a;
  color: #d8eef7;
  border-radius: 10px;
  padding: 14px;
  white-space: pre-wrap;
}

.detail-card, .maintenance-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbfd;
  padding: 14px;
}

.detail-card.empty {
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.detail-grid section {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  padding: 12px;
}

.event-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.event-list p {
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
  color: #344054;
  opacity: 1;
}

/* 本周燃油状态条与快捷更新表单（260915：客户每周例行动作） */
.fuel-banner {
  border-radius: 12px;
  padding: 10px 14px;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  font-size: 14px;
}
.fuel-banner.hidden { display: none; }
.fuel-banner.ok { background: #eef9f0; border-color: #bfe5c7; color: #1d6b2e; }
.fuel-banner.warn { background: #fff6e8; border-color: #f2d3a0; color: #8a5a12; }
.fuel-banner.in-quote { margin: 10px 0 0; }
.fuel-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fuel-line .fuel-text { flex: 1; min-width: 200px; }
.fuel-form {
  display: none;
  grid-template-columns: auto auto auto 1fr auto;
  gap: 10px;
  align-items: end;
  margin-top: 10px;
}
.fuel-form.open { display: grid; }
.fuel-form label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: inherit;
}
.fuel-form input, .fuel-form select {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  width: 130px;
  background: white;
  color: #14212b;
}
.fuel-form .fuel-links { font-size: 12px; padding-bottom: 8px; }
.fuel-form .fuel-links a { color: inherit; text-decoration: underline; }
.fuel-form button { padding: 8px 14px; }

/* 行内订单详情（260911 客户反馈：紧凑卡片随订单行展开/收起） */
.detail-inline-row > td {
  padding: 0 10px 12px;
  background: #f4f8fb;
}
.detail-inline-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  padding: 10px 12px;
  animation: detailPushIn 0.18s ease-out;
}
@keyframes detailPushIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
.detail-inline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.detail-inline-head .title { font-weight: 600; font-size: 14px; }
.detail-inline-head .detail-collapse { padding: 4px 10px; font-size: 12px; }
.detail-inline-card .detail-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
.detail-inline-card .detail-grid section {
  padding: 8px 10px;
  border-radius: 8px;
  background: #f8fbfd;
}
.detail-inline-card .detail-grid h3 { font-size: 13px; margin: 0 0 4px; }
.detail-inline-card .detail-grid .kv { font-size: 12.5px; padding: 2px 0; gap: 8px; }
.detail-inline-card .detail-grid .kv .k { width: 60px; }
.detail-inline-card > h3 { font-size: 13px; margin: 10px 0 2px; }
.detail-inline-card .event-list { gap: 3px; margin-top: 4px; max-height: 110px; overflow: auto; }
.detail-inline-card .event-list p { font-size: 12px; padding-bottom: 3px; border-bottom: 1px dashed var(--line); }

.form-list {
  display: grid;
  gap: 12px;
  margin: 12px 0;
}

.form-card, .settings-form {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbfd;
  padding: 14px;
  margin: 12px 0;
}

.form-card h4 {
  grid-column: 1 / -1;
  margin: 0;
}

.form-card label, .settings-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.shipper-manager {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.shipper-list {
  display: grid;
  gap: 8px;
}

.shipper-list-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 4px 10px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdfc;
  color: #344054;
  padding: 12px;
}

.shipper-list-item.active {
  border-color: var(--blue);
  background: #edf7fb;
}

.shipper-list-item strong {
  grid-row: span 2;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #0f3d56;
  color: white;
  font-size: 18px;
}

.shipper-list-item span {
  font-weight: 700;
}

.shipper-list-item small {
  color: var(--muted);
}

.shipper-editor, .shipper-empty {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fbfd;
  padding: 16px;
}

.shipper-editor-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.shipper-editor-head h4 {
  margin: 0 0 4px;
  font-size: 18px;
}

.shipper-editor-head p, .field-help {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.shipper-detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.shipper-detail-tabs button {
  background: white;
  color: #344054;
}

.shipper-detail-tabs button.active {
  background: #0f3d56;
  color: white;
}

.shipper-form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.shipper-form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.check-card {
  align-self: end;
  display: flex !important;
  grid-template-columns: none !important;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.check-card input {
  width: auto;
}

.shipper-editor-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 14px;
}

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

.shipper-dialog {
  border: 0;
  border-radius: 18px;
  padding: 0;
  width: min(420px, calc(100vw - 32px));
  box-shadow: 0 24px 70px rgba(15, 61, 86, .25);
}

.shipper-dialog::backdrop {
  background: rgba(15, 33, 44, .35);
}

.shipper-dialog form {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.shipper-dialog h3, .shipper-dialog p {
  margin: 0;
}

.shipper-dialog p {
  color: var(--muted);
}

.shipper-dialog label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.process-log {
  min-height: 140px;
  background: #f8fbfd;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  color: #344054;
}

.process-log pre {
  max-height: 240px;
  overflow: auto;
  background: #0b1f2a;
  color: #d8eef7;
  border-radius: 10px;
  padding: 12px;
  white-space: pre-wrap;
}

.process-state {
  display: inline-block;
  border-radius: 999px;
  padding: 5px 10px;
  margin-bottom: 10px;
  font-size: 13px;
}

.process-state.done {
  background: #ecfdf3;
  color: var(--green);
}

.process-state.error {
  background: #fee4e2;
  color: var(--red);
}

.progress-steps {
  margin: 8px 0 14px;
  padding-left: 22px;
  line-height: 1.8;
}

#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 460px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #0f3d56;
  color: white;
  box-shadow: 0 10px 28px rgba(0,0,0,.2);
  display: none;
}

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .split-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .topbar, .section-head, .hero-panel { align-items: flex-start; flex-direction: column; }
  .import-panel, .form-grid, .filters, .detail-grid, .form-card, .settings-form, .shipper-manager, .shipper-form-grid { grid-template-columns: 1fr; }
  .fuel-form { grid-template-columns: 1fr; }
  .file-row, .folder-head { align-items: flex-start; flex-direction: column; }
  .stats-grid { grid-template-columns: 1fr; }
  .batch-main { flex-direction: column; }
  main { padding: 12px; }
}

/* ---- 报价管理 ---- */
.dialog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  margin: 12px 0;
}
.dialog-grid label.full { grid-column: 1 / -1; }
.rate-dialog { width: min(560px, 92vw); }
.quote-table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.quote-table th, .quote-table td { border-bottom: 1px solid var(--border, #e2e8f0); padding: 8px 10px; text-align: left; font-size: 13px; }

/* ---- 报价单导入（rate cards）---- */
.rate-card-status {
  background: var(--panel, #f8fafc);
  border: 1px dashed var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  white-space: pre-wrap;
  margin: 10px 0 4px;
}
.rate-card-status:empty { display: none; }
.rate-preview-dialog { width: min(820px, 94vw); }
.rate-preview-summary { font-size: 14px; line-height: 1.6; }
.rate-card-warnings {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  white-space: pre-wrap;
  margin: 10px 0;
}
.rate-card-warnings:empty { display: none; }
.rate-card-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.rate-card-badge.draft { background: #fef3c7; color: #92400e; }
.rate-card-badge.active { background: #dcfce7; color: #166534; }
.rate-card-badge.superseded { background: #e2e8f0; color: #475569; }
.rate-card-badge.rejected { background: #fee2e2; color: #991b1b; }

/* ---- 变更表（预览确认） ---- */
.diff-heading { margin: 14px 0 6px; font-size: 14px; }
.rate-card-diff { display: flex; flex-direction: column; gap: 12px; }
.rate-card-diff.empty { color: var(--muted); }
.diff-section { border: 1px solid var(--border, #e2e8f0); border-radius: 8px; padding: 8px 10px; }
.diff-section > b { display: block; margin-bottom: 4px; font-size: 13px; }
.diff-section .table-wrap { margin-top: 4px; }
.diff-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.diff-badge.diff-added { background: #dcfce7; color: #166534; }
.diff-badge.diff-changed { background: #fef9c3; color: #854d0e; }
.diff-badge.diff-unchanged { background: #f1f5f9; color: #475569; }
.diff-badge.diff-expire { background: #fee2e2; color: #991b1b; }

/* ---- 当前公式说明 ---- */
.freight-formula { font-size: 13px; }
.freight-formula.empty { color: var(--muted); }
.formula-steps { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.formula-step { border-left: 3px solid var(--border, #e2e8f0); padding: 4px 10px; }
.formula-step-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.formula-step-no { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: #e2e8f0; color: #475569; font-size: 12px; font-weight: 700; }
.formula-step code { background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 4px; padding: 1px 6px; font-size: 12px; }
.formula-step-note { font-size: 12px; margin-top: 2px; }
.freight-fields { columns: 2; column-gap: 24px; margin: 8px 0; }
.freight-fields li { break-inside: avoid; margin-bottom: 4px; font-size: 12px; }
@media (max-width: 800px) { .freight-fields { columns: 1; } }

/* ---- 访问口令覆盖层 ---- */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
}
.auth-overlay.show { display: flex; }
.auth-card {
  width: min(360px, 90vw);
  background: #fff;
  border-radius: 14px;
  padding: 26px 24px;
  box-shadow: 0 18px 50px rgba(0,0,0,.28);
}
.auth-card h3 { margin: 0 0 6px; }
.auth-card p { margin: 0 0 14px; color: #64748b; font-size: 13px; }
.auth-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 14px;
}
.auth-card button {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: #0f3d56;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

/* ---- API 账号：单列竖排、长字段全宽 ---- */
#accountsForm .form-card {
  grid-template-columns: 1fr;
}
#accountsForm .form-card label input {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

/* ---- API 账号：4 个承运商卡片从上到下排 ---- */
#accountsForm {
  grid-template-columns: 1fr;
}

/* ---- API 账号：环境下拉 ---- */
#accountsForm .env-switch {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  padding-bottom: 10px;
  margin-bottom: 8px;
  border-bottom: 1px dashed var(--line);
}
#accountsForm .env-switch select {
  font-weight: 600;
  color: var(--deep);
}

/* ---- 手动发货 P0：选承运商 / 检查资料 / 环境横幅 / 下单结果 ---- */
.carrier-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.carrier-select-grid button {
  display: grid;
  gap: 4px;
  justify-items: center;
  padding: 14px 10px;
}
.carrier-select-grid button strong { font-size: 15px; }
.carrier-select-grid button small { font-weight: 400; font-size: 12px; opacity: .85; }

.env-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 10px;
  background: #ecfdf3;
  padding: 10px 14px;
  margin: 10px 0;
}
.env-banner strong { font-size: 15px; }
.env-banner.production {
  border-color: #f2d3a2;
  border-left-color: var(--red);
  background: #fff4e5;
}
.env-banner.unset {
  border-left-color: var(--muted);
  background: #f8fbfd;
}
.env-pill, .mode-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.env-pill.sandbox { background: #d1fae5; color: #065f46; }
.env-pill.production { background: #fee2e2; color: #991b1b; }
.env-pill.unset { background: #e2e8f0; color: #475569; }
.mode-pill { background: #e2e8f0; color: #344054; }
.env-banner.production .mode-pill { background: #fee2e2; color: #991b1b; }

.profile-group { margin: 12px 0; }
.profile-group h4 { margin: 0 0 8px; font-size: 14px; color: var(--deep); }
.profile-item {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 8px 10px;
  font-size: 13px;
}
.profile-item span { color: var(--muted); font-size: 12px; }
.profile-item b { font-weight: 600; word-break: break-all; }
.profile-item.missing { border-color: var(--red); background: #fee4e2; }
.profile-item.missing span { color: var(--red); font-weight: 600; }

.preflight-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin: 10px 0;
  background: #f8fbfd;
}
.preflight-box strong { margin-right: 6px; }
.preflight-box.ok { border-color: #b7e4c7; background: #ecfdf3; color: var(--green); }
.preflight-box.warn { border-color: #f2d3a2; background: #fff4e5; color: var(--amber); }
.preflight-box.missing { border-color: #f4b3ad; background: #fee4e2; color: var(--red); }

.ship-result-card {
  border: 1px solid #b7e4c7;
  background: #ecfdf3;
  border-radius: 12px;
  padding: 14px;
  margin: 10px 0;
}
.ship-result-card h4 { margin: 0 0 10px; font-size: 15px; color: var(--green); }
.ship-result-card.mock { border-color: #f2d3a2; background: #fff4e5; }
.ship-result-card.mock h4 { color: var(--amber); }
.ship-result-card .quote-table { margin: 0 0 10px; background: white; border-radius: 8px; }
.ship-result-card .quote-table th { width: 110px; }

/* ---------------------------------------------------------------------------
   页面反馈：浮动按钮 / 选取高亮 / 提交弹窗 / 管理列表
   --------------------------------------------------------------------------- */

.feedback-pill {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 900;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--ink, #14212b);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  cursor: pointer;
}
.feedback-pill:hover { opacity: 0.9; }
.feedback-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #e0533d;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  padding: 0 4px;
}

#feedback-highlight {
  position: fixed;
  display: none;
  z-index: 950;
  border: 2px solid #e0533d;
  background: rgba(224, 83, 61, 0.08);
  pointer-events: none;
  border-radius: 2px;
}
#feedback-tip {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 950;
  background: #14212b;
  color: #fff;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  pointer-events: none;
}

.feedback-dialog {
  position: fixed;
  right: 20px;
  bottom: 70px;
  z-index: 960;
  width: 320px;
  background: #fff;
  border: 1px solid #d9dee3;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.16);
}
.feedback-dialog h4 { margin: 0 0 8px; }
.feedback-dialog textarea {
  width: 100%;
  box-sizing: border-box;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid #d9dee3;
  border-radius: 6px;
  font: inherit;
}
.feedback-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.feedback-cat { font-size: 12px; padding: 3px 10px; border-radius: 999px; }
.feedback-cat.active { background: #14212b; color: #fff; }
.feedback-context {
  margin: 4px 0 0;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-item {
  border: 1px solid #e3e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.feedback-item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.feedback-item p { margin: 4px 0; }
.feedback-meta { font-size: 12px; }
.feedback-item.open { border-left: 3px solid #e0533d; }
.feedback-item.resolved { opacity: 0.75; }

/* 顶栏身份指示与切换口令 */
.session-box {
  display: flex;
  align-items: center;
  gap: 10px;
}
.role-indicator {
  font-size: 13px;
  color: var(--muted, #667085);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #d9dee3;
}
.role-indicator[data-role="admin"] {
  color: #0b6b3a;
  border-color: #9fd4b4;
  background: #eaf7ef;
}
.switch-token-btn { font-size: 12px; padding: 4px 10px; }
.topbar { display: flex; justify-content: space-between; align-items: center; }

/* ---------------------------------------------------------------------------
   就地帮助：小问号与说明气泡
   --------------------------------------------------------------------------- */

.help-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-left: 5px;
  border-radius: 50%;
  background: #eef1f4;
  color: #667085;
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  vertical-align: middle;
  border: 1px solid #d9dee3;
  user-select: none;
}
.help-dot:hover { background: #14212b; color: #fff; border-color: #14212b; }

#help-tooltip {
  display: none;
  position: fixed;
  z-index: 980;
  max-width: 340px;
  background: #14212b;
  color: #fff;
  font-size: 13px;
  line-height: 1.6;
  padding: 10px 12px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  pointer-events: auto;
}
#help-tooltip strong { display: block; margin-bottom: 4px; font-size: 13px; }
#help-tooltip p { margin: 0; white-space: pre-wrap; }

/* ---------------------------------------------------------------------------
   使用指南弹窗（顶栏「? 使用指南」）：单面板居中
   --------------------------------------------------------------------------- */

.guide-btn { flex-shrink: 0; }

#guide-dialog {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 990;
  background: rgba(15, 23, 32, 0.55);
  overflow-y: auto;
  padding: 40px 16px;
}
#guide-dialog .guide-panel {
  max-width: 760px;
  margin: 0 auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  color: #14212b;
}
#guide-dialog .guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
}
#guide-dialog .guide-head h3 { margin: 0; font-size: 18px; color: #111827; }
#guide-dialog .guide-intro {
  margin: 0;
  padding: 0 20px 12px;
  color: #475569;
  font-size: 14px;
}
#guide-dialog .guide-steps {
  list-style: none;
  margin: 0;
  padding: 0 20px;
}
#guide-dialog .guide-step {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid #eef1f4;
}
#guide-dialog .guide-num {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #14212b;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  margin-top: 2px;
}
#guide-dialog .guide-step h4 { margin: 0 0 4px; font-size: 15px; color: #111827; }
#guide-dialog .guide-where {
  margin: 0 0 4px;
  font-size: 13px;
  color: #b45309;
  font-weight: 600;
}
#guide-dialog .guide-body { margin: 0; font-size: 13px; line-height: 1.65; color: #334155; }
#guide-dialog .guide-extras { padding: 4px 20px 18px; }
#guide-dialog .guide-qa {
  border-top: 1px dashed #e2e8f0;
  padding: 10px 0 0;
  margin-top: 10px;
}
#guide-dialog .guide-qa strong { font-size: 13px; color: #111827; }
#guide-dialog .guide-qa p { margin: 4px 0 0; font-size: 13px; color: #475569; line-height: 1.6; }

/* 详情弹窗：键值对结构化展示 */
.detail-grid .kv { display: flex; gap: 10px; padding: 3px 0; font-size: 13px; line-height: 1.5; }
.detail-grid .kv .k { flex-shrink: 0; width: 64px; color: var(--muted); }
.detail-grid .kv .v { word-break: break-all; }
