:root {
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-light: #ccfbf1;
  --accent: #d97706;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #f59e0b;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --shadow: 0 1px 3px rgba(15,23,42,.12), 0 1px 2px rgba(15,23,42,.08);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600;
  transition: all .15s ease;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { background: #fff; border-color: #fecaca; color: var(--danger); }
.btn.danger:hover { background: #fef2f2; }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; background: #fff; color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15,118,110,.12);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.input-group { display: flex; gap: 8px; align-items: center; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px;
  background: #fff; font-size: 13px; cursor: pointer; color: var(--muted);
}
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- Login (深色科技风) ---------- */
.login-stage { position: fixed; inset: 0; overflow: hidden; z-index: 5;
  background:
    radial-gradient(1200px 800px at 82% -10%, rgba(14,116,233,.16), transparent 60%),
    radial-gradient(1000px 720px at -8% 108%, rgba(168,85,247,.14), transparent 60%),
    linear-gradient(160deg, #050a1a 0%, #0a1024 45%, #071022 100%); }
#login-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }
.aurora { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .55;
  pointer-events: none; will-change: transform; }
.aurora-a { width: 46vmax; height: 46vmax; left: -12vmax; top: -14vmax;
  background: radial-gradient(circle at 40% 40%, rgba(34,211,238,.5), rgba(14,165,233,.16) 45%, transparent 70%);
  animation: auroraDriftA 22s ease-in-out infinite alternate; }
.aurora-b { width: 42vmax; height: 42vmax; right: -14vmax; bottom: -16vmax;
  background: radial-gradient(circle at 55% 45%, rgba(129,140,248,.45), rgba(99,102,241,.15) 45%, transparent 70%);
  animation: auroraDriftB 26s ease-in-out infinite alternate; }
.aurora-c { width: 30vmax; height: 30vmax; left: 36%; top: 26%;
  background: radial-gradient(circle at 50% 50%, rgba(232,121,249,.3), rgba(217,70,239,.12) 45%, transparent 70%);
  animation: auroraDriftC 30s ease-in-out infinite alternate; }
@keyframes auroraDriftA { from { transform: translate(0,0) scale(1); }
  to { transform: translate(10vmax, 8vmax) scale(1.18); } }
@keyframes auroraDriftB { from { transform: translate(0,0) scale(1.1); }
  to { transform: translate(-9vmax, -7vmax) scale(.95); } }
@keyframes auroraDriftC { from { transform: translate(0,0) scale(1); opacity: .5; }
  to { transform: translate(-6vmax, 5vmax) scale(1.15); opacity: .72; } }
.login-glow { position: absolute; left: 50%; top: 50%; width: 60vmin; height: 60vmin;
  transform: translate(-50%,-50%) scale(0); border-radius: 50%; opacity: 0; pointer-events: none; z-index: 3;
  background: radial-gradient(circle, rgba(34,211,238,.38), rgba(14,165,233,.12) 45%, transparent 70%);
  filter: blur(30px); }
.login-stage.success .login-glow { animation: glowBurst .85s ease forwards; }
@keyframes glowBurst {
  0% { transform: translate(-50%,-50%) scale(.2); opacity: 0; }
  30% { transform: translate(-50%,-50%) scale(1.6); opacity: 1; }
  100% { transform: translate(-50%,-50%) scale(2.8); opacity: 0; } }
.login-welcome { position: absolute; left: 0; right: 0; top: 38%; text-align: center; z-index: 5;
  font-size: 26px; font-weight: 700; color: #eaf6ff; letter-spacing: .08em;
  text-shadow: 0 0 26px rgba(34,211,238,.65); opacity: 0; transform: translateY(12px);
  pointer-events: none; }
.login-welcome.show { animation: welcomeIn .6s ease .12s forwards; }
@keyframes welcomeIn { to { opacity: 1; transform: translateY(0); } }
.login-welcome .wmsg { display: block; }
.login-welcome .w-mute { pointer-events: auto; margin-top: 20px; padding: 9px 20px; font-size: 20px;
  line-height: 1; border-radius: 999px; border: 1px solid rgba(148,233,255,.4);
  background: rgba(13,22,43,.55); color: #eaf6ff; cursor: pointer; vertical-align: middle;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 0 18px rgba(34,211,238,.25); transition: background .2s ease; }
.login-welcome .w-mute:hover { background: rgba(34,211,238,.18); }
.login-wrap { position: absolute; inset: 0; z-index: 4; display: flex; align-items: center;
  justify-content: center; padding: 20px; }
.login-card { position: relative; width: 100%; max-width: 380px; padding: 40px 32px 28px;
  background: rgba(13,22,43,.55); border: 1px solid rgba(148,233,255,.18); border-radius: 22px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.03), 0 30px 80px rgba(0,0,0,.5),
    0 0 60px rgba(34,211,238,.08), inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3);
  animation: cardIn .55s cubic-bezier(.22,1,.36,1) both; }
@keyframes cardIn { from { transform: translateY(26px) scale(.92); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; } }
.login-card.leave { animation: cardOut .55s ease forwards; pointer-events: none; }
@keyframes cardOut { to { transform: scale(.82) translateY(-14px); opacity: 0; filter: blur(6px); } }
.login-card.shake { animation: shake .5s ease; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); } }
.brand-logo { position: relative; width: 74px; height: 74px; margin: 0 auto 18px; }
.brand-logo::before { content: ""; position: absolute; inset: -18px; border-radius: 50%;
  background: radial-gradient(circle, rgba(34,211,238,.28), transparent 70%);
  animation: logoPulse 3.2s ease-in-out infinite; }
@keyframes logoPulse { 0%, 100% { opacity: .5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.12); } }
.brand-logo .brand-ring { position: absolute; inset: -9px; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 296deg, rgba(34,211,238,.9) 324deg,
    rgba(129,140,248,.9) 348deg, transparent 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  animation: ringSpin 3.2s linear infinite; }
