/* ============================================================
   前台客户区样式（home 视图专用）
   规范化独立 CSS 文件：修改后通过 ?v= 版本号刷新缓存
   ============================================================ */

/* ---------- 基础与全屏化布局 ---------- */
html, body { background: #f5f7fa; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; }

/* 顶部导航：全宽吸顶，白底深色文字，移动端汉堡折叠 */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: #fff;
  color: #1f2329;
  border-bottom: 1px solid #e8eaed;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  gap: 12px;
}
.topbar .brand {
  font-size: 16px; font-weight: 700; color: #0958d9;
  white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
}
.topbar .brand::before {
  content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #0958d9;
}
.topbar nav {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.topbar nav::-webkit-scrollbar { display: none; }
.topbar a {
  color: #4e5969; text-decoration: none;
  padding: 6px 12px; border-radius: 6px;
  font-size: 13px; white-space: nowrap;
  transition: background .15s, color .15s;
}
.topbar a:hover { background: #f0f5ff; color: #0958d9; }
.topbar .user-name { color: #86909c; font-size: 13px; margin-right: 6px; white-space: nowrap; }
.topbar .nav-toggle {
  display: none;
  background: none;
  border: 0;
  color: #1f2329;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

/* 内容容器：全宽 */
.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 20px;
  box-sizing: border-box;
}

/* 修复：fieldset 默认 min-inline-size:min-content 会撑破移动端布局 */
fieldset { min-width: 0; min-inline-size: 0; }
.table-scroll { max-width: 100%; }

/* 卡片轻量化：去厚重阴影，改浅色边框 */
.card {
  background: #fff;
  border: 1px solid #eef0f3;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 600; color: #1f2329; margin-bottom: 12px; }
.table { box-shadow: none; border: 1px solid #f0f2f5; }

/* ---------- 订单列表页：状态卡片与筛选栏 ---------- */
.status-card {
  flex:1; border-radius:8px; padding:12px 14px; text-align:center; cursor:pointer;
  border:1px solid #eee; background:#fff; transition:all .2s; text-decoration:none; color:#333;
  display:block;
}
.status-card:hover { border-color:#1677ff; box-shadow:0 2px 8px rgba(22,119,255,.15); }
.status-card.active { border-color:#1677ff; background:#e6f4ff; }
.status-card .cnt { font-size:22px; font-weight:700; }
.status-card .lbl { font-size:12px; color:#888; margin-top:2px; }
.filter-bar { display:flex; flex-wrap:wrap; gap:8px; align-items:center; background:#fafafa; border:1px solid #eee; border-radius:8px; padding:12px; margin-bottom:14px; }
.filter-bar input, .filter-bar select {
  height:30px; font-size:13px; padding:0 8px; border:1px solid #d9d9d9; border-radius:4px; width:140px;
}
.filter-bar .filter-btn { height:30px; }

/* ---------- 移动端适配 ---------- */
@media (max-width: 768px) {
  .topbar { padding: 8px 12px; }
  .topbar .brand { font-size: 15px; }
  /* 移动端：导航折叠为汉堡菜单 */
  .topbar nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid #e8eaed;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    flex-direction: column;
    align-items: stretch;
    padding: 8px 12px 12px;
    gap: 2px;
    overflow: visible;
  }
  .topbar.nav-open nav { display: flex; }
  .topbar .nav-toggle { display: block; }
  .topbar a { display: block; padding: 10px 12px; border-radius: 6px; font-size: 14px; }
  .topbar .user-name { display: block; padding: 6px 12px; }
  .container { padding: 12px; }
  .card { padding: 14px 12px; }
  /* 表格保持横向滚动，不清除 min-width，避免列被压扁 */
}

/* ---------- 登录页 ---------- */
.login-page {
  background: #f0f2f5;
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
}
.login-box { width: 380px; max-width: 92%; background: #fff; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,.08); padding: 40px 36px; box-sizing: border-box; }
.login-box h1 { font-size: 22px; text-align: center; margin-bottom: 6px; }
.login-box .sub { text-align: center; color: #999; font-size: 13px; margin-bottom: 28px; }

/* ---------- 地址簿 ---------- */
#addr-form input, #addr-form select {
  height: 32px; font-size: 13px; padding: 0 8px; border: 1px solid #d9d9d9;
  border-radius: 4px; width: 100%; box-sizing: border-box;
}
#addr-form .form-group { margin-bottom: 10px; }
#addr-form label { display: block; font-size: 12px; color: #666; margin-bottom: 4px; }

/* ---------- 申报库 ---------- */
#cargo-table input, #cargo-table select {
  height: 28px; font-size: 12px; padding: 0 6px; border: 1px solid #d9d9d9;
  border-radius: 4px; width: 100%; box-sizing: border-box;
}
#cargo-table td { vertical-align: middle; }
#cargo-table .step-input { display: inline-flex; align-items: center; border: 1px solid #d9d9d9; border-radius: 4px; overflow: hidden; background: #fff; }
#cargo-table .step-input input { width: 40px !important; min-width: 40px !important; height: 26px; border: 0 !important; text-align: center; font-size: 12px; }
#cargo-table .step-input .step-btn { width: 20px; height: 26px; border: 0; background: #fafafa; cursor: pointer; font-size: 14px; line-height: 1; color: #555; }

/* ---------- 在线下单包裹/申报 ---------- */
#parcel-table input, #cargo-table input {
  height: 28px; font-size: 12px; padding: 0 6px; border: 1px solid #d9d9d9;
  border-radius: 4px; width: 100%; box-sizing: border-box;
}
#parcel-table td, #cargo-table td { vertical-align: middle; }
#parcel-table tfoot td { font-size: 12px; color: #333; }
.table-scroll { overflow-x: auto; }
.cargo-table th { white-space: nowrap; }
.step-input { display: inline-flex; align-items: center; border: 1px solid #d9d9d9; border-radius: 4px; overflow: hidden; background: #fff; }
.step-input input { width: 34px !important; min-width: 34px !important; height: 26px; border: 0 !important; text-align: center; font-size: 12px; padding: 0 2px !important; box-shadow: none !important; }
.step-input .step-btn { width: 20px; height: 26px; border: 0; background: #fafafa; cursor: pointer; font-size: 14px; line-height: 1; color: #555; display: flex; align-items: center; justify-content: center; }
.step-input .step-btn:hover { background: #e6f4ff; color: #1677ff; }
.cargo-en-wrap { display: flex; align-items: center; }
.cargo-en-wrap input { flex: 1; }
.cargo-trans {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px;
  border: 1px solid #d9d9d9; border-radius: 4px; background: #fafafa; cursor: pointer;
  font-size: 12px; color: #1677ff; margin-left: 4px; vertical-align: middle; line-height: 1;
}
.cargo-trans:hover { background: #e6f4ff; border-color: #1677ff; }
.cargo-trans:disabled { opacity: .5; cursor: wait; }
.hs-wrap { position: relative; }
.hs-wrap .hs-input { padding-right: 26px !important; }
.hs-wrap .hs-search {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  font-size: 12px; text-decoration: none; cursor: pointer; opacity: .7; line-height: 1;
}
.hs-wrap .hs-search:hover { opacity: 1; }

/* ---------- 州/省可搜索下拉（combo 风格，与后台一致） ---------- */
.zone-combo { position: relative; }
.zone-combo input { padding-right: 30px !important; }
.zone-combo .zone-drop {
  position: absolute; right: 1px; top: 1px; bottom: 1px; width: 28px;
  border: 0; background: #fafafa; border-left: 1px solid #eee;
  border-radius: 0 4px 4px 0; cursor: pointer; font-size: 11px; color: #666;
}
.zone-combo .zone-drop:hover { background: #f0f0f0; }
.zone-panel {
  position: absolute; z-index: 200; top: calc(100% + 2px); left: 0; right: 0;
  background: #fff; border: 1px solid #d9d9d9; border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12); overflow: hidden;
}
.zone-panel .zone-search { padding: 6px; border-bottom: 1px solid #f0f0f0; }
.zone-panel .zone-search input { width: 100%; height: 26px; border: 1px solid #d9d9d9; border-radius: 4px; padding: 0 8px; font-size: 12px; outline: none; }
.zone-panel .zone-list { max-height: 180px; overflow-y: auto; }
.zone-panel .zone-item { padding: 6px 10px; font-size: 12px; cursor: pointer; border-bottom: 1px solid #fafafa; }
.zone-panel .zone-item:hover, .zone-panel .zone-item.active { background: #e6f4ff; color: #1677ff; }
.zone-panel .zone-empty { padding: 10px; font-size: 12px; color: #999; text-align: center; }

/* ---------- 打印标签页 ---------- */
.label-page body { font-family: Arial, 'Microsoft YaHei', sans-serif; margin: 20px; }
.label-card {
  display: block; width: 100%; max-width: 180mm; min-height: 50mm; border: 1px solid #333;
  margin: 0 auto 12px; padding: 12px; box-sizing: border-box;
  text-align: center; page-break-inside: avoid;
}
/* 打印时每个标签单独一页（竖排输出，对标老程序 page-break-after: always） */
@media print {
  .label-card { page-break-after: always; margin: 0; }
  .label-card:last-child { page-break-after: auto; }
  .print-bar { display: none; }
}
.label-card .order-no { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.label-card .receiver { font-size: 12px; color: #555; margin-bottom: 6px; }
.label-card .parcel { font-size: 11px; color: #888; margin-bottom: 6px; }
.label-card img.barcode { display: block; margin: 6px auto; max-width: 320px; width: 90%; height: 22mm; }
.label-card .label-text { text-align: center; font-size: 14px; font-weight: 700; margin-top: 4px; letter-spacing: 2px; }
.no-labels { text-align: center; color: #999; padding: 60px; font-size: 16px; }
.print-bar { text-align: center; margin: 16px 0; }
.print-bar button { padding: 8px 24px; font-size: 14px; }