/* 千亿东家管理端 — 对齐 qianyi_admin 布局 + 酒红品牌色 */
:root {
  --sidebar-bg: #223046;
  --sidebar-active: #1a2638;
  --sidebar-text: rgba(255, 255, 255, 0.75);
  --sidebar-text-active: #fff;
  --accent: #6b1c2e;
  --accent-dark: #3d0f1a;
  --accent-gold: #c9a227;
  --page-bg: #f0f2f5;
  --card-bg: #fff;
  --border: #e4e7ed;
  --text: #303133;
  --text-secondary: #909399;
  --sidebar-w: 220px;
  --header-h: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body.admin-body {
  font-family: 'PingFang SC', 'Microsoft YaHei', -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--page-bg);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ========== 登录页 ========== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 80px;
  padding: 40px 24px;
  background: linear-gradient(135deg, #1a2638 0%, #223046 40%, #3d0f1a 100%);
}

.login-page__brand {
  text-align: center;
  color: #fff;
}

.login-brand-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--accent-gold), #e8d48b);
  color: var(--accent-dark);
  font-size: 36px;
  font-weight: 700;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.login-brand-title {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
}

.login-brand-sub {
  font-size: 14px;
  opacity: 0.75;
}

.login-page__card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 40px 36px;
  width: 400px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
}

.login-card-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 28px;
  text-align: center;
}

.login-form .form-field { margin-bottom: 20px; }

.login-form label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.login-form input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-error {
  color: #f56c6c;
  font-size: 13px;
  margin-bottom: 12px;
  text-align: center;
}

.login-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 16px;
}

.login-hint a { color: var(--accent); text-decoration: none; }
.login-hint a:hover { text-decoration: underline; }

/* ========== 主布局 ========== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand__mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-gold), #e8d48b);
  color: var(--accent-dark);
  font-size: 18px;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand__text strong {
  display: block;
  font-size: 15px;
  color: #fff;
}

.sidebar-brand__text small {
  font-size: 11px;
  opacity: 0.65;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.sidebar-nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.2s, color 0.2s;
  border-left: 3px solid transparent;
}

.sidebar-nav__item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-text-active);
}

.sidebar-nav__item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  border-left-color: var(--accent-gold);
}

.nav-icon { font-size: 16px; width: 22px; text-align: center; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-footer__link {
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  text-decoration: none;
}

.sidebar-footer__link:hover { color: #fff; }

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-header {
  height: var(--header-h);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.breadcrumb {
  font-size: 14px;
  color: var(--text-secondary);
}

.breadcrumb .bc-sep { margin: 0 6px; opacity: 0.5; }
.breadcrumb .bc-current { color: var(--text); font-weight: 500; }

.app-header__right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.role-chip {
  font-size: 12px;
  padding: 4px 10px;
  background: #fdf6ec;
  color: #e6a23c;
  border-radius: 4px;
  border: 1px solid #faecd8;
}

.user-menu { position: relative; }

.user-menu__trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  border-radius: 6px;
}

.user-menu__trigger:hover { background: #f5f7fa; }

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-menu__arrow { font-size: 10px; color: var(--text-secondary); }

.user-menu__dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  min-width: 140px;
  z-index: 100;
  overflow: hidden;
}

.user-menu__dropdown a {
  display: block;
  padding: 10px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}

.user-menu__dropdown a:hover { background: #f5f7fa; }

.app-content {
  flex: 1;
  padding: 20px 24px 32px;
  overflow-y: auto;
}

/* ========== 页面头 ========== */
.page-head {
  margin-bottom: 20px;
}

.page-head__title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.page-head__sub {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ========== 面板卡片 ========== */
.panel-card {
  background: var(--card-bg);
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
  overflow: hidden;
}

.panel-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}

.panel-card__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.panel-card__body { padding: 16px 20px 20px; }

.panel-card__head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ========== 仪表盘 ========== */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 900px) {
  .metric-row { grid-template-columns: repeat(2, 1fr); }
}

.metric-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.metric-card__label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.metric-card__value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
}

.metric-card__value.accent { color: var(--accent); }
.metric-card__value.gold { color: var(--accent-gold); }
.metric-card__value.green { color: #67c23a; }

.todo-list { list-style: none; }

.todo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.todo-item:last-child { border-bottom: none; }

.todo-item__label { font-size: 14px; color: var(--text); }

.todo-item__count {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  min-width: 32px;
  text-align: right;
}

.todo-item a.todo-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
}

