/* ============================================================
   全局
============================================================ */
* { box-sizing: border-box; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", Segoe UI, Arial, sans-serif;
  margin: 0; padding: 0; background: #f5f7fb; color: #1f2937;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: #6b7280; }
.small { font-size: 12px; }
.error { background: #fee2e2; color: #b91c1c; padding: 8px 12px; border-radius: 6px; margin: 8px 0; }

/* ============================================================
   登录
============================================================ */
.login-body {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-card {
  background: #fff; padding: 32px; border-radius: 12px;
  width: 360px; box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.login-card h1 { margin: 0 0 4px 0; }
.login-card form { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; }
.login-card label { font-size: 13px; color: #374151; margin-top: 6px; }
.login-card input {
  padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px;
}
.login-card input:focus { outline: none; border-color: #2563eb; }
.login-card button {
  margin-top: 14px; padding: 11px; background: #2563eb; color: #fff;
  border: none; border-radius: 6px; font-size: 15px; cursor: pointer;
}
.login-card button:hover { background: #1d4ed8; }

/* ============================================================
   顶部栏
============================================================ */
.topbar {
  background: #1f2937; color: #e5e7eb; padding: 10px 22px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar a { color: #cbd5e1; margin-left: 14px; }
.topbar .clock { font-size: 20px; font-weight: 600; margin-right: 16px; color: #fde68a; }
.topbar .shop-name { font-size: 16px; }

/* ============================================================
   操作条
============================================================ */
.actions {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 22px; background: #fff; border-bottom: 1px solid #e5e7eb;
}
.actions button.primary {
  background: #10b981; color: #fff; border: none; padding: 9px 18px;
  border-radius: 6px; cursor: pointer; font-size: 14px;
}
.actions button.primary:hover { background: #059669; }
.actions .stats { margin-left: auto; display: flex; gap: 18px; align-items: center; color: #374151; font-size: 14px; }
.actions .stats b { color: #059669; }
.actions .dot { color: #dc2626; font-size: 16px; cursor: help; }
.actions .dot.online { color: #10b981; }
.actions .dot.offline { color: #dc2626; }

/* ============================================================
   订单面板
============================================================ */
.order-board { padding: 12px 22px; }
.order-row {
  display: grid;
  /* 默认窄屏 5 列（隐藏"客户"，由 dashboard.html 内联样式按断点恢复） */
  grid-template-columns: minmax(56px, 1.2fr) minmax(72px, 1.2fr) auto minmax(96px, 2fr) minmax(72px, 1fr);
  background: #fff; border-radius: 8px; padding: 12px 16px; margin-bottom: 8px;
  align-items: center; font-size: 15px; column-gap: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  animation: slideIn 0.4s ease;
  min-width: 0;                       /* 关键：避免 grid 子项超出容器 */
}
.order-row > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; }   /* 兜底：所有 cell 不撑爆 */
.order-row.head {
  background: transparent; box-shadow: none; color: #6b7280; font-weight: 500;
  font-size: 13px; padding: 6px 16px;
}
.order-row .amount { color: #dc2626; font-weight: 600; font-size: 17px; white-space: nowrap; }
.order-row .ago, .order-row .time { white-space: nowrap; }
.order-row .ok { color: #059669; }
.order-row .badge {
  display: inline-block; width: 26px; height: 26px; border-radius: 50%;
  color: #fff; text-align: center; line-height: 26px; font-weight: bold; font-size: 13px;
}
.badge.green { background: #10b981; }
.badge.blue { background: #1677ff; }
.badge.gray { background: #6b7280; }
.empty { text-align: center; color: #9ca3af; padding: 60px 0; font-size: 14px; }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   弹窗（生成二维码）
============================================================ */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); align-items: center; justify-content: center; }
.modal.show { display: flex; }
.modal-card { background: #fff; border-radius: 12px; padding: 24px; width: 360px; max-width: 92vw; }
.modal-card h3 { margin: 0 0 12px; }
.modal-card label { display: block; font-size: 13px; color: #374151; margin-top: 10px; }
.modal-card input {
  width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px;
}
.modal-card .modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-card button {
  flex: 1; padding: 9px; border: none; border-radius: 6px; cursor: pointer; background: #e5e7eb;
}
.modal-card button.primary { background: #2563eb; color: #fff; }
.qr-result { margin-top: 16px; text-align: center; }
.qr-result img { border: 1px solid #e5e7eb; padding: 8px; background: #fff; }
.qr-result code { word-break: break-all; }

/* ============================================================
   设置页
============================================================ */
.settings { max-width: 680px; margin: 24px auto; padding: 0 22px; }
.settings fieldset {
  border: 1px solid #e5e7eb; border-radius: 8px; padding: 16px 20px; margin-bottom: 16px;
}
.settings legend { padding: 0 8px; color: #374151; font-weight: 500; }
.settings label { display: block; font-size: 13px; color: #374151; margin-top: 10px; }
.settings input {
  width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px;
}
.settings input[readonly] { background: #f3f4f6; color: #6b7280; }
.settings button.primary {
  background: #2563eb; color: #fff; border: none; padding: 10px 22px;
  border-radius: 6px; cursor: pointer;
}
.settings button:not(.primary) {
  background: #f59e0b; color: #fff; border: none; padding: 10px 22px;
  border-radius: 6px; cursor: pointer; margin-left: 10px;
}
.settings .actions-row { display: flex; align-items: center; margin-top: 8px; }

/* ============================================================
   支付状态大弹窗（扫码中 / 取消 / 付款成功）
============================================================ */
.pay-toast {
  display: none; position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,0.35);
  align-items: center; justify-content: center;
  animation: toastIn 0.25s ease;
}
.pay-toast.show { display: flex; }
.pay-toast-card {
  background: #fff; border-radius: 20px; padding: 36px 56px;
  text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  border-top: 6px solid #2563eb;
  min-width: 300px;
}
.pay-toast-card.paid { border-top-color: #10b981; }
.pay-toast-card.canceled { border-top-color: #f59e0b; }
.pay-toast-icon {
  width: 72px; height: 72px; margin: 0 auto 14px;
  border-radius: 50%; color: #fff; font-size: 40px; font-weight: bold;
  background: #2563eb; line-height: 72px;
}
.pay-toast-card.paid .pay-toast-icon { background: #10b981; }
.pay-toast-card.canceled .pay-toast-icon { background: #f59e0b; }
.pay-toast-title { font-size: 26px; font-weight: 700; color: #1f2937; }
.pay-toast-card.paid .pay-toast-title { color: #059669; }
.pay-toast-card.canceled .pay-toast-title { color: #d97706; }
.pay-toast-amount { font-size: 44px; font-weight: 800; color: #dc2626; margin-top: 8px; }
.pay-toast-sub { font-size: 14px; color: #6b7280; margin-top: 10px; }
.order-row .canceled { color: #d97706; }

@keyframes toastIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* ============================================================
   响应式（兜底：窄屏压缩间距；具体列宽交给 dashboard.html 的内联 <style> 用 vw 控制）
============================================================ */
@media (max-width: 720px) {
  .actions { flex-wrap: wrap; }
  .actions .stats { width: 100%; margin-left: 0; }
  .topbar { padding: 8px 14px; }
  .topbar a { margin-left: 8px; }
}
@media (max-width: 420px) {
  .order-board { padding: 8px 10px; }
  .topbar .shop-name { display: none; }     /* 超窄屏隐藏店铺名，腾出给订单 */
}
