/* ===== 主题变量 ===== */
:root {
  --primary: #1677ff;
  --primary-dark: #0e5ad6;
  --primary-soft: #e8f1ff;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1f2329;
  --text-2: #646a73;
  --text-3: #a3a8b3;
  --border: #e8ebf2;
  --success: #00b42a;
  --warning: #ff7d00;
  --danger: #f53f3f;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(22, 119, 255, 0.08);
  --nav-h: 60px;
  --header-h: 52px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #dde3ec;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ===== 手机外框 ===== */
.phone-frame {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100vh;
  max-height: 920px;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.18);
}
@media (min-width: 480px) {
  body { display: flex; align-items: center; justify-content: center; }
  .phone-frame { border-radius: 28px; height: 90vh; }
}

#app-root { height: 100%; display: flex; flex-direction: column; }

/* ===== 通用按钮 ===== */
.btn {
  border: none; border-radius: 8px; padding: 8px 14px;
  font-size: 13px; cursor: pointer; transition: .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-ghost { background: var(--primary-soft); color: var(--primary); }
.btn-outline { background: #fff; color: var(--text-2); border: 1px solid var(--border); }
.btn-danger { background: #fff0f0; color: var(--danger); }
.btn-block { width: 100%; padding: 11px; font-size: 15px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== 顶部导航条 ===== */
.app-header {
  height: var(--header-h);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; flex-shrink: 0;
  padding-top: env(safe-area-inset-top, 0);
}
.app-header .title { font-size: 16px; font-weight: 600; }
.app-header .h-action { font-size: 13px; opacity: .95; cursor: pointer; }
.app-header .h-action:active { opacity: .7; }

/* ===== 内容滚动区 ===== */
.page-scroll {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 14px; padding-bottom: 24px;
}
.page-scroll::-webkit-scrollbar { width: 0; }

/* ===== 底部导航 ===== */
.bottom-nav {
  height: var(--nav-h);
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex; flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav .nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; cursor: pointer; color: var(--text-3); font-size: 11px;
}
.bottom-nav .nav-item.active { color: var(--primary); }
.bottom-nav .nav-item svg { width: 22px; height: 22px; }
.bottom-nav .nav-item.active svg { filter: drop-shadow(0 1px 2px rgba(22,119,255,.3)); }

/* ===== 卡片 ===== */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px;
}
.card .card-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }

/* ===== 首页统计卡 ===== */
.welcome {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border-radius: var(--radius); padding: 18px 16px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.welcome .hi { font-size: 13px; opacity: .9; }
.welcome .name { font-size: 20px; font-weight: 700; margin-top: 2px; }
.welcome .role { font-size: 12px; opacity: .85; margin-top: 6px; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); padding: 16px 14px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat-card::before {
  content: ""; position: absolute; right: -12px; top: -12px;
  width: 56px; height: 56px; border-radius: 50%; background: var(--primary-soft);
}
.stat-card .num { font-size: 28px; font-weight: 700; color: var(--primary); position: relative; }
.stat-card .label { font-size: 12px; color: var(--text-2); margin-top: 4px; position: relative; }

/* ===== 列表条目 ===== */
.list-item {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 14px; margin-bottom: 10px;
}
.list-item .li-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.list-item .li-name { font-size: 15px; font-weight: 600; }
.list-item .li-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin-top: 8px; }
.list-item .li-cell { font-size: 12px; color: var(--text-2); }
.list-item .li-cell b { color: var(--text); font-weight: 500; }
.list-item .li-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ===== 标签 ===== */
.tag {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; line-height: 1.6; white-space: nowrap;
}
.tag-blue { background: var(--primary-soft); color: var(--primary); }
.tag-green { background: #e8fbe9; color: var(--success); }
.tag-orange { background: #fff4e6; color: var(--warning); }
.tag-red { background: #ffece8; color: var(--danger); }
.tag-gray { background: #f2f3f5; color: var(--text-2); }

/* ===== 筛选栏 ===== */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filter-bar select {
  flex: 1 1 auto; min-width: 120px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: #fff; color: var(--text); font-size: 13px;
}
.search-input {
  width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; font-size: 13px; margin-bottom: 10px;
}

/* ===== 弹窗 ===== */
.modal-mask {
  position: absolute; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; z-index: 50;
}
.modal {
  background: #fff; width: 100%; max-height: 88%; border-radius: 16px 16px 0 0;
  display: flex; flex-direction: column; animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(100%);} to { transform: translateY(0);} }
.modal-head {
  padding: 16px 16px 10px; display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border);
}
.modal-head .m-title { font-size: 16px; font-weight: 600; }
.modal-head .m-close { font-size: 22px; color: var(--text-3); cursor: pointer; line-height: 1; }
.modal-body { padding: 14px 16px; overflow-y: auto; }
.modal-foot { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 10px; }

/* ===== 表单 ===== */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 5px; }
.field label .req { color: var(--danger); }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; color: var(--text); background: #fff; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); }
.field.readonly input, .field.readonly select { background: #f7f8fa; color: var(--text-2); }

/* ===== 登录页 ===== */
.login-wrap { height: 100%; display: flex; flex-direction: column; padding: 0 28px; }
.login-logo {
  margin: 70px 0 8px; text-align: center;
}
.login-logo .logo-circle {
  width: 72px; height: 72px; border-radius: 18px; margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 30px;
  box-shadow: 0 8px 24px rgba(22,119,255,.35);
}
.login-logo h1 { font-size: 20px; margin: 0; }
.login-logo p { color: var(--text-2); font-size: 13px; margin: 6px 0 0; }
.login-accounts { margin-top: 36px; display: flex; flex-direction: column; gap: 12px; }
.login-accounts .acc-btn {
  display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; cursor: pointer; box-shadow: var(--shadow);
}
.login-accounts .acc-btn:active { border-color: var(--primary); }
.login-accounts .acc-avatar {
  width: 40px; height: 40px; border-radius: 10px; background: var(--primary-soft);
  color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px;
}
.login-accounts .acc-name { font-weight: 600; }
.login-accounts .acc-sub { font-size: 12px; color: var(--text-2); }

/* ===== 空状态 ===== */
.empty { text-align: center; color: var(--text-3); padding: 48px 0; font-size: 13px; }
.empty .e-icon { font-size: 40px; margin-bottom: 8px; }

/* ===== 区段标题 ===== */
.section-title { font-size: 13px; color: var(--text-2); margin: 4px 2px 10px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }

/* ===== Toast ===== */
#toast-root { position: absolute; top: 50%; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; z-index: 99; }
.toast {
  background: rgba(0,0,0,.8); color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 13px;
  animation: toastIn .2s ease; max-width: 80%;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: none;} }

/* ===== 列表项右侧按钮组 ===== */
.mini-actions { display: flex; gap: 6px; }
.fab {
  position: absolute; right: 16px; bottom: calc(var(--nav-h) + 16px);
}

/* 字典编辑行 */
.dict-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--border); }
.dict-row:last-child { border-bottom: none; }
.dict-row .d-name { font-size: 14px; }
.dict-row .d-sub { font-size: 11px; color: var(--text-3); }
.dict-group-title { font-size: 13px; font-weight: 600; color: var(--primary); margin: 14px 2px 4px; }

/* 权限徽标 */
.role-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; }
