:root {
  --bg: #f3f6f9;
  --surface: #ffffff;
  --ink: #0e1a26;
  --text: #1f2933;
  --sub: #64748b;
  --border: #e4e9f0;
  --primary: #1f6f8b;
  --primary-h: #175a72;
  --primary-soft: #e7f1f5;
  --accent: #f0a622;
  --success: #16a34a;
  --success-soft: #e8f7ee;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --warn-soft: #fdf4e3;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 26, 38, .05), 0 6px 20px rgba(15, 26, 38, .06);
  --shadow-lg: 0 12px 40px rgba(15, 26, 38, .18);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

.hidden { display: none !important; }

/* ============ 登录 ============ */
.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 420px at 20% -10%, #17394a 0%, transparent 60%),
    radial-gradient(700px 420px at 110% 10%, #1f6f8b 0%, transparent 55%),
    linear-gradient(160deg, #0e1a26 0%, #12283a 100%);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 16px;
  padding: 32px 26px 26px;
  box-shadow: var(--shadow-lg);
  animation: rise .5s cubic-bezier(.2, .7, .3, 1) both;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.login-logo {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #2f93b3);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 16px;
}
.login-title { font-size: 19px; font-weight: 700; letter-spacing: .3px; }
.login-sub { color: var(--sub); font-size: 13px; margin: 6px 0 22px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 6px; }
.field input, .field select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  transition: background .15s, transform .05s, border-color .15s;
}
.btn:hover { background: var(--primary-h); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; height: 46px; }
.btn-ghost {
  background: #fff; color: var(--text); border-color: var(--border);
}
.btn-ghost:hover { background: #f7f9fc; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 7px; }
.btn-danger-ghost { background: #fff; color: var(--danger); border-color: #f2c9c9; }
.btn-danger-ghost:hover { background: var(--danger-soft); }

.form-error {
  color: var(--danger);
  font-size: 13px;
  background: var(--danger-soft);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  margin-bottom: 14px;
}

/* ============ 应用外壳 ============ */
.app { max-width: 640px; margin: 0 auto; min-height: 100vh; background: var(--bg); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #0e1a26, #16405a);
  color: #fff;
  box-shadow: 0 2px 10px rgba(14, 26, 38, .18);
}
.topbar .brand { font-weight: 700; font-size: 16px; letter-spacing: .3px; }
.topbar .me { margin-left: auto; text-align: right; font-size: 12px; opacity: .92; }
.topbar .me b { display: block; font-size: 13px; font-weight: 600; }
.topbar .logout {
  margin-left: 8px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .25);
  color: #fff;
  height: 30px; padding: 0 10px; border-radius: 7px; font-size: 12px;
}
.topbar .logout:hover { background: rgba(255, 255, 255, .24); }

.tabs {
  display: flex; gap: 4px;
  padding: 10px 12px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 55px; z-index: 15;
}
.tabs button {
  flex: 1;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--sub);
  font-size: 14px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }

.content { padding: 14px 14px 40px; }

/* ============ 卡片 / 列表 ============ */
.section-head {
  display: flex; align-items: center; margin: 4px 2px 12px;
}
.section-head h2 { font-size: 15px; margin: 0; }
.section-head .count { color: var(--sub); font-size: 13px; margin-left: 8px; font-weight: 400; }
.section-head .btn { margin-left: auto; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  animation: rise .35s ease both;
}
.card-row { display: flex; align-items: flex-start; gap: 10px; }
.card-title { font-size: 15px; font-weight: 700; }
.card-meta { color: var(--sub); font-size: 12.5px; margin-top: 4px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.tag {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 600;
}
.tag-hq { background: var(--primary-soft); color: var(--primary); }
.tag-owner { background: #eef2f7; color: #475569; }
.tag-active { background: var(--success-soft); color: var(--success); }
.tag-disabled { background: var(--danger-soft); color: var(--danger); }
.tag-store { background: var(--warn-soft); color: #b45309; }

.empty {
  text-align: center; color: var(--sub);
  padding: 44px 16px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty .big { font-size: 15px; color: var(--text); margin-bottom: 6px; font-weight: 600; }
.empty .tip { font-size: 13px; }

.skeleton {
  height: 76px; border-radius: var(--radius);
  background: linear-gradient(90deg, #eef2f6 25%, #f6f9fb 37%, #eef2f6 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s infinite;
  margin-bottom: 10px;
}

/* 老板端：门店卡上的指标占位 */
.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
.metric {
  background: #f7fafc; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 10px;
}
.metric .k { color: var(--sub); font-size: 12px; }
.metric .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric .v.na { color: #cbd5e1; font-size: 15px; font-weight: 600; }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(14, 26, 38, .5);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s ease both;
}
@media (min-width: 560px) { .modal-mask { align-items: center; } }
.modal {
  width: 100%; max-width: 460px;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
  animation: rise .25s ease both;
  max-height: 88vh; overflow-y: auto;
}
@media (min-width: 560px) { .modal { border-radius: 16px; } }
.modal h3 { margin: 0 0 16px; font-size: 16px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

.checklist { max-height: 240px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; }
.checklist label {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 8px; border-radius: 6px; font-size: 14px; cursor: pointer;
}
.checklist label:hover { background: #f7fafc; }
.checklist input { width: 17px; height: 17px; accent-color: var(--primary); }

/* ============ 提示 ============ */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  z-index: 200;
  background: rgba(14, 26, 38, .92); color: #fff;
  padding: 11px 18px; border-radius: 10px; font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: rise .22s ease both;
  max-width: 86vw; text-align: center;
}

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
