/* 后台前端样式：深墨绿侧栏 + 浅色数据区 */
:root {
  --primary: #12998b; --primary-dark: #0c7c71; --primary-soft: #e2f4ef;
  --side: #163c39; --side-2: #1e4b47; --ink: #1d3b38; --ink-2: #536f6b;
  --muted: #8ba5a0; --line: #e6efec; --bg: #f4f8f7; --card: #fff;
  --red: #ef5b52; --amber: #e8a13a;
}
* { 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(--ink); font-size: 13px; line-height: 1.55;
}
img { max-width: 100%; height: auto; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
[hidden] { display: none !important; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e6f4ef, #cfe8e0); padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 16px;
  padding: 32px; box-shadow: 0 20px 50px rgba(18, 70, 62, .14); }
.login-logo { font-size: 30px; margin-bottom: 10px; }
.login-card h1 { font-size: 21px; font-weight: 800; }
.login-card p { font-size: 12px; color: var(--muted); margin: 6px 0 22px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 11px; color: var(--ink-2); font-weight: 600; margin-bottom: 5px; }
.field { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
  outline: none; background: #fff; font-size: 12.5px; }
.field:focus { border-color: var(--primary); }
textarea.field { resize: vertical; min-height: 70px; }
.login-error { color: var(--red); font-size: 11.5px; min-height: 18px; margin-bottom: 6px; }
.login-hint { font-size: 10.5px; color: var(--muted); text-align: center; margin-top: 16px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 17px; border-radius: 8px; font-size: 12px; font-weight: 600;
  background: var(--primary); color: #fff; transition: .18s; }
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-ghost { background: #edf6f3; color: var(--primary-dark); }
.btn-ghost:hover { background: #d9eee8; }
.btn-sm { padding: 6px 12px; font-size: 11px; }
.btn-danger { background: #fff0ee; color: var(--red); }

/* 布局 */
.admin-app { display: flex; min-height: 100vh; }
.admin-side { width: 208px; flex: 0 0 208px; background: var(--side); color: #d7ebe6;
  display: flex; flex-direction: column; padding: 20px 12px; position: sticky; top: 0; height: 100vh; }
.admin-brand { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 700;
  padding: 0 8px 22px; color: #fff; }
.admin-logo { font-size: 18px; }
.admin-nav { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; flex: 1; }
.admin-nav button { display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 11px; border-radius: 8px; color: #a9c9c2; text-align: left; font-size: 12px; }
.admin-nav button:hover { background: var(--side-2); color: #fff; }
.admin-nav button.active { background: var(--primary); color: #fff; font-weight: 600; }
.admin-nav .nav-sep { font-size: 10px; color: #6f9991; padding: 14px 11px 5px; letter-spacing: 1px; }
.admin-side-foot { font-size: 10px; color: #7fa9a1; line-height: 1.9; padding: 12px 8px 0; }
.status-dot { color: #6fd0b6; }
.status-dot.off { color: #f0ac3b; }
.tiny { color: #608b84; }

.admin-main { flex: 1; min-width: 0; }
.admin-top { display: flex; justify-content: space-between; align-items: center; gap: 16px;
  background: #fff; padding: 18px 26px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.admin-top h1 { font-size: 19px; font-weight: 800; }
.admin-top p { font-size: 11px; color: var(--muted); margin-top: 2px; }
.admin-top-tools { display: flex; align-items: center; gap: 10px; }
.user-badge { background: var(--primary-soft); color: var(--primary-dark);
  border-radius: 999px; padding: 5px 13px; font-size: 11.5px; font-weight: 600; }
.admin-content { padding: 22px 26px 40px; }

/* 卡片与表格 */
.panel { background: #fff; border-radius: 12px; padding: 18px 20px;
  box-shadow: 0 3px 14px rgba(20, 80, 72, .05); border: 1px solid #edf4f1; }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-title { font-size: 14px; font-weight: 700; }
.panel-sub { font-size: 11px; color: var(--muted); }

.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card { background: #fff; border-radius: 12px; padding: 17px 19px;
  border: 1px solid #edf4f1; box-shadow: 0 3px 14px rgba(20, 80, 72, .05); }
.stat-label { font-size: 11px; color: var(--muted); }
.stat-num { font-size: 26px; font-weight: 800; margin-top: 4px; }
.stat-foot { font-size: 10.5px; color: var(--primary-dark); margin-top: 3px; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12px; }
table.data th { text-align: left; font-size: 10.5px; color: var(--muted); font-weight: 600;
  padding: 9px 10px; background: #f7fbf9; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 10px; border-bottom: 1px solid #f0f6f4; color: var(--ink-2); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #fafdfc; }
.cell-strong { color: var(--ink); font-weight: 600; }
.pill { display: inline-block; font-size: 10px; padding: 2px 8px; border-radius: 6px;
  background: var(--primary-soft); color: var(--primary-dark); }
.pill.gray { background: #f0f4f3; color: var(--muted); }
.pill.red { background: #fff0ee; color: var(--red); }
.pill.amber { background: #fff5e5; color: #bd8425; }
.row-btns { display: flex; gap: 5px; white-space: nowrap; }
.mini-btn { padding: 4px 9px; border-radius: 6px; font-size: 10.5px; background: #eef6f3; color: var(--ink-2); }
.mini-btn:hover { background: var(--primary-soft); color: var(--primary-dark); }
.mini-btn.del:hover { background: #fff0ee; color: var(--red); }
.empty { padding: 38px; text-align: center; color: var(--muted); font-size: 12px; }

.modal-mask { position: fixed; inset: 0; z-index: 100; background: rgba(12, 45, 41, .42);
  display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { width: 100%; max-width: 460px; background: #fff; border-radius: 14px; padding: 22px;
  max-height: 88vh; overflow: auto; box-shadow: 0 24px 60px rgba(10, 60, 54, .25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { font-size: 20px; color: var(--muted); }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: rgba(22, 60, 57, .95); color: #fff; padding: 10px 20px; border-radius: 9px;
  font-size: 12px; z-index: 200; opacity: 0; pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 平板 ---------------- */
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-content { padding: 16px; }
}

/* ---------------- 手机：侧栏 → 顶部横滑导航，表格可横滑，弹窗底部抽屉 ---------------- */
@media (max-width: 640px) {
  body { font-size: 14px; -webkit-tap-highlight-color: transparent; }
  .admin-app { display: block; }
  .admin-side {
    width: 100%; height: auto; position: sticky; top: 0; z-index: 60;
    flex-direction: row; align-items: center; gap: 8px;
    padding: 8px 10px; overflow: hidden;
  }
  .admin-brand { padding: 0; flex: none; font-size: 13px; }
  .admin-brand span:not(.admin-logo) { display: none; }
  .admin-nav {
    flex-direction: row; gap: 4px; flex: 1; overflow-x: auto;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .admin-nav::-webkit-scrollbar { display: none; }
  .admin-nav button {
    width: auto; flex: none; min-height: 40px; padding: 8px 12px;
    white-space: nowrap; font-size: 12px;
  }
  .admin-nav button span:not(.nav-icon) { display: inline; }
  .admin-side-foot, .admin-nav .nav-sep { display: none; }

  .admin-top { padding: 12px 14px; gap: 8px; }
  .admin-top h1 { font-size: 17px; }
  .admin-top p { display: none; }
  .admin-top-tools { width: 100%; justify-content: flex-end; }
  .admin-content { padding: 12px 12px 32px; }

  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .stat-card { padding: 12px; }
  .stat-num { font-size: 21px; }
  .panel { padding: 14px 12px; border-radius: 12px; }
  .panel + .panel { margin-top: 12px; }
  .panel-head { gap: 8px; }

  .table-wrap { margin: 0 -2px; -webkit-overflow-scrolling: touch; }
  table.data { min-width: 620px; font-size: 12.5px; }
  table.data th, table.data td { padding: 10px 8px; }

  /* 触控目标与输入体验 */
  .btn { min-height: 44px; padding: 10px 16px; font-size: 13px; }
  .btn-sm, .mini-btn { min-height: 38px; padding: 8px 12px; font-size: 12px; }
  .row-btns { gap: 7px; }
  input, select, textarea { font-size: 16px; }
  .field { min-height: 46px; padding: 11px 12px; }
  textarea.field { min-height: 88px; }
  .form-row label { font-size: 12.5px; }
  .modal-close { min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }

  .login-wrap { padding: 14px; align-items: flex-start; }
  .login-card { margin: auto 0; padding: 24px 20px; border-radius: 16px; }
  .login-card h1 { font-size: 20px; }
  .login-card .btn { min-height: 46px; }

  .modal-mask { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100%; border-radius: 18px 18px 0 0; max-height: 88vh;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  }
  .form-actions .btn { flex: 1; min-height: 46px; }
  .toast { bottom: calc(24px + env(safe-area-inset-bottom)); max-width: 90vw; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
