* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
       background: #f5f7fb; color: #1f2937; font-size: 14px; }
.hidden { display: none !important; }
.muted { color: #6b7280; }
.small { font-size: 12px; }
.spacer { flex: 1; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
              background: linear-gradient(135deg, #e8f1fb, #f6f8fb); }
.card { background: #fff; border-radius: 14px; box-shadow: 0 10px 30px rgba(30,64,120,.10); }
.login-card { width: 380px; max-width: 92vw; padding: 32px 28px; }
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.sub { margin: 0 0 20px; color: #6b7280; font-size: 13px; }
label { display: block; font-size: 13px; color: #374151; margin: 12px 0 6px; }
input { width: 100%; padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; outline: none; background: #fff; }
input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.msg { margin-top: 12px; font-size: 13px; min-height: 18px; }
.err { color: #dc2626; }

/* 按钮 */
.btn { padding: 8px 14px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; color: #374151;
       font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #9ca3af; }
.btn.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn.primary:hover { background: #1d4ed8; }
.btn.link { border: 0; background: none; color: #2563eb; padding: 6px 8px; }
.btn.danger { color: #dc2626; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.block { width: 100%; margin-top: 20px; padding: 11px; font-size: 15px; }
.btn.xs { padding: 4px 9px; font-size: 12px; }

/* 顶栏 */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 24px;
          padding: 0 24px; height: 56px; background: #fff; border-bottom: 1px solid #e5e7eb; }
.brand { font-weight: 600; font-size: 16px; }
nav { display: flex; gap: 4px; }
nav button { border: 0; background: none; padding: 8px 14px; border-radius: 8px; font-size: 14px; color: #4b5563; cursor: pointer; }
nav button.active { background: #eff6ff; color: #1d4ed8; font-weight: 600; }
.user { margin-left: auto; display: flex; align-items: center; gap: 8px; color: #4b5563; font-size: 13px; }

main { padding: 20px 24px 60px; max-width: 1400px; margin: 0 auto; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.search { width: 260px; }
.filters { display: flex; gap: 8px; margin-bottom: 12px; }
.filters button { border: 1px solid #e5e7eb; background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; color: #4b5563; }
.filters button.active { border-color: #2563eb; color: #1d4ed8; background: #eff6ff; }
.filters i { font-style: normal; color: #9ca3af; margin-left: 2px; }

/* 表格 */
table.grid { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden;
             box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.grid th { text-align: left; font-weight: 500; color: #6b7280; font-size: 12px; background: #f9fafb; padding: 10px 12px; border-bottom: 1px solid #e5e7eb; }
.grid td { padding: 10px 12px; border-bottom: 1px solid #f1f2f4; vertical-align: middle; }
.grid tr:last-child td { border-bottom: 0; }
.grid.compact td { padding: 6px 8px; }
.grid tr.gone td { background: #fef2f2; }
.thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: #f3f4f6; display: block; }
.gname { font-weight: 500; }
.gsub { color: #9ca3af; font-size: 12px; margin-top: 2px; }
.empty { text-align: center; padding: 50px; color: #9ca3af; background: #fff; border-radius: 10px; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.tag.todo { background: #fef3c7; color: #92400e; }
.tag.mapped { background: #dcfce7; color: #166534; }
.tag.ignore { background: #f3f4f6; color: #6b7280; }
.tag.gone { background: #fee2e2; color: #991b1b; }
.tag.type { background: #eef2ff; color: #3730a3; }
.maplist div { font-size: 13px; line-height: 1.6; }
.maplist b { color: #2563eb; font-weight: 600; }

/* 弹窗 */
.mask { position: fixed; inset: 0; background: rgba(17,24,39,.35); display: flex; align-items: center; justify-content: center; z-index: 20; }
.dialog { width: 640px; max-width: 94vw; max-height: 90vh; overflow: auto; background: #fff; border-radius: 12px; padding: 22px 24px; }
.dialog.narrow { width: 420px; }
.dialog h3 { margin: 0 0 12px; }
.goods-head { display: flex; gap: 12px; align-items: center; padding: 10px; background: #f9fafb; border-radius: 8px; }
.row-actions { display: flex; justify-content: space-between; margin-top: 6px; }
.dlg-foot { display: flex; gap: 8px; margin-top: 16px; align-items: center; }

.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); background: #111827; color: #fff;
         padding: 10px 18px; border-radius: 8px; font-size: 13px; z-index: 30; }

.center { text-align: center; }
.tag.gift { background: #fce7f3; color: #9d174d; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: #db2777; cursor: pointer; }

.num { white-space: nowrap; }
input.boxes { width: 64px; padding: 5px 7px; }
.sumbar { margin-top: 10px; padding: 10px 12px; background: #f9fafb; border-radius: 8px; font-size: 13px; }
.trial { margin-top: 10px; padding: 10px 12px; border: 1px dashed #d1d5db; border-radius: 8px; font-size: 13px; }
.trial input { width: 160px; display: inline-block; margin-left: 4px; padding: 5px 8px; }
.trial .maplist { margin-top: 6px; }
.panel { background: #fff; border-radius: 10px; padding: 18px 22px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04); max-width: 820px; }
.panel h3 { margin: 0 0 6px; font-size: 16px; }
.panel h4 { margin: 18px 0 8px; font-size: 14px; }
label.radio { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 14px; cursor: pointer; }
label.radio input { width: auto; }
.inline { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.inline input { width: 260px; }
input.w80 { width: 80px !important; }
input:disabled { background: #f3f4f6; color: #6b7280; }
.dialog { width: 760px; }

select { padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 13px; background: #fff; color: #374151; }
input[type=date] { width: auto; padding: 7px 9px; }
.toolbar.wrap { flex-wrap: wrap; }
.order-table { overflow-x: auto; }
.order-table .grid { min-width: 850px; }
.order-ship-line { display: block; margin: 0 0 5px; }
#oViews { flex-wrap: wrap; }
@media (max-width: 760px) {
  .topbar { height: auto; padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  .topbar nav { order: 3; width: 100%; overflow-x: auto; }
  .topbar nav button { flex: 0 0 auto; min-height: 44px; }
  main { padding-inline: 12px; }
  #tab-orders .toolbar button, #tab-orders .toolbar select { min-height: 44px; }
}
.inline-check { margin: 0 6px; font-size: 13px; }
.statline { margin: 0 0 10px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.addr { max-width: 220px; }
.receiver-dialog { border: 0; color: inherit; width: 500px; }
.receiver-dialog::backdrop { background: rgba(17,24,39,.35); }
.receiver-dialog fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.receiver-region { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.receiver-region select { width: 100%; min-width: 0; }
.receiver-edit { margin-top: 4px; }
@media (max-width: 480px) {
  .receiver-dialog { padding: 18px; }
  .receiver-dialog .btn, .receiver-dialog input, .receiver-edit { min-height: 44px; }
  .receiver-dialog input { font-size: 16px; }
}
.grid tr.warn td { background: #fffbeb; }
.grid td.maplist div { margin: 1px 0; }

.save-state { font-size: 12px; color: #6b7280; padding: 3px 8px; border-radius: 999px; background: #f3f4f6; }
.save-state.ok { color: #166534; background: #dcfce7; }
.save-state.warn { color: #92400e; background: #fef3c7; }
.save-state.err { color: #991b1b; background: #fee2e2; }
.dealer { color: #1d4ed8; }

#oGroup { pointer-events: none; background: #f9fafb; }

#mBody tr.msub td { border-top: 1px dashed #eef0f3; }
#mBody td[rowspan] { vertical-align: top; }

.salon-grid input.sal { width: 100%; min-width: 0; box-sizing: border-box; padding: 5px 7px; font-size: 13px; }
.salon-grid summary { cursor: pointer; white-space: nowrap; }
.salon-extra { display: grid; gap: 6px; margin-top: 6px; }
.salon-extra label { display: grid; gap: 2px; }
.cfg-grid { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; align-items: center; max-width: 560px; margin: 10px 0; }
.cfg-grid label { margin: 0; }