.todo-item a.todo-link:hover { text-decoration: underline; }

.quick-links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.quick-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: #f5f7fa;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  transition: background 0.2s;
  border: 1px solid transparent;
  cursor: pointer;
}

.quick-link:hover {
  background: #ecf5ff;
  border-color: #d9ecff;
  color: var(--accent);
}

.quick-link__icon { font-size: 20px; }

/* ========== 筛选表单 ========== */
.filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
}

.filter-form__fields {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  flex: 1;
}

.filter-field label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.filter-field input,
.filter-field select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  min-width: 160px;
}

.filter-form__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ========== 表格 ========== */
.admin-table-scroll { overflow-x: auto; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid #ebeef5;
}

.admin-table th {
  background: #fafafa;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

.admin-table--stripe tbody tr:nth-child(even) { background: #fafafa; }
.admin-table tbody tr:hover td { background: #f5f7fa; }

.table-thumb {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 6px;
  background: #f5f7fa;
  border: 1px solid var(--border);
}

/* ========== 标签 ========== */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.5;
}

.tag-success { background: #f0f9eb; color: #67c23a; }
.tag-warning { background: #fdf6ec; color: #e6a23c; }
.tag-danger { background: #fef0f0; color: #f56c6c; }
.tag-primary { background: #ecf5ff; color: #409eff; }
.tag-info { background: #f4f4f5; color: #909399; }
.tag-default { background: #f4f4f5; color: #606266; }

/* ========== 按钮 ========== */
.btn {
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  line-height: 1.4;
}

.btn-block { width: 100%; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.btn-outline {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}

.btn-outline:hover { color: var(--accent); border-color: var(--accent); }

.btn-danger {
  background: #fff;
  border-color: #f56c6c;
  color: #f56c6c;
}

.btn-danger:hover { background: #fef0f0; }

.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* 兼容旧类名 */
.admin-card, .stat-grid, .stat-card, .admin-toolbar, .status-badge { /* legacy noop */ }

/* ========== 上传 ========== */
.product-upload-box {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.product-upload-preview {
  width: 120px;
  height: 120px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-upload-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.product-upload-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.upload-hint {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.product-upload-row > input#f-image { width: 100%; margin-top: 8px; }

.admin-modal-box--wide { max-width: 640px; }

.label-hint {
  font-weight: 400;
  color: var(--text-secondary);
  font-size: 12px;
}

.gallery-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
  min-height: 48px;
}

.gallery-empty {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 8px 0;
}

.gallery-item {
  position: relative;
  width: 100px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fafafa;
}

.gallery-item img {
  width: 100px;
  height: 100px;
  object-fit: contain;
  display: block;
}

.gallery-item__actions {
  display: flex;
  gap: 2px;
  padding: 4px;
  background: #fff;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  justify-content: center;
}

.gallery-item__actions .btn-sm {
  padding: 2px 6px;
  font-size: 11px;
  min-width: 0;
}

.gallery-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.gallery-toolbar input[type="file"] {
  font-size: 13px;
  max-width: 220px;
}

/* ========== 弹窗 ========== */
.admin-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.admin-modal-box {
  background: #fff;
  border-radius: 8px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.admin-modal-box h3 {
  margin-bottom: 20px;
  font-size: 18px;
  color: var(--text);
}

.form-row { margin-bottom: 16px; }

.form-row label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
}

.form-row textarea { min-height: 80px; resize: vertical; }

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.toast-admin {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--sidebar-bg);
  color: #fff;
  padding: 12px 20px;
  border-radius: 6px;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast-admin.show { opacity: 1; }

.order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.logistics-cell code {
  font-size: 12px;
  color: var(--accent);
  background: #f5f7fa;
  padding: 2px 6px;
  border-radius: 4px;
}

@media (max-width: 768px) {
  .login-page { flex-direction: column; gap: 32px; }
  .app-sidebar { width: 64px; }
  .sidebar-brand__text, .nav-label, .sidebar-footer { display: none; }
  .sidebar-nav__item { justify-content: center; padding: 14px; }
}
