* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --teal: #0f766e;
  --teal-light: #14b8a6;
  --orange: #ea580c;
  --orange-bg: #fff7ed;
  --orange-border: #fdba74;
  --red: #dc2626;
  --green: #16a34a;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --bg: #f1f5f4;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
}
.wrap { max-width: 820px; margin: 0 auto; padding: 16px 14px 40px; }

/* ===== 顶部 ===== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 10px;
}
.topbar h1 { font-size: 20px; font-weight: 700; color: var(--teal); }
.topbar .who { font-size: 13px; color: var(--text-light); }
.topbar .right { display: flex; align-items: center; gap: 10px; }
.badge {
  background: var(--orange); color: #fff; font-size: 13px; font-weight: 600;
  border-radius: 999px; padding: 3px 12px; white-space: nowrap;
}
.badge.zero { background: var(--green); }

.card {
  background: #fff; border-radius: 12px; padding: 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
  margin-bottom: 14px;
}
.card h2 { font-size: 16px; margin-bottom: 12px; }
label.field-label {
  display: block; font-size: 13px; color: var(--text-light);
  margin: 10px 0 4px; font-weight: 600;
}
label.field-label:first-child { margin-top: 0; }
input[type="text"], input[type="password"], input[type="date"], textarea, select {
  width: 100%; border: 1px solid #cbd5e1; border-radius: 8px;
  padding: 9px 11px; font-size: 15px; font-family: inherit;
  color: var(--text); background: #fff; outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--teal-light);
  box-shadow: 0 0 0 3px rgba(20,184,166,.15);
}
textarea { min-height: 120px; resize: vertical; line-height: 1.6; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 8px; padding: 9px 16px;
  font-size: 15px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.btn:active { filter: brightness(.92); }
.btn-primary { background: var(--teal); color: #fff; }
.btn-ghost { background: #fff; border-color: #cbd5e1; color: var(--text); }
.btn-danger-ghost { background: #fff; border-color: #fecaca; color: var(--red); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 7px; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row .btn { flex: 1; }

/* ===== 登录页 ===== */
.login-card { max-width: 380px; margin: 60px auto; }
.login-card .logo {
  text-align: center; font-size: 22px; font-weight: 700;
  color: var(--teal); margin-bottom: 18px;
}
.login-error {
  background: #fef2f2; color: var(--red); border: 1px solid #fecaca;
  border-radius: 8px; padding: 8px 12px; font-size: 13.5px; margin-bottom: 12px;
}

/* ===== 动态条目 ===== */
.item-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.item-row input { flex: 1; }
.item-row .btn-minus {
  flex: 0 0 auto; width: 38px; height: 38px; border: 1px solid #fecaca;
  background: #fff; color: var(--red); border-radius: 8px;
  font-size: 17px; cursor: pointer; font-family: inherit;
}
.add-line {
  border: 1px dashed #cbd5e1; background: #f8fafc; color: var(--text-light);
  border-radius: 8px; width: 100%; padding: 8px; cursor: pointer;
  font-size: 14px; font-family: inherit;
}
.add-line:hover { border-color: var(--teal-light); color: var(--teal); }
.section-extras {
  background: var(--orange-bg); border: 1px solid var(--orange-border);
  border-radius: 10px; padding: 12px; margin-top: 12px;
}
.section-extras h3 { font-size: 14px; color: var(--orange); margin-bottom: 8px; }
.section-products { margin-top: 12px; }
.section-products h3 { font-size: 14px; color: var(--teal); margin-bottom: 8px; }

