/* 商品查询系统 - 样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f0f2f5;
  color: #333;
  min-height: 100vh;
}

.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  padding: 24px 0;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.header h1 { font-size: 24px; font-weight: 600; }
.header p { font-size: 14px; opacity: 0.85; margin-top: 6px; }

.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* 模式开关 */
.mode-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: 12px;
  padding: 14px 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  flex-wrap: wrap;
}
.mode-switch .label { font-size: 13px; color: #666; font-weight: 500; }

.seg {
  display: inline-flex;
  background: #f0f2f5;
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
}
.seg button {
  border: none;
  background: transparent;
  padding: 7px 18px;
  border-radius: 6px;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
}
.seg button.active {
  background: #667eea;
  color: #fff;
  font-weight: 500;
  box-shadow: 0 1px 4px rgba(102,126,234,0.4);
}
.seg button:hover:not(.active) { background: #e4e7f0; }
.mode-hint { font-size: 12px; color: #999; margin-left: auto; }

/* 筛选栏 */
.filter-bar {
  background: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
}
.filter-group { display: flex; flex-direction: column; gap: 6px; }
.filter-group label { font-size: 13px; font-weight: 500; color: #666; }

.filter-group select {
  padding: 8px 32px 8px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  font-size: 14px;
  color: #333;
  background: #fff;
  cursor: pointer;
  min-width: 200px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.2s;
}
.filter-group select:hover { border-color: #667eea; }
.filter-group select:focus { border-color: #667eea; outline: none; box-shadow: 0 0 0 2px rgba(102,126,234,0.2); }

.search-box {
  padding: 8px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  font-size: 14px;
  min-width: 220px;
  transition: border-color 0.2s;
}
.search-box:focus { border-color: #667eea; outline: none; box-shadow: 0 0 0 2px rgba(102,126,234,0.2); }

.stats {
  font-size: 13px;
  color: #999;
  margin-left: auto;
  align-self: center;
  white-space: nowrap;
}
.stats strong { color: #667eea; font-size: 16px; }

/* 表格 */
.table-wrapper {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  overflow: hidden;
}
.table-scroll { overflow-x: auto; max-height: calc(100vh - 320px); overflow-y: auto; }
table { width: 100%; border-collapse: collapse; }
thead { position: sticky; top: 0; z-index: 10; }
thead th {
  background: #fafafa;
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: #666;
  border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;
}
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: #f5f7ff; }
tbody td {
  padding: 10px 16px;
  font-size: 14px;
  border-bottom: 1px solid #f5f5f5;
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.td-cid { color: #999; font-family: monospace; font-size: 13px; }
.td-name { font-weight: 500; color: #333; }
.td-price { color: #e74c3c; font-weight: 600; font-family: monospace; }

.empty-state { text-align: center; padding: 60px 20px; color: #999; }
.empty-state svg { width: 64px; height: 64px; margin-bottom: 16px; opacity: 0.4; }
.empty-state p { font-size: 15px; }

.loading { text-align: center; padding: 40px; color: #999; font-size: 14px; }

/* 标签 */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.tag-platform { background: #e8f5e9; color: #2e7d32; }
.tag-channel { background: #fff3e0; color: #e65100; }
.tag-cat { background: #eef0ff; color: #4c5bd4; }

@media (max-width: 768px) {
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-group select, .search-box { min-width: auto; width: 100%; }
  .stats { margin-left: 0; text-align: center; }
  .mode-hint { display: none; }
}

/* ---------- 下单弹窗 ---------- */
.modal-mask {
  display: none;
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.45);
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal-mask.show { display: flex; }

.modal {
  width: 520px; max-width: 100%; max-height: 92vh; overflow-y: auto;
  background: #fff; border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.28);
}
.modal-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid #f0f0f0;
  position: sticky; top: 0; background: #fff; z-index: 1;
  border-radius: 14px 14px 0 0;
}
.modal-hd h3 { font-size: 16px; font-weight: 600; }
.modal-x {
  border: none; background: transparent; font-size: 18px;
  color: #999; cursor: pointer; line-height: 1; padding: 4px;
}
.modal-x:hover { color: #333; }

.modal-bd { padding: 20px 22px 22px; }

.order-item {
  background: #fafbff; border: 1px solid #eef0ff; border-radius: 10px;
  padding: 14px 16px; margin-bottom: 18px; font-size: 13px;
}
.order-item .nm { font-weight: 600; color: #333; margin-bottom: 8px; line-height: 1.5; }
.order-item .meta { display: flex; gap: 16px; flex-wrap: wrap; color: #888; font-size: 12.5px; }
.order-item .meta b { color: #e74c3c; font-size: 15px; font-family: monospace; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: #666; margin-bottom: 6px; font-weight: 500; }
.field label .req { color: #e74c3c; }
.field input {
  width: 100%; padding: 9px 12px; border: 1px solid #d9d9d9; border-radius: 8px;
  font-size: 14px; font-family: inherit; transition: border-color .2s;
}
.field input:focus { border-color: #667eea; outline: none; box-shadow: 0 0 0 2px rgba(102,126,234,.18); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.warn-box {
  background: #fffbe6; border: 1px solid #ffe58f; color: #ad6800;
  padding: 11px 14px; border-radius: 8px; font-size: 12.5px; line-height: 1.7;
  margin: 4px 0 18px;
}

.modal-bar { display: flex; gap: 10px; justify-content: flex-end; }
.btn {
  padding: 9px 20px; border: none; border-radius: 8px; font-size: 14px;
  cursor: pointer; font-family: inherit; font-weight: 500; transition: background .2s;
}
.btn-primary { background: #667eea; color: #fff; }
.btn-primary:hover { background: #5a6fd8; }
.btn-primary:disabled { background: #aab4f0; cursor: not-allowed; }
.btn-plain { background: #f0f2f5; color: #555; }
.btn-plain:hover { background: #e4e7f0; }

.btn-order {
  padding: 4px 12px; border: 1px solid #667eea; background: #fff; color: #667eea;
  border-radius: 6px; font-size: 12.5px; cursor: pointer; font-family: inherit;
  transition: all .18s; white-space: nowrap;
}
.btn-order:hover { background: #667eea; color: #fff; }

.order-result {
  margin-top: 18px; padding: 14px 16px; border-radius: 10px; font-size: 13px; line-height: 1.8;
}
.order-result.ok { background: #f6ffed; border: 1px solid #b7eb8f; color: #389e0d; }
.order-result.err { background: #fff1f0; border: 1px solid #ffccc7; color: #cf1322; }
.order-result .oid { font-family: monospace; font-size: 14px; font-weight: 600; }

@media (max-width: 560px) {
  .grid2 { grid-template-columns: 1fr; }
  .modal { width: 100%; }
}
/* ---------- 订单查询区 ---------- */
.query-panel {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  background: #fff;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  flex-wrap: wrap;
}
.query-left { flex: 1; min-width: 240px; }
.query-mid { display: flex; flex-direction: column; }
.query-panel label {
  display: block;
  font-size: 13px; font-weight: 500; color: #666; margin-bottom: 7px;
}
.query-row { display: flex; gap: 8px; align-items: center; }

.query-input {
  width: 100%; padding: 9px 12px; border: 1px solid #d9d9d9;
  border-radius: 8px; font-size: 14px; font-family: inherit;
  transition: border-color .2s;
}
.query-input:focus { border-color: #667eea; outline: none; box-shadow: 0 0 0 2px rgba(102,126,234,.18); }

.captcha-input {
  width: 120px; padding: 9px 12px; border: 1px solid #d9d9d9; border-radius: 8px;
  font-size: 15px; font-family: Consolas, monospace; letter-spacing: 3px;
  text-transform: uppercase; text-align: center;
}
.captcha-input:focus { border-color: #667eea; outline: none; box-shadow: 0 0 0 2px rgba(102,126,234,.18); }

.captcha-img {
  width: 130px; height: 46px; border-radius: 8px; cursor: pointer;
  border: 1px solid #e5e8f0; display: block;
  object-fit: cover;
}
.captcha-img:hover { border-color: #667eea; }

.btn-query {
  padding: 9px 28px; background: #667eea; color: #fff; border: none;
  border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer;
  font-family: inherit; transition: background .2s; height: 42px;
}
.btn-query:hover { background: #5a6fd8; }
.btn-query:disabled { background: #aab4f0; cursor: not-allowed; }

/* 查询结果 */
.q-item {
  border: 1px solid #eef0f5; border-radius: 10px;
  padding: 16px 18px; margin-bottom: 14px;
}
.q-item:last-child { margin-bottom: 0; }
.q-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.q-head .kc { font-size: 15px; font-weight: 600; color: #333; line-height: 1.5; }
.q-status {
  font-size: 12px; padding: 3px 10px; border-radius: 5px; white-space: nowrap;
}
.q-status.st-ok    { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.q-status.st-run   { background: #e6f4ff; color: #0958d9; border: 1px solid #91caff; }
.q-status.st-fail  { background: #fff1f0; color: #cf1322; border: 1px solid #ffccc7; }
.q-status.st-idle  { background: #fafafa; color: #999;    border: 1px solid #e8e8e8; }

.q-proc {
  background: #fafbff; border-radius: 8px; padding: 12px 14px;
  font-size: 13px; line-height: 1.8; color: #555; margin-bottom: 12px;
  word-break: break-word;
}
.q-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 20px;
  font-size: 12.5px; color: #888;
}
.q-grid span b { color: #555; font-family: Consolas, monospace; font-weight: 500; }
.q-grid .full { grid-column: 1 / -1; }

@media (max-width: 640px) {
  .query-panel { flex-direction: column; align-items: stretch; }
  .btn-query { width: 100%; }
  .q-grid { grid-template-columns: 1fr; }
}
/* 查询方式切换 */
.q-tabs { display: flex; gap: 6px; width: 100%; margin-bottom: 4px; }
.q-tab {
  padding: 6px 16px; border: 1px solid #dfe3ee; background: #fff;
  border-radius: 7px; font-size: 13px; color: #666; cursor: pointer;
  font-family: inherit; transition: all .18s;
}
.q-tab.active { background: #667eea; border-color: #667eea; color: #fff; font-weight: 500; }
.q-tab:hover:not(.active) { border-color: #667eea; color: #667eea; }
/* ---------- 顶部用户栏 ---------- */
.user-bar {
  background: #fff;
  border-bottom: 1px solid #eef0f5;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.user-bar-in {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.ub-logo { font-size: 14px; font-weight: 600; color: #667eea; }
.ub-spacer { flex: 1; }

.ub-guest, .ub-user { display: flex; align-items: center; gap: 10px; }

.ub-btn {
  padding: 6px 16px; border-radius: 7px; font-size: 13px; text-decoration: none;
  color: #666; border: 1px solid #e3e7f0; background: #fff; transition: all .18s;
  white-space: nowrap;
}
.ub-btn:hover { border-color: #667eea; color: #667eea; }
.ub-btn-primary { background: #667eea; border-color: #667eea; color: #fff; }
.ub-btn-primary:hover { background: #5a6fd8; border-color: #5a6fd8; color: #fff; }

.ub-money {
  font-size: 13px; color: #888;
  padding: 5px 12px; background: #f6ffed;
  border: 1px solid #d9f2c4; border-radius: 7px;
}
.ub-money b { color: #389e0d; font-size: 14px; font-family: Consolas, monospace; }

.ub-name { font-size: 13px; color: #555; white-space: nowrap; }

@media (max-width: 640px) {
  .user-bar-in { padding: 8px 12px; gap: 8px; }
  .ub-logo { display: none; }
  .ub-money { padding: 4px 9px; font-size: 12px; }
  .ub-name { display: none; }
}
/* 下单弹窗内的余额提示 */
.bal-line {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 12.5px;
  line-height: 1.6;
}
.bal-line.ok { background: #f6ffed; border: 1px solid #d9f2c4; color: #389e0d; }
.bal-line.no { background: #fff2e8; border: 1px solid #ffd8bf; color: #d4380d; }