:root {
  --blue: #2563eb;
  --blue-dark: #1e40af;
  --bg: #f3f5f9;
  --line: #e4e8ef;
  --text: #1f2937;
  --muted: #6b7280;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
}
* { box-sizing: border-box; margin: 0; }
body { font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e3a8a, #2563eb 60%, #38bdf8); }
.login-card { background: #fff; border-radius: 12px; padding: 36px 40px; width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-card h1 { font-size: 22px; text-align: center; margin-bottom: 6px; }
.login-card .sub { text-align: center; color: var(--muted); margin-bottom: 24px; font-size: 13px; }

/* ---------- 顶栏 ---------- */
.topbar { background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 24px; height: 54px; position: sticky; top: 0; z-index: 50; gap: 24px; }
.logo { font-weight: 700; font-size: 16px; color: var(--blue-dark); white-space: nowrap; }
.menu { display: flex; gap: 4px; flex: 1; }
.menu a { color: var(--muted); text-decoration: none; padding: 8px 14px; border-radius: 8px; white-space: nowrap; }
.menu a:hover { background: var(--bg); color: var(--text); }
.menu a.active { background: #eff6ff; color: var(--blue); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; position: relative; }
.bell { cursor: pointer; font-size: 19px; position: relative; user-select: none; line-height: 1; }
.bell .dot { position: absolute; top: -7px; right: -10px; background: var(--red); color: #fff; font-size: 11px; min-width: 17px; height: 17px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.user-box { color: var(--muted); font-size: 13px; cursor: pointer; user-select: none; }
.dropdown { position: absolute; right: 0; top: 44px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.12); min-width: 150px; overflow: hidden; z-index: 100; }
.dropdown > div, .dropdown > a { display: block; width: 100%; padding: 10px 16px; color: var(--text); text-decoration: none; cursor: pointer; border: none; background: none; text-align: left; font-size: 14px; }
.dropdown > div:hover, .dropdown > a:hover { background: var(--bg); }
.notif-panel { position: absolute; right: 0; top: 44px; width: 360px; max-height: 420px; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.12); z-index: 100; }
.notif-item { padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif-item:hover { background: var(--bg); }
.notif-item .t { font-weight: 600; }
.notif-item.unread .t::before { content: "●"; color: var(--red); font-size: 10px; margin-right: 6px; }
.notif-item .c { color: var(--muted); font-size: 12px; margin-top: 2px; }
.notif-item .time { color: #9ca3af; font-size: 11px; margin-top: 2px; }

/* ---------- 容器与卡片 ---------- */
.container { max-width: 1180px; margin: 22px auto; padding: 0 20px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.page-head h2 { font-size: 19px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 16px; }
.card h3 { font-size: 15px; margin-bottom: 12px; }
.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.stat { flex: 1; min-width: 200px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.stat .lab { color: var(--muted); font-size: 13px; }
.stat .val { font-size: 21px; font-weight: 700; margin-top: 4px; }

/* ---------- 表格 ---------- */
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { color: var(--muted); font-weight: 600; font-size: 13px; background: #fafbfd; }
table.list tr:hover td { background: #f8fafc; }
table.list td.num, table.list th.num { text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 30px 0 !important; }

/* ---------- 控件 ---------- */
.btn { display: inline-block; border: 1px solid transparent; border-radius: 8px; padding: 7px 14px; cursor: pointer; font-size: 13px; background: var(--blue); color: #fff; }
.btn:hover { background: var(--blue-dark); }
.btn.plain { background: #fff; color: var(--text); border-color: var(--line); }
.btn.plain:hover { background: var(--bg); }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #b91c1c; }
.btn.green { background: var(--green); }
.btn.green:hover { background: #15803d; }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
input, select, textarea { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 14px; outline: none; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.form-row input, .form-row select, .form-row textarea { width: 100%; }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-form .grow { flex: 1; min-width: 160px; }

/* ---------- 徽标 ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; }
.badge.w { background: #fef3c7; color: #92400e; }   /* 待处理 */
.badge.b { background: #dbeafe; color: #1d4ed8; }   /* 进行中 */
.badge.g { background: #dcfce7; color: #166534; }   /* 完成 */
.badge.x { background: #e5e7eb; color: #4b5563; }   /* 取消/停用 */

/* ---------- 弹窗 ---------- */
.mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 20px; }
.modal { background: #fff; border-radius: 14px; width: 520px; max-width: 96vw; max-height: 88vh; overflow: auto; padding: 22px 24px; }
.modal.wide { width: 720px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h3 { font-size: 16px; }
.modal-close { cursor: pointer; color: var(--muted); font-size: 20px; border: none; background: none; line-height: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------- 购物车条 ---------- */
.cart-bar { position: sticky; bottom: 0; background: #111827; color: #fff; border-radius: 12px; padding: 12px 18px; display: flex; align-items: center; gap: 16px; box-shadow: 0 -4px 20px rgba(0,0,0,.2); margin-top: 14px; }
.qty-input { width: 64px; text-align: center; padding: 4px 6px; }

/* ---------- Toast ---------- */
#toast-wrap { position: fixed; top: 66px; right: 20px; z-index: 500; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: 0 8px 20px rgba(0,0,0,.25); animation: fadein .2s; }
.toast.err { background: var(--red); }
@keyframes fadein { from { opacity: 0; transform: translateY(-8px); } }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs .tab { padding: 6px 14px; border-radius: 999px; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 13px; }
.tabs .tab.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.muted { color: var(--muted); }
.mt { margin-top: 12px; }
details.sub-orders summary { cursor: pointer; color: var(--blue); font-size: 12px; user-select: none; }
details.sub-orders li { list-style: none; padding: 3px 0; font-size: 12px; color: var(--muted); }

/* ---------- 缩略图 ---------- */
.thumb { width:44px; height:44px; object-fit:cover; border-radius:6px; border:1px solid var(--line); vertical-align:middle; background:#fff; }
.thumb.ph { display:inline-block; background:repeating-linear-gradient(45deg,#f1f4f9,#f1f4f9 6px,#e8ecf3 6px,#e8ecf3 12px); }

/* 面板防溢出 + 小屏适配 */
.notif-panel { max-width: calc(100vw - 28px); }
@media (max-width: 520px) { .notif-panel { width: min(92vw, 340px); right: -8px; } }

/* 图片放大交互 */
img.thumb[onclick] { transition: box-shadow .15s; }
img.thumb[onclick]:hover { box-shadow: 0 0 0 3px rgba(37,99,235,.25); }
