/* 鲜宠生活管理后台 — 克制运营台风格 */
:root {
  --primary: #3f4a2e;
  --primary-dark: #2f3722;
  --primary-light: #6b7a52;
  --accent: #3f4a2e;
  --accent-soft: #eef0ea;
  --bg: #f3f3f1;
  --card: #fff;
  --text: #1c1917;
  --muted: #78716c;
  --border: #e4e2de;
  --danger: #b42318;
  --sidebar: #1c211c;
  --font: 'Noto Sans SC', 'IBM Plex Sans', sans-serif;
  --radius: 6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }

/* ========== 登录页（对开：品牌面 + 表单） ========== */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 42%) 1fr;
  background: #fff;
}

.login-aside {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  color: #f5f5f4;
  display: flex;
  align-items: flex-end;
}

.login-aside-photo {
  position: absolute;
  inset: 0;
  background: url('/admin/images/bg-login.jpg') center center / cover no-repeat;
  filter: grayscale(0.15) contrast(1.02);
}

.login-aside-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(28, 33, 28, 0.25) 0%, rgba(28, 33, 28, 0.78) 55%, rgba(28, 33, 28, 0.92) 100%);
}

.login-page.store-mode .login-aside-scrim {
  background:
    linear-gradient(180deg, rgba(42, 32, 24, 0.3) 0%, rgba(42, 32, 24, 0.82) 55%, rgba(42, 32, 24, 0.94) 100%);
}

.login-aside-body {
  position: relative;
  z-index: 1;
  padding: 48px 44px 56px;
  max-width: 420px;
}

.login-brand-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.18em;
  margin-bottom: 20px;
  opacity: 0.85;
}

