:root {
  --bg: #f4f6f9;
  --sidebar: #0f172a;
  --brand: #16a34a;
  --blue: #2563eb;
  --red: #dc2626;
  --orange: #ea580c;
  --text: #0f172a;
  --sub: #64748b;
  --border: #e2e8f0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); }

.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--sidebar);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 14px; }
.brand-logo { width: 38px; height: 38px; border-radius: 10px; background: #16a34a; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.brand-name { font-size: 15px; font-weight: 800; color: #fff; }
.brand-sub { font-size: 11px; color: #94a3b8; }

.nav-list { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.nav-item {
  border: none;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: #16a34a; color: #fff; }

.sidebar-foot { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.foot-link { color: #94a3b8; text-decoration: none; font-size: 12.5px; padding: 6px 8px; border-radius: 8px; }
.foot-link:hover { background: rgba(255,255,255,0.08); color: #fff; }

.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar-title { font-size: 18px; font-weight: 800; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.status-pill { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: #eff6ff; color: #1d4ed8; }
.status-pill.green { background: #ecfdf5; color: #15803d; }

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

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi-card { background: #fff; border-radius: 14px; padding: 18px; border: 1px solid var(--border); }
.kpi-label { font-size: 12.5px; color: var(--sub); font-weight: 600; }
.kpi-val { font-size: 28px; font-weight: 900; margin: 6px 0 4px; }
.kpi-sub { font-size: 12px; color: var(--sub); }

.panel { background: #fff; border-radius: 14px; padding: 18px; border: 1px solid var(--border); margin-bottom: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.panel-head h3 { font-size: 15.5px; font-weight: 800; }

.grid-2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid #f1f5f9; }
th { color: #64748b; font-weight: 700; background: #f8fafc; }

.btn { border: none; border-radius: 8px; padding: 8px 14px; font-size: 13px; font-weight: 700; cursor: pointer; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-green { background: var(--brand); color: #fff; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-orange { background: var(--orange); color: #fff; }
.btn-red { background: var(--red); color: #fff; }
.btn-ghost { background: #f1f5f9; color: #334155; }

.inp { height: 38px; border-radius: 8px; border: 1px solid #cbd5e1; padding: 0 12px; font-size: 13.5px; outline: none; }
.inp:focus { border-color: var(--brand); }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.bar-track { flex: 1; height: 12px; background: #f1f5f9; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #16a34a, #22c55e); border-radius: 999px; }

.receipt-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #fffef5;
  border: 1px dashed #94a3b8;
  padding: 14px;
  border-radius: 8px;
  white-space: pre-wrap;
  font-size: 12.5px;
  line-height: 1.7;
}

.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,0.55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-mask.hidden { display: none; }
.modal-card { background: #fff; border-radius: 16px; padding: 22px; width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto; }

.toast { position: fixed; top: 24px; right: 24px; background: #0f172a; color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 13.5px; font-weight: 700; z-index: 140; box-shadow: 0 8px 24px rgba(0,0,0,0.2); }
.toast.hidden { display: none; }

/* ===== 手机 / 窄屏适配 ===== */
@media (max-width: 900px) {
  .admin-layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    position: relative;
    height: auto;
    padding: 12px 12px 8px;
  }
  .brand { flex-direction: row; align-items: center; gap: 10px; }
  .nav-list {
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    padding: 8px 0;
    flex: 0 0 auto;
  }
  .nav-item { white-space: nowrap; flex: 0 0 auto; font-size: 13px; }
  .sidebar-foot { display: none; }
  .main-col { width: 100%; }
  .main-content { padding: 14px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
  .kpi-card { padding: 12px; }
  .kpi-val { font-size: 22px !important; }
  table { font-size: 12px; }
  th, td { padding: 8px 6px; }
  .topbar { flex-wrap: wrap; gap: 8px; }
  .btn { font-size: 12px; padding: 7px 10px; }
}
