/* ============================================================
   NO:2-COFFEE · Admin 后台样式
   主题: 暗色侧栏 + 浅色内容 + 橙色强调
   ============================================================ */
:root {
  --primary: #ff7a1a;
  --primary-dark: #e5670a;
  --primary-light: #fff3e6;
  --bg: #f5f7fa;
  --text: #1a1a1a;
  --sub: #888;
  --line: #ebeef3;
  --sidebar-bg: #1e2129;
  --sidebar-text: #aab0bd;
  --sidebar-active: #ff7a1a;
  --card: #ffffff;
  --shadow: 0 2px 8px rgba(0,0,0,.04);
  --radius: 10px;
  --green: #34c759;
  --red: #ff3b30;
  --blue: #007aff;
  --purple: #af52de;
  --orange: #ff9500;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin:0; padding:0; height:100%; font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: var(--text); background: var(--bg); }
button, input, select, textarea { font-family: inherit; outline: none; border: 1px solid var(--line); background: #fff; }
input, select, textarea { padding: 8px 12px; border-radius: 6px; font-size: 13px; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }

/* ---------- 登录页 ---------- */
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
.login-bg { position: absolute; inset: 0; background: linear-gradient(135deg, #ff9d4d, #ff7a1a 50%, #e5670a); }
.login-bg::after { content:''; position: absolute; inset: 0; background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.2), transparent 50%), radial-gradient(circle at 80% 80%, rgba(0,0,0,.2), transparent 50%); }
.login-card { position: relative; width: 420px; background: #fff; border-radius: 16px; padding: 40px 36px; box-shadow: 0 30px 60px rgba(0,0,0,.3); text-align: center; }
.login-logo { font-size: 60px; line-height: 1; }
.login-brand { font-size: 28px; font-weight: 900; letter-spacing: 1px; margin-top: 8px; }
.login-brand span { color: var(--primary); }
.login-subtitle { color: var(--sub); font-size: 13px; margin-top: 4px; }
.login-form { margin-top: 32px; }
.login-input { display: flex; align-items: center; background: #f5f7fa; border-radius: 8px; padding: 0 14px; margin-bottom: 12px; }
.login-input input { flex: 1; padding: 14px 8px; border: 0; background: transparent; font-size: 14px; }
.li-ico { color: var(--sub); font-size: 18px; }
.login-tip { color: var(--sub); font-size: 11px; margin: 16px 0 12px; line-height: 1.5; }
.login-btn { width: 100%; padding: 14px; background: linear-gradient(90deg, #ff9d4d, #ff7a1a); color: #fff; border-radius: 8px; font-weight: 700; font-size: 15px; cursor: pointer; }

/* ---------- 主后台 ---------- */
.admin { display: flex; height: 100vh; }
.sidebar { width: 220px; background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-brand { padding: 18px 18px; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid #2a2d36; }
.sb-logo { width: 40px; height: 40px; background: #2a2d36; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.sb-title { color: #fff; font-size: 14px; font-weight: 700; }
.sb-sub { font-size: 11px; opacity: .7; }
.sidebar-menu { flex: 1; overflow-y: auto; padding: 12px 0; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 10px 18px; font-size: 13px; cursor: pointer; border-left: 3px solid transparent; }
.menu-item:hover { background: #2a2d36; color: #fff; }
.menu-item.menu-active { background: #2a2d36; color: var(--primary); border-left-color: var(--primary); }
.mi-ico { font-size: 16px; }
.sidebar-foot { border-top: 1px solid #2a2d36; padding: 8px 0; }

/* ---------- 主内容 ---------- */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { height: 56px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; flex-shrink: 0; }
.crumb { font-size: 16px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-ico { width: 32px; height: 32px; background: #f5f7fa; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.topbar-user { display: flex; align-items: center; gap: 10px; padding: 4px 10px; border-radius: 20px; background: #f5f7fa; }
.topbar-avatar { width: 32px; height: 32px; background: #fff3e6; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.tb-name { font-size: 13px; font-weight: 700; }
.tb-role { font-size: 11px; color: var(--sub); }

.page-section { flex: 1; overflow-y: auto; padding: 20px 24px; display: none; }
.page-section.active { display: block; animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

/* ---------- KPI ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.kpi-card { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi-card::before { content:''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.kpi-orange::before { background: var(--orange); }
.kpi-blue::before   { background: var(--blue); }
.kpi-green::before  { background: var(--green); }
.kpi-purple::before { background: var(--purple); }
.kpi-label { color: var(--sub); font-size: 12px; }
.kpi-num { font-size: 28px; font-weight: 800; margin-top: 4px; }
.kpi-num b { font-size: 32px; }
.kpi-sub { font-size: 11px; color: var(--sub); margin-top: 4px; }
.up { color: var(--green); font-weight: 600; }
.down { color: var(--red); font-weight: 600; }

/* ---------- 面板 ---------- */
.panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.panel-tools { display: flex; gap: 6px; }
.pt-tab { padding: 4px 10px; font-size: 11px; color: var(--sub); border-radius: 12px; cursor: pointer; }
.pt-tab.pt-tab-active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.panel-body { padding: 20px; }

/* ---------- 网格布局 ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }

/* ---------- 排行 ---------- */
.rank-list { padding: 0 4px; }
.rank-item { display: flex; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.rank-item:last-child { border-bottom: 0; }
.rank-num { width: 24px; height: 24px; border-radius: 50%; background: #f0f0f0; color: #888; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; margin-right: 12px; }
.rank-item:nth-child(1) .rank-num { background: #ff3b30; color: #fff; }
.rank-item:nth-child(2) .rank-num { background: #ff9500; color: #fff; }
.rank-item:nth-child(3) .rank-num { background: #ffcc00; color: #fff; }
.rank-name { flex: 1; font-size: 13px; }
.rank-bar-wrap { flex: 1; margin: 0 16px; height: 6px; background: #f0f0f0; border-radius: 3px; overflow: hidden; }
.rank-bar { height: 100%; background: linear-gradient(90deg, #ff9d4d, #ff7a1a); border-radius: 3px; }
.rank-value { width: 60px; text-align: right; font-size: 12px; color: var(--sub); }

/* ---------- 实时订单 ---------- */
.live-list { padding: 0 4px; }
.live-item { display: flex; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 12px; }
.live-item:last-child { border-bottom: 0; }
.live-time { width: 60px; color: var(--sub); }
.live-id { width: 110px; font-weight: 600; }
.live-content { flex: 1; color: #555; }
.live-amount { color: var(--primary); font-weight: 700; }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; }
.tb-search input { width: 220px; }
.tb-select { padding: 8px 12px; border-radius: 6px; font-size: 13px; min-width: 120px; }
.btn-primary { padding: 9px 18px; background: var(--primary); color: #fff; border-radius: 6px; font-weight: 600; font-size: 13px; cursor: pointer; border: 0; }
.btn-primary:hover { background: var(--primary-dark); }

/* ---------- 表格 ---------- */
.data-table { font-size: 13px; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); }
.data-table th { background: #fafbfc; color: var(--sub); font-weight: 600; font-size: 12px; }
.data-table tr:hover td { background: #fafbfc; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.tag-orange { background: #fff3e6; color: var(--primary); }
.tag-blue { background: #e0efff; color: var(--blue); }
.tag-green { background: #e0f7e9; color: var(--green); }
.tag-red { background: #ffe5e5; color: var(--red); }
.tag-gray { background: #f0f0f0; color: #888; }
.tag-purple { background: #f3e6ff; color: var(--purple); }
.goods-thumb { width: 36px; height: 36px; background: var(--primary-light); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.row-actions { display: flex; gap: 12px; }
.row-actions a { color: var(--blue); cursor: pointer; }
.row-actions .danger { color: var(--red); }

.pagination { padding: 14px 16px; display: flex; gap: 6px; align-items: center; justify-content: center; }
.pagination a { padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.pagination a.page-active { background: var(--primary); color: #fff; }
.pagination span { color: var(--sub); font-size: 12px; }
.page-jump input { width: 50px; padding: 4px 8px; border-radius: 4px; }

/* ---------- 分类卡片 ---------- */
.cat-grid { padding: 20px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.cat-card { background: #fafbfc; border-radius: 8px; padding: 14px; display: flex; align-items: center; gap: 10px; }
.cat-ico { font-size: 28px; }
.cat-info { flex: 1; }
.cat-name { font-size: 14px; font-weight: 700; }
.cat-count { font-size: 11px; color: var(--sub); }

/* ---------- 优惠券管理 ---------- */
.coupon-admin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.coupon-admin { background: linear-gradient(90deg, #ff9d4d, #ff7a1a); color: #fff; border-radius: 12px; padding: 16px; }
.coupon-admin-stop { background: #ccc; }
.ca-head { display: flex; justify-content: space-between; }
.ca-amount { font-size: 24px; font-weight: 800; }
.ca-name { font-size: 12px; opacity: .9; }
.ca-body { margin: 12px 0; font-size: 12px; }
.ca-stat { display: flex; justify-content: space-between; padding-top: 8px; border-top: 1px dashed rgba(255,255,255,.3); font-size: 11px; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; padding: 24px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row-full { grid-column: span 2; }
.form-row label { font-size: 12px; color: var(--sub); font-weight: 600; }
.form-row input, .form-row textarea { padding: 10px 12px; border-radius: 6px; font-size: 13px; border: 1px solid var(--line); }
.form-row textarea { min-height: 80px; resize: vertical; }
.form-checks { display: flex; gap: 16px; flex-wrap: wrap; padding: 6px 0; }
.form-checks label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #333; }
.form-foot { padding: 0 24px 24px; }

/* 门店二维码 */
.store-qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.store-qr-card {
  background: #f8f9fa; border: 1px solid #e8e8e8; border-radius: 12px; padding: 16px;
  text-align: center; cursor: pointer; transition: all 0.2s;
}
.store-qr-card:hover { border-color: #ff7a1a; box-shadow: 0 4px 12px rgba(255,122,26,0.15); }
.sqc-name { font-weight: 600; margin-bottom: 8px; color: #333; }
.sqc-code { font-size: 12px; color: #888; margin-bottom: 12px; }
.sqc-qr { width: 120px; height: 120px; margin: 0 auto 12px; background: #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.sqc-qr canvas, .sqc-qr img { max-width: 100%; max-height: 100%; }
.sqc-tip { font-size: 12px; color: #ff7a1a; }

/* 二维码弹窗 */
.qr-popup { position: fixed; inset: 0; z-index: 500; }
.qr-mask { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.qr-panel { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #fff; border-radius: 16px; width: 90%; max-width: 400px; }
.qr-panel-head { padding: 16px 20px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.qr-panel-close { width: 28px; height: 28px; background: #f5f5f5; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.qr-panel-body { padding: 24px; text-align: center; }
.qr-large { width: 200px; height: 200px; margin: 0 auto 16px; background: #f8f9fa; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.qr-large canvas, .qr-large img { max-width: 100%; max-height: 100%; }
.qr-url { font-size: 12px; color: #666; word-break: break-all; margin-bottom: 16px; }
.qr-actions { display: flex; gap: 12px; justify-content: center; }
.hidden { display: none !important; }
