/* ============ 好熹头管理后台 全局样式 ============ */
:root {
  --brand: #f97316;
  --brand-light: #fb9a52;
  --brand-dark: #dd620c;
  --brand-bg: #fff3e8;
  --text-1: #2b211a;
  --text-2: #6e5f52;
  --text-3: #a89b8e;
  --border: #f1e6da;
  --bg: #f6f4f1;
  --card: #ffffff;
  --green: #00b42a;
  --red: #f53f3f;
  --blue: #2b7cff;
  --gold: #d9a13b;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(43, 33, 26, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  font-size: 14px;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; outline: none; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #d8cfc7; border-radius: 3px; }

/* ============ 登录页 ============ */
.login-page {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fb9a52 0%, #f97316 55%, #dd620c 100%);
}
.login-card {
  width: 400px;
  background: var(--card);
  border-radius: 20px;
  padding: 44px 40px 36px;
  box-shadow: 0 24px 64px rgba(120, 50, 0, 0.28);
}
.login-logo {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, #fb9a52, #f97316);
  color: #fff; font-size: 26px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.login-title { text-align: center; font-size: 22px; font-weight: 700; }
.login-sub { text-align: center; color: var(--text-3); font-size: 13px; margin: 6px 0 28px; }
.login-field { margin-bottom: 16px; }
.login-field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.login-field input {
  width: 100%; height: 42px; border: 1px solid var(--border);
  border-radius: 10px; padding: 0 14px; font-size: 14px; transition: border 0.15s;
}
.login-field input:focus { border-color: var(--brand); }
.login-btn {
  width: 100%; height: 44px; border: none; border-radius: 10px;
  background: linear-gradient(135deg, #fb9a52, #f97316);
  color: #fff; font-size: 15px; font-weight: 600; margin-top: 8px;
  transition: opacity 0.15s;
}
.login-btn:hover { opacity: 0.9; }
.login-hint { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 18px; }
.login-error { color: var(--red); font-size: 13px; text-align: center; margin-bottom: 10px; min-height: 18px; }

/* ============ 整体布局 ============ */
.layout { display: flex; height: 100%; overflow: hidden; }
.sidebar {
  width: 232px; flex-shrink: 0; background: var(--card);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow-y: auto;
}
.side-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px 16px;
}
.side-logo .mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, #fb9a52, #f97316);
  color: #fff; font-weight: 700; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
}
.side-logo .name { font-size: 16px; font-weight: 700; }
.side-logo .en { font-size: 11px; color: var(--text-3); margin-top: 1px; }

.nav-group { padding: 6px 12px; }
.nav-group-title {
  font-size: 11px; color: var(--text-3); padding: 12px 10px 6px;
  letter-spacing: 1px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  color: var(--text-2); margin-bottom: 2px;
  transition: all 0.15s; user-select: none;
}
.nav-item:hover { background: var(--brand-bg); color: var(--brand-dark); }
.nav-item.active { background: linear-gradient(135deg, #fb9a52, #f97316); color: #fff; font-weight: 600; }
.nav-item .ico { width: 20px; text-align: center; font-size: 15px; }
.nav-item .badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: 11px; border-radius: 8px; padding: 0 6px; min-width: 18px;
  height: 18px; line-height: 18px; text-align: center;
}

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 60px; background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px; gap: 12px; flex-shrink: 0;
}
.topbar .title { font-size: 17px; font-weight: 700; }
.topbar .sub { color: var(--text-3); font-size: 12px; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #fb9a52, #f97316);
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.topbar .user { font-size: 13px; color: var(--text-2); }
.link-btn { background: none; border: none; color: var(--text-3); font-size: 13px; }
.link-btn:hover { color: var(--brand); }

.content { flex: 1; overflow-y: auto; padding: 20px 24px 40px; }

/* ============ 通用组件 ============ */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px;
}
.card-head { display: flex; align-items: center; margin-bottom: 14px; gap: 12px; }
.card-head .c-title { font-size: 15px; font-weight: 700; }
.card-head .spacer { flex: 1; }

.btn {
  border: none; border-radius: 8px; padding: 0 16px; height: 34px;
  font-size: 13px; transition: all 0.15s; display: inline-flex;
  align-items: center; gap: 5px; white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg, #fb9a52, #f97316); color: #fff; font-weight: 600; }
.btn-primary:hover { opacity: 0.88; }
.btn-plain { background: var(--brand-bg); color: var(--brand-dark); }
.btn-plain:hover { background: #ffe4cc; }
.btn-ghost { background: #fff; border: 1px solid var(--border); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-danger { background: #fff1f0; color: var(--red); }
.btn-danger:hover { background: #ffccc7; }
.btn-sm { height: 27px; padding: 0 10px; font-size: 12px; border-radius: 6px; }

.search-input {
  height: 34px; width: 240px; border: 1px solid var(--border);
  border-radius: 8px; padding: 0 12px; font-size: 13px;
}
.search-input:focus { border-color: var(--brand); }
.filter-select {
  height: 34px; border: 1px solid var(--border); border-radius: 8px;
  padding: 0 8px; font-size: 13px; color: var(--text-2); background: #fff;
}

/* 表格 */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 12px; color: var(--text-3); font-weight: 500;
  padding: 10px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl td { padding: 11px 10px; border-bottom: 1px solid #f7f2ec; font-size: 13px; vertical-align: middle; }
.tbl tr:hover td { background: #fffaf5; }
.tbl .cell-main { font-weight: 600; color: var(--text-1); }
.tbl .cell-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.tbl .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty-tip { text-align: center; color: var(--text-3); padding: 40px 0; font-size: 13px; }

.thumb {
  width: 46px; height: 46px; border-radius: 8px; object-fit: cover;
  background: var(--brand-bg); display: block;
}
.thumb.round { border-radius: 50%; }
.thumb.empty {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 11px;
}

/* 徽标 */
.badge-tag {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 12px; white-space: nowrap;
}
.bg-green { background: #e8ffea; color: var(--green); }
.bg-red { background: #fff1f0; color: var(--red); }
.bg-orange { background: var(--brand-bg); color: var(--brand-dark); }
.bg-blue { background: #eaf2ff; color: var(--blue); }
.bg-gold { background: #fff7e3; color: var(--gold); }
.bg-gray { background: #f2efec; color: var(--text-3); }
.money { color: var(--brand); font-weight: 700; }
.money-origin { color: var(--text-3); text-decoration: line-through; font-size: 12px; margin-left: 4px; }

/* 分页 */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.pager .info { color: var(--text-3); font-size: 12px; }
.pager button {
  height: 28px; min-width: 28px; border: 1px solid var(--border);
  background: #fff; border-radius: 6px; color: var(--text-2); font-size: 12px;
}
.pager button.current { background: var(--brand); color: #fff; border-color: var(--brand); }
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(30, 18, 8, 0.45);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: #fff; border-radius: 16px; width: 620px; max-width: 94vw;
  max-height: 88vh; display: flex; flex-direction: column;
  animation: pop 0.18s ease;
}
@keyframes pop { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head {
  padding: 18px 22px 12px; display: flex; align-items: center;
  border-bottom: 1px solid var(--border);
}
.modal-head .m-title { font-size: 16px; font-weight: 700; }
.modal-head .close {
  margin-left: auto; border: none; background: none; font-size: 20px;
  color: var(--text-3); line-height: 1;
}
.modal-head .close:hover { color: var(--red); }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px 18px; display: flex; justify-content: flex-end; gap: 10px; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-item { display: flex; flex-direction: column; }
.form-item.full { grid-column: 1 / -1; }
.form-item label { font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.form-item label .req { color: var(--red); margin-left: 2px; }
.form-item input, .form-item select, .form-item textarea {
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px;
  font-size: 13px; transition: border 0.15s; background: #fff;
}
.form-item textarea { resize: vertical; min-height: 64px; }
.form-item input:focus, .form-item select:focus, .form-item textarea:focus { border-color: var(--brand); }
.img-preview {
  margin-top: 8px; width: 88px; height: 88px; border-radius: 10px;
  object-fit: cover; border: 1px solid var(--border); background: var(--brand-bg);
}
.switch-row { display: flex; align-items: center; gap: 8px; }
.switch-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand); }
.c-sub { font-size: 13px; font-weight: 600; color: var(--text-1); }
.nb-coupon-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin-top: 6px; cursor: pointer; font-size: 13px; }
.nb-coupon-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); }
.nb-coupon-row:hover { border-color: var(--brand); }

/* 看板 */
.stat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 16px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; position: relative; overflow: hidden; cursor: default;
}
.stat-card .num { font-size: 26px; font-weight: 800; margin-top: 6px; }
.stat-card .lbl { font-size: 12px; color: var(--text-3); }
.stat-card .ico {
  position: absolute; right: 12px; top: 12px; width: 34px; height: 34px;
  border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.stat-card.warn .num { color: var(--brand-dark); }

.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }

/* 文案管理 */
.text-row {
  display: grid; grid-template-columns: 210px 1fr; gap: 14px; align-items: start;
  padding: 12px 0; border-bottom: 1px dashed var(--border);
}
.text-row:last-child { border-bottom: none; }
.text-row .k { font-size: 13px; color: var(--text-2); padding-top: 9px; }
.text-row .k .key { display: block; font-size: 11px; color: var(--text-3); }
.text-row input {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; font-size: 13px;
}
.text-row input:focus { border-color: var(--brand); }

/* 组件配置 */
.comp-row {
  display: flex; align-items: center; padding: 14px 4px; border-bottom: 1px dashed var(--border);
}
.comp-row:last-child { border-bottom: none; }
.comp-row .info { flex: 1; }
.comp-row .info .t { font-weight: 600; }
.comp-row .info .d { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.comp-toggle { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.comp-toggle input { opacity: 0; width: 100%; height: 100%; position: absolute; cursor: pointer; z-index: 2; margin: 0; }
.comp-toggle .track {
  position: absolute; inset: 0; background: #ddd3c8; border-radius: 12px; transition: 0.2s;
}
.comp-toggle .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  background: #fff; border-radius: 50%; transition: 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.comp-toggle input:checked + .track { background: var(--brand); }
.comp-toggle input:checked + .track::after { left: 21px; }

.grid-row { display: grid; grid-template-columns: 1fr 90px 1fr 60px; gap: 10px; align-items: center; padding: 8px 0; }
.grid-row input, .grid-row select { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 13px; width: 100%; background: #fff; }
.grid-row select { cursor: pointer; color: var(--text-2); }
.grid-row .preview {
  width: 34px; height: 34px; border-radius: 10px; color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.grid-head { font-size: 12px; color: var(--text-3); padding: 6px 0; }

/* Toast */
.toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  background: rgba(30, 18, 8, 0.85); color: #fff; padding: 10px 22px;
  border-radius: 24px; font-size: 13px; z-index: 200; animation: pop 0.2s ease;
}
.toast.err { background: rgba(245, 63, 63, 0.92); }

/* 订单详情 */
.order-items { display: flex; flex-direction: column; gap: 10px; }
.order-item { display: flex; gap: 12px; align-items: center; padding: 10px; background: #fffaf5; border-radius: 10px; }
.order-item img { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: var(--brand-bg); }
.order-item .n { flex: 1; font-weight: 600; }
.order-item .p { color: var(--brand); font-weight: 700; }

@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}

/* ============ 消息中心（数据看板） ============ */
.msg-card { margin: 14px 0; }
.msg-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  padding: 4px 2px 2px;
}
.msg-sub-title {
  font-size: 13px; font-weight: 600; color: var(--text-2);
  margin-bottom: 10px; letter-spacing: 0.5px;
}
.msg-todo { border-right: 1px solid var(--border); padding-right: 18px; }
.msg-todo-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px; cursor: pointer;
  transition: background 0.15s;
}
.msg-todo-item:hover { background: var(--brand-bg); }
.msg-ico { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }
.msg-lbl { flex: 1; font-size: 13px; color: var(--text-1); }
.msg-cnt {
  min-width: 26px; height: 22px; padding: 0 7px; border-radius: 11px;
  background: #f0e9e2; color: var(--text-3);
  font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}
.msg-cnt.alert {
  background: var(--brand); color: #fff;
  animation: msgPulse 1.6s ease-in-out infinite;
}
@keyframes msgPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(249, 115, 22, 0); }
}
.msg-feed { min-width: 0; }
.msg-row {
  display: flex; gap: 10px; padding: 8px 10px;
  border-radius: 10px; cursor: pointer; transition: background 0.15s;
}
.msg-row:hover { background: var(--brand-bg); }
.msg-body { flex: 1; min-width: 0; }
.msg-title {
  font-size: 13px; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msg-status {
  margin-left: 6px; font-size: 11px; color: var(--text-3);
  border: 1px solid var(--border); border-radius: 4px; padding: 0 5px;
}
.msg-status.pending { color: var(--brand-dark); border-color: #fed7aa; background: #fff7ed; }
#sound-toggle { white-space: nowrap; }

@media (max-width: 1200px) {
  .msg-layout { grid-template-columns: 1fr; }
  .msg-todo { border-right: none; padding-right: 0; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
}

/* ---------- 供应链模块（物料/请货/采购/收款） ---------- */
.ipt {
  height: 34px; border: 1px solid var(--border); border-radius: 8px;
  padding: 0 10px; font-size: 13px; color: var(--text-1); background: #fff;
  box-sizing: border-box;
}
.ipt:focus { border-color: var(--brand); outline: none; }
/* 子页签 */
.sub-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.sub-tab {
  border: none; background: none; padding: 9px 16px; font-size: 13px;
  color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent;
}
.sub-tab:hover { color: var(--brand); }
.sub-tab.active { color: var(--brand); font-weight: 700; border-bottom-color: var(--brand); }
/* 表格内操作组 */
.row-ops { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
/* 通用状态徽标（与 badge-tag 并存，供表格内文字状态使用） */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 12px; white-space: nowrap; line-height: 18px;
}
.badge-ok { background: #e8ffea; color: var(--green); }
.badge-warn { background: #fff7e3; color: #b45309; }
.badge-info { background: #eaf2ff; color: var(--blue); }
.badge-gray { background: #f2efec; color: var(--text-3); }
/* 二维码 */
#qr-box img, #qr-box canvas { border-radius: 6px; display: block; }

