/* 广府鲜骨渔粉 · 总后台（连锁总部） */
:root {
  --brand: #3D5AFE; --brand-dark: #2A43D8; --accent: #C8402F;
  --bg: #F4F5F8; --card: #fff; --line: #EAECF1;
  --text: #22242A; --muted: #8A8E99;
  --sidebar: #10182E; --sidebar-act: #3D5AFE;
  --green: #07C160; --blue: #3B7CFF; --orange: #F5A623;
  --shadow: 0 1px 3px rgba(16, 20, 34, .06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
button { font-family: inherit; border: none; cursor: pointer; background: none; }
input, select, textarea { font-family: inherit; font-size: 14px; outline: none; }
.hidden { display: none !important; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: #D4D7DE; border-radius: 4px; }

/* 登录 */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(140deg, #10182E, #1B2438); position: relative; overflow: hidden; }
.login-page::before { content: '🍜'; position: absolute; font-size: 320px; opacity: .05; right: -30px; bottom: -70px; }
.login-wrap { display: flex; gap: 72px; align-items: center; position: relative; z-index: 1; padding: 40px 24px; }
.login-brand { display: none; color: #fff; max-width: 420px; }
.login-brand .big { font-size: 30px; font-weight: 800; line-height: 1.5; }
.login-brand .big em { font-style: normal; color: #7C93FF; }
.login-brand .sub { font-size: 13px; color: rgba(255,255,255,.45); letter-spacing: 3px; margin-top: 10px; }
.login-brand ul { list-style: none; margin-top: 28px; }
.login-brand li { font-size: 14.5px; color: rgba(255,255,255,.85); line-height: 2.4; display: flex; gap: 10px; align-items: center; }
.login-brand li::before { content: '✓'; width: 20px; height: 20px; border-radius: 50%; background: rgba(124,147,255,.25); color: #7C93FF; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
@media (min-width: 1100px) { .login-brand { display: block; } }
.login-card { width: 380px; background: #fff; border-radius: 18px; padding: 36px 34px; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.login-card .logo { text-align: center; font-size: 40px; }
.login-card h1 { text-align: center; font-size: 20px; margin: 8px 0 2px; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 12px; margin-bottom: 24px; letter-spacing: 1px; }
.fld { margin-bottom: 14px; }
.fld label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.fld input, .fld select { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; }
.fld input:focus { border-color: var(--brand); }
.btn-main { width: 100%; background: var(--brand); color: #fff; padding: 12px; border-radius: 9px; font-size: 15px; font-weight: 600; margin-top: 6px; }
.btn-main:hover { background: var(--brand-dark); }
.demo-tip { margin-top: 16px; background: #EEF2FF; border-radius: 8px; padding: 10px 12px; font-size: 12px; color: #3D4785; line-height: 1.8; }
.demo-tip code { background: #fff; padding: 1px 6px; border-radius: 4px; border: 1px solid #D6DFF7; }

/* 框架 */
#frame { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 216px; background: var(--sidebar); color: #B9C2D8; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar .s-logo { padding: 20px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .s-logo .t { font-weight: 700; color: #fff; font-size: 16px; }
.sidebar .s-logo .s { font-size: 11px; color: #7C87A6; margin-top: 3px; }
.nav { flex: 1; padding: 12px 10px; }
.nav .item { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 9px; margin-bottom: 3px; cursor: pointer; font-size: 14px; transition: all .15s; }
.nav .item:hover { background: rgba(255,255,255,.07); }
.nav .item.active { background: var(--sidebar-act); color: #fff; font-weight: 600; }
.sidebar .s-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #7C87A6; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 58px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 22px; gap: 14px; flex-shrink: 0; }
.topbar .crumb { font-size: 15px; font-weight: 700; }
.topbar .live { margin-left: auto; display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); background: #F4F9F5; border: 1px solid #D9F0E1; border-radius: 14px; padding: 4px 12px; }
.topbar .user { font-size: 13px; color: var(--muted); } .topbar .user b { color: var(--text); }
.topbar .logout { color: var(--muted); font-size: 12px; padding: 5px 9px; border-radius: 6px; } .topbar .logout:hover { background: #F2F3F6; color: var(--accent); }
.content { flex: 1; overflow-y: auto; padding: 20px 22px 30px; }

/* 组件 */
.card { background: var(--card); border-radius: 13px; padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card h3.card-t { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card h3.card-t::before { content: ''; width: 4px; height: 15px; background: var(--brand); border-radius: 2px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 300px; }
.btn { padding: 8px 16px; border-radius: 8px; font-size: 13px; min-height: 36px; }
.btn-p { background: var(--brand); color: #fff; } .btn-p:hover { background: var(--brand-dark); }
.btn-o { border: 1px solid var(--line); color: #555; background: #fff; } .btn-o:hover { border-color: var(--brand); color: var(--brand); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; min-height: 30px; }
.btn-danger { color: #E5484D; border: 1px solid #F3D6D6; background: #fff; } .btn-danger:hover { background: #FDF1F1; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--muted); font-weight: 500; padding: 11px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #F7F8FC; }
.table td { padding: 13px 10px; border-bottom: 1px solid #F4F5F8; vertical-align: middle; }
.table tbody tr:nth-child(even) td { background: #FAFBFE; }
.table tr:hover td { background: #F2F5FF; }
.tag { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 5px; font-size: 11.5px; font-weight: 600; }
.tag-red { background: #FDECE8; color: var(--accent); }
.tag-green { background: #E8F8EE; color: var(--green); }
.tag-blue { background: #EAF1FF; color: var(--blue); }
.tag-orange { background: #FDF3E0; color: #C57B21; }
.tag-gray { background: #F2F3F6; color: var(--muted); }
.tag-mt { background: #FFF6DA; color: #946E00; } .tag-tb { background: #FFF0E3; color: #C2540A; } .tag-jd { background: #FDECEC; color: #C02926; }
.switch { position: relative; width: 42px; height: 23px; display: inline-block; }
.switch input { display: none; }
.switch .sl { position: absolute; inset: 0; background: #D4D7DE; border-radius: 12px; transition: .18s; }
.switch .sl::after { content: ''; position: absolute; width: 19px; height: 19px; background: #fff; border-radius: 50%; top: 2px; left: 2px; transition: .18s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + .sl { background: var(--green); }
.switch input:checked + .sl::after { transform: translateX(19px); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 14px; font-size: 13px; color: var(--muted); }
.search-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.search-bar input, .search-bar select { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.empty-tip { text-align: center; color: var(--muted); padding: 46px 0; font-size: 13px; }

/* 总览 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--card); border-radius: 13px; padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat .ic { position: absolute; right: 12px; top: 12px; font-size: 30px; opacity: .5; }
.stat .lb { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 25px; font-weight: 800; margin-top: 5px; }
.stat .sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.stat .ic {
  position: absolute; right: 14px; top: 14px; width: 42px; height: 42px; border-radius: 10px;
  background: var(--brand); display: flex; align-items: center; justify-content: center;
  font-size: 21px; box-shadow: 0 4px 10px rgba(61,90,254,.28);
}
.rank-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid #F4F5F8; font-size: 13px; }
.rank-row .rk { width: 22px; height: 22px; border-radius: 6px; background: #F2F3F6; color: var(--muted); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.rank-row:nth-child(1) .rk { background: #FDECE8; color: var(--accent); }
.rank-row:nth-child(2) .rk { background: #FDF3E0; color: #C57B21; }
.rank-row:nth-child(3) .rk { background: #EAF1FF; color: var(--blue); }
.rank-row .nm { flex: 1; }
.bar-wrap { height: 8px; background: #F2F3F6; border-radius: 4px; overflow: hidden; margin-top: 4px; }
.bar-wrap .bar { height: 100%; background: linear-gradient(90deg, var(--brand), #6C8CFF); border-radius: 4px; }

/* 弹窗 */
#modal-mask { position: fixed; inset: 0; background: rgba(15, 18, 25, .5); z-index: 60; display: flex; align-items: center; justify-content: center; }
#modal { background: #fff; border-radius: 15px; padding: 22px; width: min(600px, 92vw); max-height: 86vh; overflow-y: auto; animation: pop .2s ease-out; }
#modal h3 { font-size: 16px; margin-bottom: 16px; }
.m-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

#toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%) translateY(-8px); background: #22242A; color: #fff; padding: 10px 22px; border-radius: 9px; font-size: 13.5px; z-index: 99; opacity: 0; pointer-events: none; transition: all .22s; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 图片上传器 */
.img-uploader { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.img-preview { width: 72px; height: 72px; border-radius: 10px; background: #F5F6F8; border: 1px dashed var(--line); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.dish-thumb { display: inline-flex; width: 42px; height: 42px; align-items: center; justify-content: center; margin-right: 4px; vertical-align: middle; }
canvas.chart { width: 100%; display: block; }
.chart-flex { display: flex; gap: 26px; align-items: center; flex-wrap: wrap; }
.chart-flex .legend { font-size: 12.5px; line-height: 2.1; color: #555; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 7px; }
.store-pick { display: flex; flex-wrap: wrap; gap: 8px; max-height: 220px; overflow-y: auto; }
.store-pick .sp { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; font-size: 13px; cursor: pointer; }
.store-pick .sp.sel { border-color: var(--brand); background: #EEF2FF; color: var(--brand); font-weight: 600; }
.qr-box { display: flex; gap: 10px; flex-wrap: wrap; }
.qr-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; font-size: 12px; }
.qr-item .q { width: 74px; height: 74px; margin: 0 auto 6px; background: repeating-conic-gradient(#22242A 0 25%, #fff 0 50%) 0 0/14px 14px; border-radius: 6px; position: relative; overflow: hidden; }
.qr-item .q::after { content: '🍜'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 20px; background: #fff; margin: 20px; border-radius: 4px; }

/* ---------- 桌码物料（屏幕预览 + A4 打印） ---------- */
.qr-sheet { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 4px 0 30px; }
.qr-mat-card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px;
  text-align: center; break-inside: avoid; page-break-inside: avoid; box-shadow: var(--shadow);
}
.qr-mat-card .qm-brand { font-size: 15px; font-weight: 800; color: #C8402F; letter-spacing: 1px; }
.qr-mat-card .qm-store { font-size: 11.5px; color: var(--muted); margin: 3px 0 10px; }
.qr-mat-card .qm-qr { display: block; margin: 0 auto; }
.qr-mat-card .qm-table { font-size: 46px; font-weight: 900; line-height: 1.1; margin-top: 8px; }
.qr-mat-card .qm-table span { font-size: 18px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.qr-mat-card .qm-hint { font-size: 12px; color: #C8402F; margin-top: 6px; font-weight: 600; }
.qr-mat-note { border: 1px dashed var(--line); box-shadow: none; }

@media print {
  .sidebar, .topbar, .no-print, #toast, #modal-mask { display: none !important; }
  #frame { height: auto !important; }
  .main { display: block !important; }
  .content { overflow: visible !important; padding: 0 !important; }
  body, .content { background: #fff !important; }
  .qr-sheet { grid-template-columns: repeat(2, 1fr); gap: 10mm; }
  .qr-mat-card { box-shadow: none; border: 1px solid #ddd; border-radius: 4mm; padding: 6mm; }
  .qr-mat-card .qm-qr { width: 38mm !important; height: 38mm !important; }
  @page { size: A4; margin: 10mm; }
}