/* ===== tabs ===== */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab {
  flex: 1; padding: 8px 2px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; font-size: 13px; font-weight: 600; color: var(--text-light);
  cursor: pointer; font-family: inherit;
}
.tab.active { background: var(--teal); color: #fff; border-color: var(--teal); }
.tab .n { font-size: 11px; opacity: .85; }

/* ===== 订单卡片 ===== */
.order { border-left: 4px solid var(--teal-light); }
.order.shipped { border-left-color: var(--green); }
.order-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 8px; margin-bottom: 8px;
}
.order-time { font-size: 12.5px; color: var(--text-light); }
.status-tag {
  font-size: 12px; font-weight: 700; border-radius: 999px;
  padding: 2px 10px; white-space: nowrap;
}
.status-tag.pending { background: var(--orange-bg); color: var(--orange); }
.status-tag.shipped { background: #dcfce7; color: var(--green); }
.info-line { font-size: 14px; margin: 2px 0; word-break: break-all; }
.info-line .k { color: var(--text-light); margin-right: 4px; }
.pick-title {
  font-size: 13px; font-weight: 700; color: var(--teal);
  margin: 10px 0 6px;
}
.pick-item {
  display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px;
  border-radius: 8px; margin-bottom: 4px; font-size: 14px; cursor: pointer;
}
.pick-item:hover { background: #f8fafc; }
.pick-item input[type="checkbox"] {
  width: 18px; height: 18px; margin-top: 2px; flex: 0 0 auto;
  accent-color: var(--teal); cursor: pointer;
}
.pick-item.done { color: var(--text-light); text-decoration: line-through; }
.pick-item.extra { background: var(--orange-bg); border: 1px solid var(--orange-border); }
.pick-item.extra input[type="checkbox"] { accent-color: var(--orange); }
.tag-extra {
  font-size: 11px; font-weight: 700; color: #fff; background: var(--orange);
  border-radius: 5px; padding: 1px 6px; margin-left: 6px; white-space: nowrap;
}

/* ===== 快递 / 照片区块 ===== */
.sub-box {
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: 10px; padding: 12px; margin-top: 12px;
}
.sub-box .box-title {
  font-size: 13px; font-weight: 700; margin-bottom: 8px;
}
.tracking-row { display: flex; gap: 8px; }
.tracking-row select { flex: 0 0 118px; }
.tracking-row input { flex: 1; }
.photo-btns { display: flex; gap: 8px; margin-bottom: 10px; }
.photo-btns .btn { flex: 1; padding: 8px 6px; font-size: 13.5px; }
.photo-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb {
  width: 84px; height: 84px; object-fit: cover; border-radius: 8px;
  cursor: pointer; border: 1px solid var(--border); background: #e2e8f0;
}
.photo-empty { font-size: 13px; color: var(--text-light); }
input.ship-date { width: 175px; padding: 5px 8px; font-size: 13.5px; }

.order-actions { display: flex; gap: 8px; margin-top: 12px; }
.order-actions .btn { flex: 1; }
.empty-state {
  text-align: center; color: var(--text-light);
  padding: 36px 10px; font-size: 14px;
}

/* ===== 派单人对账 ===== */
.report-row { display: flex; gap: 10px; }
.report-cell { flex: 1; }
.report-cell .field-label { margin-top: 0; }
.report-line {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 2px; border-bottom: 1px solid var(--border); font-size: 14px;
}
.report-line:last-child { border-bottom: none; }
.report-line .r-count { font-weight: 700; color: var(--teal); }
.report-total { font-size: 14px; font-weight: 700; margin-top: 10px; color: var(--teal); }

/* ===== 合作方账号管理 ===== */
.partner-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}
.partner-row:last-child { border-bottom: none; }
.partner-row .p-name { flex: 1; }
.partner-row .p-state { font-size: 12px; color: var(--text-light); }
.partner-row .p-state.off { color: var(--red); }

/* ===== 大图弹层 ===== */
#lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 999;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 16px;
}
#lightbox img { max-width: 94%; max-height: 70vh; border-radius: 6px; }
.lb-close {
  position: absolute; top: 14px; right: 18px; background: rgba(255,255,255,.15);
  color: #fff; border: none; font-size: 26px; width: 44px; height: 44px;
  border-radius: 50%; cursor: pointer; font-family: inherit;
}
.lb-time { color: #cbd5e1; font-size: 13px; margin-top: 12px; }
.lb-actions { display: flex; gap: 10px; margin-top: 12px; }
.lb-actions .btn { padding: 8px 20px; }

.hidden { display: none !important; }

/* ===== 明细行：名称/数量/单价 ===== */
.item-row .line-name { flex: 1 1 auto; min-width: 0; }
.item-row .line-qty { flex: 0 0 62px; }
.item-row .line-price { flex: 0 0 84px; }
.item-row input[type="checkbox"] {
  width: 18px; height: 18px; flex: 0 0 auto;
  accent-color: var(--teal); cursor: pointer;
}
.edit-item.extra .line-name { color: var(--orange); }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* ===== 金额行 ===== */
.amount-line { margin-top: 12px; font-size: 15px; text-align: right; }
.amount-line b { color: var(--orange); font-size: 17px; }

/* ===== 合作方只读明细 ===== */
.ro-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px;
}
.ro-item:last-child { border-bottom: none; }
.ro-name { flex: 1; min-width: 0; }
.ro-qty { flex: 0 0 auto; color: var(--text-light); }
.ro-price { flex: 0 0 70px; text-align: right; color: var(--text-light); }
.ro-sub { flex: 0 0 78px; text-align: right; font-weight: 600; }

/* ===== 管理列表内按钮不拉伸 ===== */
.partner-row .btn { flex: 0 0 auto; }


@media (max-width: 560px) {
  .wrap { padding: 12px 10px 32px; }
  .topbar h1 { font-size: 18px; }
  .tab { font-size: 12px; padding: 7px 1px; }
  .tracking-row select { flex: 0 0 102px; }
  .thumb { width: 72px; height: 72px; }
}

/* ===== 地址粘贴解析（小文本框） ===== */
#addrPaste { min-height: 64px; }

/* ===== 订单表格 ===== */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  -webkit-overflow-scrolling: touch;
}
.order-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  white-space: nowrap;
}
.order-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: var(--text-light);
  font-size: 12.5px;
  font-weight: 700;
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
}
.order-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.order-table tbody tr:last-child td { border-bottom: none; }
.order-table tbody tr { cursor: pointer; }
.order-table tbody tr:hover { background: #f8fafc; }
.order-table .t-receiver, .order-table .t-org {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-table .status-tag { font-size: 11px; padding: 2px 8px; }

/* ===== 分页 ===== */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}
.page-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
}
.page-btn:disabled { opacity: .45; cursor: not-allowed; }
.page-info { font-size: 12.5px; color: var(--text-light); white-space: nowrap; }

/* ===== 详情视图里的订单卡片去掉多余底边 ===== */
#detailBox .order { margin-bottom: 0; }

@media (max-width: 560px) {
  .order-table { font-size: 12.5px; }
  .order-table th, .order-table td { padding: 7px 8px; }
  .order-table .t-receiver, .order-table .t-org { max-width: 120px; }
  .pager { gap: 8px; }
  .page-btn { padding: 6px 10px; }
  .page-info { font-size: 11.5px; }
}
