/* 打印后台通用样式 */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #F5F6F8;
  color: #1F2937;
  font-size: 14px;
}
.topbar {
  background: linear-gradient(135deg, #FF8A3D, #FF6B35);
  color: #fff;
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { font-weight: 700; font-size: 16px; }
.topbar nav a { color: rgba(255,255,255,.9); text-decoration: none; margin-left: 18px; padding: 6px 2px; }
.topbar nav a.active { font-weight: 700; border-bottom: 2px solid #fff; }

main { max-width: 860px; margin: 0 auto; padding: 24px 16px 80px; }
h1 { font-size: 20px; margin-bottom: 6px; }
.hint { color: #9CA3AF; margin-bottom: 16px; }

.card {
  background: #fff;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: 0 1px 6px rgba(31,41,55,.05);
}
.card h2 { font-size: 15px; margin-bottom: 12px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: block; font-size: 12px; color: #6B7280; margin-bottom: 4px; }
input, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  font-size: 14px;
  margin-top: 4px;
  font-family: inherit;
}
input:focus, textarea:focus { outline: none; border-color: #FF6B35; }
textarea { resize: vertical; }

/* 列表行（尺寸/规格/底色/步骤） */
.row {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1.4fr 1fr 0.6fr 0.5fr;
  align-items: center;
  margin-bottom: 8px;
}
.row .ico { text-align: center; font-size: 18px; }
.row input { margin: 0; }
.del { border: none; background: #FEF2F2; color: #EF4444; border-radius: 8px; padding: 7px 0; cursor: pointer; }
.btn-mini { margin-top: 4px; border: 1px dashed #FFB08A; background: #FFF7F0; color: #FF6B35; border-radius: 8px; padding: 7px 14px; cursor: pointer; }

.actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 18px; }
.btn { border: none; border-radius: 10px; padding: 11px 26px; font-size: 15px; cursor: pointer; }
.btn.primary { background: linear-gradient(135deg,#FF8A3D,#FF6B35); color: #fff; font-weight: 600; }
.btn.ghost { background: #fff; color: #6B7280; border: 1px solid #E5E7EB; }

.toast {
  position: fixed;
  left: 50%; bottom: 40px;
  transform: translateX(-50%);
  background: #111827; color: #fff;
  padding: 10px 22px; border-radius: 24px;
  font-size: 13px;
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.toast.show { opacity: 1; }

/* 订单列表 */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin: 14px 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid #E5E7EB; background: #fff; border-radius: 16px; padding: 5px 12px; font-size: 12px; color: #6B7280; cursor: pointer; }
.chip.on { background: #FF6B35; color: #fff; border-color: #FF6B35; }

.order-list { display: flex; flex-direction: column; gap: 10px; }
.order {
  background: #fff; border-radius: 12px; padding: 14px 16px;
  box-shadow: 0 1px 6px rgba(31,41,55,.05);
}
.order-head { display: flex; justify-content: space-between; align-items: center; }
.order-title { font-weight: 600; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; }
.tag-pending { background: #FFF3EC; color: #FF6B35; }
.tag-paid { background: #EDF3FE; color: #3B82F6; }
.tag-printing { background: #FEF3C7; color: #D97706; }
.tag-ready { background: #E8F8F0; color: #1DBE8B; }
.tag-done { background: #F1F2F4; color: #6B7280; }
.order-meta { color: #9CA3AF; font-size: 12px; margin: 6px 0 10px; }
.order-code { background: #FFF7F0; border-radius: 8px; padding: 8px 12px; display: inline-block; font-size: 15px; font-weight: 700; color: #FF6B35; letter-spacing: 2px; margin-bottom: 10px; }
.order-note { color: #EF4444; font-size: 12px; margin-bottom: 8px; }
.order-items { border-top: 1px solid #F3F4F6; padding-top: 8px; margin-bottom: 10px; }
.order-item { display: flex; justify-content: space-between; font-size: 13px; color: #374151; padding: 3px 0; }
.order-item a { color: #3B82F6; text-decoration: none; margin-left: 8px; }
.order-actions { display: flex; gap: 8px; }
.order-actions button { border: none; border-radius: 8px; padding: 7px 14px; font-size: 13px; cursor: pointer; }
.act-print { background: #EDF3FE; color: #3B82F6; }
.act-ready { background: #E8F8F0; color: #1DBE8B; }
.act-done { background: #F1F2F4; color: #6B7280; }
.act-pay { background: #FFF3EC; color: #FF6B35; }
.act-chat { background: #F1F5FE; color: #4F7CF6; }

.empty { text-align: center; color: #9CA3AF; padding: 60px 0; }
.hidden { display: none; }

/* 关键修复：.order-alert / .login-mask 自带 display:flex，会盖过通用 .hidden（同优先级、定义更靠后）。
   这里用更高优先级（双类）确保 hidden 真正生效，否则来单弹窗点「确定」关不掉。 */
.order-alert.hidden { display: none; }
.login-mask.hidden { display: none; }

/* 未登录时彻底隐藏后台正文与顶栏，防止遮罩半透明透出业务内容 */
body.auth-locked .topbar,
body.auth-locked main { display: none; }

/* 来单提示弹层 */
.order-alert {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(17, 24, 39, 0.55);
  display: flex; align-items: center; justify-content: center;
}
.alert-box {
  background: #FFFFFF; border-radius: 16px;
  padding: 40px 48px 32px; text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: alert-pop 0.3s ease;
}
@keyframes alert-pop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.alert-icon { font-size: 52px; }
.alert-title { font-size: 26px; font-weight: 700; color: #111827; margin-top: 14px; }
.alert-sub { font-size: 15px; color: #6B7280; margin: 10px 0 24px; }
.alert-sub b { color: #EF4444; font-size: 18px; }
.alert-btn {
  background: #FF6B35; color: #FFFFFF; border: none; border-radius: 10px;
  padding: 12px 56px; font-size: 17px; font-weight: 600; cursor: pointer;
}
.alert-btn:hover { background: #F05A24; }

/* 客服对话面板 */
.chat-panel { position: fixed; right: 20px; bottom: 20px; width: 340px; height: 460px; background: #FFFFFF; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,0.18); display: flex; flex-direction: column; overflow: hidden; z-index: 99; }
.chat-panel.hidden { display: none; }
.chat-head { background: #FF6B35; color: #FFFFFF; padding: 10px 14px; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.chat-close { cursor: pointer; opacity: 0.9; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 12px; background: #F9FAFB; }
.chat-msg { margin-bottom: 10px; display: flex; flex-direction: column; }
.chat-msg.shop { align-items: flex-end; }
.chat-bubble { max-width: 78%; padding: 8px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-all; }
.chat-msg.customer .chat-bubble { background: #FFFFFF; border: 1px solid #E5E7EB; }
.chat-msg.shop .chat-bubble { background: #FF6B35; color: #FFFFFF; }
.chat-time { font-size: 11px; color: #9CA3AF; margin-top: 3px; }
.chat-input { display: flex; border-top: 1px solid #F3F4F6; padding: 10px; gap: 8px; }
.chat-input input { flex: 1; border: 1px solid #E5E7EB; border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.chat-input .btn { background: #FF6B35; color: #FFFFFF; border: none; border-radius: 8px; padding: 0 16px; cursor: pointer; }

/* ---------- 登录弹层（用户名 + 登录密码） ---------- */
.login-mask { position: fixed; inset: 0; z-index: 1000; background: #F5F6F8; display: flex; align-items: center; justify-content: center; }
.login-card { background: #FFFFFF; border-radius: 16px; padding: 32px 36px; width: 320px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); text-align: center; animation: alert-pop 0.25s ease; }
.login-ico { font-size: 46px; }
.login-title { font-size: 20px; font-weight: 700; margin-top: 8px; }
.login-sub { font-size: 13px; color: #9CA3AF; margin: 6px 0 18px; }
.login-label { display: block; text-align: left; font-size: 12px; color: #6B7280; margin-bottom: 10px; }
.login-label input { width: 100%; padding: 9px 11px; border: 1px solid #E5E7EB; border-radius: 8px; font-size: 14px; margin-top: 4px; }
.login-label input:focus { outline: none; border-color: #FF6B35; }
.login-err { color: #EF4444; font-size: 12px; min-height: 16px; margin-bottom: 8px; }
.login-submit { width: 100%; margin-top: 4px; }

/* 顶栏已登录用户区 */
.user-area { display: none; align-items: center; margin-left: 16px; }
.user-name { color: rgba(255, 255, 255, 0.95); font-size: 13px; margin-right: 10px; }
.logout-btn { border: 1px solid rgba(255, 255, 255, 0.6); background: transparent; color: #fff; border-radius: 8px; padding: 4px 12px; font-size: 13px; cursor: pointer; }
.logout-btn:hover { background: rgba(255, 255, 255, 0.15); }