.login-brand-heading {
  font-size: clamp(28px, 3.2vw, 40px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
}

.login-brand-desc {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(245, 245, 244, 0.72);
  max-width: 22em;
}

.login-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background:
    linear-gradient(180deg, #fafaf8 0%, #f3f3f1 100%);
}

.login-panel {
  width: 100%;
  max-width: 360px;
}

.login-panel-head {
  margin-bottom: 28px;
}

.login-panel-head h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.login-panel-head p {
  font-size: 13px;
  color: var(--muted);
}

.login-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.login-tab {
  appearance: none;
  border: none;
  background: transparent;
  padding: 10px 0;
  margin-right: 24px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.login-tab:hover { color: var(--text); }

.login-tab.active {
  color: var(--text);
  border-bottom-color: var(--primary);
}

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #44403c;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #8a9478;
  box-shadow: 0 0 0 3px rgba(63, 74, 46, 0.12);
}

.btn {
  padding: 9px 16px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-family: var(--font);
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-login {
  width: 100%;
  padding: 11px 16px;
  margin-top: 6px;
  background: var(--primary);
  color: #fff;
}

.btn-login:hover { background: var(--primary-dark); }

.login-page.store-mode .btn-login {
  background: #8a4b1f;
}
.login-page.store-mode .btn-login:hover { background: #6f3c18; }
.login-page.store-mode .login-tab.active { border-bottom-color: #8a4b1f; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-outline { background: #fff; border: 1px solid var(--border); color: #57534e; }
.btn-outline:hover { border-color: #a8a29e; color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 14px;
  text-align: left;
  padding: 10px 12px;
  background: #fef3f2;
  border: 1px solid #fecdca;
  border-radius: var(--radius);
}

.login-hint {
  margin-top: 20px;
  font-size: 12px;
  color: #a8a29e;
  line-height: 1.5;
}

@media (max-width: 860px) {
  .login-page { grid-template-columns: 1fr; }
  .login-aside {
    min-height: 220px;
    align-items: flex-end;
  }
  .login-aside-body { padding: 28px 24px 32px; }
  .login-brand-heading { font-size: 26px; }
  .login-main { padding: 32px 20px 48px; align-items: flex-start; }
}

/* ========== 主布局 ========== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--sidebar);
  color: #e7e5e4;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  border-right: 1px solid #141814;
}

.sidebar-bg { display: none; }

.sidebar .logo,
.sidebar nav,
.sidebar-footer {
  position: relative;
  z-index: 1;
}

.sidebar .logo {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: #3f4a2e;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #f5f5f4;
}

.sidebar .logo strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fafaf9;
}

.sidebar .logo small {
  font-size: 11px;
  opacity: 0.45;
  font-weight: 400;
}

.sidebar nav { flex: 1; padding: 10px 0 12px; overflow-y: auto; }

.nav-group { margin-bottom: 8px; }

.nav-group-title {
  padding: 12px 16px 6px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(231, 229, 228, 0.38);
}

.sidebar nav a {
  display: block;
  padding: 8px 16px;
  margin: 0 8px;
  color: rgba(231, 229, 228, 0.72);
  text-decoration: none;
  font-size: 13px;
  border-radius: 4px;
  transition: background 0.12s, color 0.12s;
}

.sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.sidebar nav a.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  box-shadow: none;
  border-radius: 4px;
  margin-left: 8px;
  padding-left: 16px;
}

.sidebar-footer {
  padding: 14px 16px;
  font-size: 11px;
  color: rgba(231, 229, 228, 0.32);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }

.topbar {
  background: #fff;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar #pageTitle {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.topbar .user { font-size: 13px; color: var(--muted); }
.content { padding: 24px 28px; flex: 1; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 20px;
  border: 1px solid var(--border);
}

.stat-card:hover { transform: none; box-shadow: none; }

.stat-card .label { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.stat-card .value { font-size: 24px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  box-shadow: none;
}

.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 12px; }
.card-header h2 { font-size: 15px; font-weight: 600; color: var(--text); }
.page-hint { font-size: 13px; color: var(--muted); margin: -4px 0 16px; }
.page-hint a { color: var(--primary); text-decoration: none; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
}
td { padding: 11px 12px; border-bottom: 1px solid #f0efed; }
tr:hover td { background: #fafaf8; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; }
.tag-green { background: #ecfdf3; color: #067647; }
.tag-orange { background: #fffaeb; color: #b54708; }
.tag-gray { background: #f5f5f4; color: #78716c; }
.tag-red { background: #fef3f2; color: #b42318; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: #fff;
  border-radius: 8px;
  padding: 24px 28px;
  width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  box-shadow: 0 16px 40px rgba(28, 25, 23, 0.18);
}

.modal h3 { margin-bottom: 16px; color: var(--text); font-size: 16px; }
.modal.modal-wide { width: 720px; max-width: 92vw; padding: 24px 28px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }

.member-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border, #eee);
}
.member-detail-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  background: #3f4a2e;
  flex-shrink: 0;
}
.member-detail-avatar img { width: 100%; height: 100%; object-fit: cover; }
.member-detail-avatar-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 22px; font-weight: 600;
}
.member-detail-title h3 { margin: 0 0 6px; font-size: 20px; }
.member-detail-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: #666; }
.member-code {
  font-family: ui-monospace, monospace;
  background: #f5f7f4;
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--primary-dark, #2e5c32);
  white-space: nowrap;
  letter-spacing: 0.5px;
}
.member-id { color: #999; }

.member-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.member-stat-grid-3 { grid-template-columns: repeat(3, 1fr); }
.member-stat-card {
  background: #f8faf7;
  border-radius: 12px;
  padding: 14px 16px;
  text-align: center;
}
.member-stat-card .label { font-size: 12px; color: #888; margin-bottom: 4px; }
.member-stat-card .value { font-size: 18px; font-weight: 600; color: var(--primary-dark, #2e5c32); }

.member-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
  margin-bottom: 16px;
  font-size: 14px;
}
.member-info-item .label { color: #888; margin-right: 8px; }

.member-order-stats { margin-bottom: 20px; }
.member-order-stats > .label { display: block; font-size: 13px; color: #888; margin-bottom: 8px; }
.member-order-tags { display: flex; gap: 8px; flex-wrap: wrap; }

.member-log-section { margin-bottom: 16px; }
.member-log-section h4 { font-size: 14px; color: var(--primary-dark); margin: 0 0 8px; }
.member-log-table-wrap {
  max-height: 140px;
  overflow: auto;
  border: 1px solid #eee;
  border-radius: 8px;
}
.member-log-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.member-log-table th {
  background: #f8faf7;
  padding: 8px 10px;
  text-align: left;
  font-weight: 500;
  color: #666;
  position: sticky;
  top: 0;
}
.member-log-table td { padding: 8px 10px; border-top: 1px solid #f0f0f0; }
.member-log-table td.empty { text-align: center; color: #999; padding: 16px; }
.text-green { color: #2e7d32; font-weight: 500; }
.text-red { color: #c62828; font-weight: 500; }
.member-delete-hint { font-size: 13px; color: #999; margin: 0 0 8px; }
.member-empty-hint { font-size: 13px; color: #999; margin: 4px 0 0; }

.placeholder-page { max-width: 720px; }
.placeholder-page h2 { margin-bottom: 8px; color: var(--primary-dark); }
.placeholder-page .placeholder-desc { color: var(--muted); margin-bottom: 20px; font-size: 14px; }
.placeholder-features {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.placeholder-feature {
  background: #f8faf7;
  border: 1px dashed #d8e0d4;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13px;
  color: #666;
}
.placeholder-feature.done { border-style: solid; background: #fff; color: var(--primary-dark); }
.placeholder-feature.done::before { content: '✓ '; color: #2e7d32; }

.todo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  padding: 8px 0;
}
.todo-item {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  cursor: pointer;
  border: 1px solid var(--border);
}
.todo-item:hover { background: #fafaf8; }
.todo-count { display: block; font-size: 28px; font-weight: 700; color: var(--primary-dark); margin-bottom: 6px; }
.todo-label { font-size: 13px; color: #666; }

.analytics-section { margin-top: 24px; }
.analytics-section h3 { font-size: 15px; color: var(--primary-dark); margin-bottom: 12px; }

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}
.chart-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 16px 8px;
  border: 1px solid var(--border);
  box-shadow: none;
}
.chart-card h3 {
  font-size: 14px;
  font-weight: 600;
  color: #3d3d3d;
  margin: 0 0 8px;
}
.chart-box {
  width: 100%;
  height: 280px;
}
.chart-card.full {
  grid-column: 1 / -1;
}
@media (max-width: 960px) {
  .chart-grid { grid-template-columns: 1fr; }
  .chart-card.full { grid-column: auto; }
}

.breed-stat-list { display: flex; flex-direction: column; gap: 10px; }
.breed-stat-item { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.breed-stat-name { width: 48px; color: #666; flex-shrink: 0; }
.breed-stat-bar-wrap { flex: 1; height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden; }
.breed-stat-bar { height: 100%; background: #3f4a2e; border-radius: 2px; min-width: 4px; }
.breed-stat-count { width: 32px; text-align: right; font-weight: 600; color: var(--primary-dark); }
.pet-avatar-fallback {
  width: 32px; height: 32px; border-radius: 50%;
  background: #e8f0e4; color: #5B6739;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; flex-shrink: 0;
}

@media (max-width: 640px) {
  .member-stat-grid { grid-template-columns: repeat(2, 1fr); }
  .member-info-grid { grid-template-columns: 1fr; }
}

.image-upload-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.upload-preview {
  max-width: 240px;
  max-height: 140px;
  border-radius: 10px;
  border: 1px solid var(--border);
  object-fit: cover;
}
.upload-btn {
  cursor: pointer;
  display: inline-block;
}
.upload-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.hidden { display: none !important; }

.thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: #f0f0f0; }