@keyframes ringSpin { to { transform: rotate(360deg); } }
.brand-logo .brand-img { position: absolute; inset: 0; width: 100%; height: 100%;
  border-radius: 22%; object-fit: cover; background: #0b1a33;
  box-shadow: 0 0 26px rgba(34,211,238,.3), inset 0 0 18px rgba(34,211,238,.14); }
.login-card h1 { margin: 0 0 6px; font-size: 24px; font-weight: 700; letter-spacing: .06em;
  background: linear-gradient(120deg, #e0f2fe 10%, #67e8f9 45%, #a5b4fc 75%, #e0f2fe 95%);
  background-size: 200% auto; -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: #eaf6ff; animation: titleSheen 6s linear infinite; }
@keyframes titleSheen { to { background-position: 200% center; } }
.login-card .sub { color: #94a3b8; font-size: 13px; letter-spacing: .04em; margin-bottom: 26px; }
.login-card .field { margin-bottom: 16px; }
.login-card .field label { display: block; font-size: 13px; font-weight: 600; color: #a8c1d9; margin-bottom: 7px; }
.login-card .field input { width: 100%; padding: 12px 14px; border-radius: 12px; font-size: 15px;
  color: #e6f1ff; background: rgba(10,18,36,.6); border: 1px solid rgba(148,233,255,.14);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease; }
.login-card .field input::placeholder { color: #5b6b85; }
.login-card .field input:focus { outline: none; border-color: rgba(34,211,238,.8);
  background: rgba(12,24,46,.75); box-shadow: 0 0 0 3px rgba(34,211,238,.16), 0 0 18px rgba(34,211,238,.18); }
.login-btn { width: 100%; padding: 13px; border: none; border-radius: 12px;
  font-size: 15px; font-weight: 700; letter-spacing: .3em; color: #04222b;
  background: linear-gradient(120deg, #22d3ee, #0ea5e9 55%, #818cf8); background-size: 180% auto;
  box-shadow: 0 10px 26px rgba(14,165,233,.35), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease, background-position .3s ease; }
.login-btn:hover { background-position: 100% center; filter: brightness(1.08);
  box-shadow: 0 12px 32px rgba(34,211,238,.45), 0 0 24px rgba(34,211,238,.25); }
.login-btn:active { transform: translateY(2px) scale(.985); }
.login-btn:disabled { opacity: .65; cursor: wait; }
.login-card .login-hint { margin-top: 18px; padding-top: 14px; color: #6d7f99;
  font-size: 12.5px; line-height: 1.7; border-top: 1px solid rgba(148,233,255,.1); }
@media (max-width: 480px) {
  .login-card { padding: 32px 22px 24px; }
  .login-card h1 { font-size: 21px; }
  .login-welcome { font-size: 22px; } }

/* ---------- App shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 230px; background: #0f172a; color: #cbd5e1; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .logo { display: flex; align-items: center; gap: 10px; padding: 20px 18px; color: #fff; }
.sidebar .logo .mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand);
  display: flex; align-items: center; justify-content: center; font-size: 18px; }
.sidebar nav { flex: 1; padding: 8px; overflow-y: auto; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: 10px; color: #94a3b8; font-weight: 500; font-size: 14px; margin-bottom: 2px; }
.sidebar nav a .ico { width: 20px; text-align: center; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: var(--brand); color: #fff; }
.sidebar .user-block { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar .user-block .name { color: #fff; font-weight: 600; font-size: 14px; }
.sidebar .user-block .role { color: #94a3b8; font-size: 12px; margin-top: 2px; }
.sidebar .logout { margin-top: 10px; width: 100%; background: rgba(255,255,255,.06); border: none;
  color: #e2e8f0; padding: 9px; border-radius: 8px; font-size: 13px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; position: sticky; top: 0; z-index: 30; background: #fff;
  border-bottom: 1px solid var(--border); align-items: center; gap: 12px; padding: 12px 16px; }
.topbar .title { font-weight: 700; font-size: 16px; }
.topbar .hamburger { background: none; border: none; font-size: 22px; }

.content { padding: 24px; max-width: 1180px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 22px; }

/* ---------- Cards & stats ---------- */
.grid { display: grid; gap: 14px; }
.grid > * { min-width: 0; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); }
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-size: 26px; font-weight: 800; margin-top: 4px; }
.stat .value.sm { font-size: 20px; }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.accent .value { color: var(--brand); }
.stat.warn .value { color: var(--warn); }
.stat.danger .value { color: var(--danger); }

.section { margin-top: 24px; }
.section > .section-head { display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; }
.section > .section-head h3 { margin: 0; font-size: 16px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f8fafc; color: var(--muted); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .02em; position: sticky; top: 0; }
tbody tr:hover { background: #f8fafc; }
td.num, th.num { text-align: right; }
.empty-state { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty-state .ico { font-size: 42px; margin-bottom: 10px; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.danger { background: #fee2e2; color: #991b1b; }
.badge.brand { background: #ccfbf1; color: #115e59; }
.badge.gray { background: #f1f5f9; color: #475569; }

/* ---------- Modal ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; width: 100%; max-width: 560px; border-radius: 20px 20px 0 0;
  padding: 22px; max-height: 90vh; overflow-y: auto; animation: slideUp .2s ease; }
@keyframes slideUp { from { transform: translateY(30px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.modal.modal-center { margin: auto; border-radius: 20px; max-width: 460px; }
.modal .modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal .modal-head h3 { margin: 0; font-size: 18px; }
.modal .close-x { background: none; border: none; font-size: 22px; color: var(--muted); }
.modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* ---------- Toast ---------- */
.toast-root { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #0f172a; color: #fff; padding: 12px 18px; border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0,0,0,.3); font-size: 14px; animation: fadeIn .2s ease; max-width: 90vw; }
.toast.ok { background: #166534; }
.toast.err { background: #991b1b; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Misc ---------- */
.search-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-bar input, .search-bar select { padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 14px; }
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 14px; }
.filter-bar input, .filter-bar select { padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 14px; background: #fff; }
.filter-bar input[type="date"] { min-width: 138px; }
.filter-bar .btn { white-space: nowrap; }
.pager { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.mono { font-variant-numeric: tabular-nums; }
.text-muted { color: var(--muted); }
.small { font-size: 13px; }
.spacer { flex: 1; }
.hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.alert { padding: 12px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 14px; }
.alert.warn { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert.info { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: #fff; border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.bottom-nav::-webkit-scrollbar { display: none; }
.bottom-nav .nav-item { flex: 0 0 auto; min-width: 68px; display: flex; flex-direction: column;
  align-items: center; gap: 3px; color: var(--muted); font-size: 11px; padding: 6px 8px; border-radius: 8px; }
.bottom-nav .nav-item .ico { font-size: 20px; }
.bottom-nav .nav-item.active { color: var(--brand); background: var(--brand-light); }

.fab { position: fixed; right: 16px; bottom: 78px; z-index: 40; width: 54px; height: 54px;
  border-radius: 50%; background: var(--brand); color: #fff; font-size: 26px; border: none;
  box-shadow: 0 8px 20px rgba(15,118,110,.4); display: none; align-items: center; justify-content: center; }

/* Chart.js containers (fixed height, responsive width) */
.chart-box { position: relative; height: 300px; width: 100%; }

/* ---------- Responsive (mobile) ---------- */
@media (max-width: 860px) {
  .sidebar { display: none; }
  .topbar { display: flex; }
  .content { padding: 16px; }
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: 1fr; }
  .grid.cols-2 { grid-template-columns: 1fr; }
  .bottom-nav { display: flex; }
  .fab { display: flex; }
  .page-head h2 { font-size: 18px; }
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
  .stat .value { font-size: 22px; }
  .chart-box { height: 240px; }
}

/* Mobile drawer sidebar */
.drawer { position: fixed; inset: 0; z-index: 60; display: none; }
.drawer.open { display: block; }
.drawer .mask { position: absolute; inset: 0; background: rgba(15,23,42,.5); }
.drawer .panel { position: absolute; left: 0; top: 0; bottom: 0; width: 260px; background: #0f172a;
  color: #cbd5e1; animation: slideRight .2s ease; overflow-y: auto; }
@keyframes slideRight { from { transform: translateX(-100%); } to { transform: translateX(0); } }

.store-head{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:8px;padding:12px 14px;border-bottom:1px solid rgba(148,233,255,.12)}
.store-title{font-weight:700;font-size:16px}
.store-addr{color:#94a3b8;font-size:12px;font-weight:400;margin-left:8px}
.store-meta{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.store-meta .badge{background:rgba(34,211,238,.14);color:#67e8f9;border-radius:999px;padding:2px 10px;font-size:12px}
.store-meta .phone{color:#94a3b8;font-size:12px}
.store-accounts{padding:8px 14px}
.store-accounts table{margin:0}
