/* ============================================================
   admin-theme.css（v2.2.0）— 后台自建页面共享设计令牌与组件
   主色对齐 simpleui/ElementUI 蓝系；dashboard 与系统状态页同源。
   原则：只做视觉，不改 Django 结构；组件类前缀 at-，页面按需取用。
   ============================================================ */

:root {
  --at-primary: #2563eb;
  --at-primary-d: #1d4ed8;
  --at-primary-l: #eff6ff;
  --at-green: #059669;
  --at-green-l: #ecfdf5;
  --at-amber: #d97706;
  --at-amber-l: #fffbeb;
  --at-red: #dc2626;
  --at-red-l: #fef2f2;
  --at-teal: #0d9488;
  --at-teal-l: #f0fdfa;
  --at-purple: #7c3aed;
  --at-purple-l: #f5f3ff;
  --at-ink: #1f2937;
  --at-sub: #6b7280;
  --at-faint: #9ca3af;
  --at-line: #e5e7eb;
  --at-bg: #f6f8fb;
  --at-radius: 10px;
}

/* ---------- 页头 ---------- */
.at-page-head {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  margin: 4px 0 14px;
}
.at-page-head .at-title {
  font-size: 18px; font-weight: 700; color: var(--at-ink);
  display: flex; align-items: center; gap: 8px; line-height: 1.3;
}
.at-page-head .at-title i { color: var(--at-primary); font-size: 16px; }
.at-page-head .at-sub { font-size: 12.5px; color: var(--at-sub); }
.at-page-head .at-spacer { flex: 1; }

/* ---------- 统计卡（与 dashboard 同语言） ---------- */
.at-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.at-card {
  background: #fff; border: 1px solid var(--at-line); border-radius: var(--at-radius);
  padding: 13px 15px; box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  border-top: 3px solid var(--at-primary);
}
.at-card .at-label { font-size: 12px; color: var(--at-sub); margin-bottom: 5px; }
.at-card .at-value { font-size: 24px; font-weight: 700; color: var(--at-ink); line-height: 1.15; }
.at-card .at-value small { font-size: 12px; font-weight: 400; color: var(--at-faint); margin-left: 4px; }
.at-card .at-foot { font-size: 11px; color: var(--at-faint); margin-top: 4px; }
.at-card.k-green  { border-top-color: #10b981; }
.at-card.k-amber  { border-top-color: #f59e0b; }
.at-card.k-red    { border-top-color: #ef4444; }
.at-card.k-teal   { border-top-color: #14b8a6; }
.at-card.k-purple { border-top-color: #8b5cf6; }
.at-card.k-plain  { border-top-color: var(--at-line); }

/* ---------- 面板 ---------- */
.at-panel {
  background: #fff; border: 1px solid var(--at-line); border-radius: var(--at-radius);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04); padding: 16px 18px; margin-bottom: 16px;
}
.at-panel > .at-panel-title {
  font-size: 14px; font-weight: 700; color: var(--at-ink);
  margin: 0 0 12px; padding-left: 10px; border-left: 4px solid var(--at-primary);
  line-height: 1.3; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.at-panel > .at-panel-title .at-sub { font-size: 12px; color: var(--at-sub); font-weight: 400; }

/* ---------- 按钮 ---------- */
.at-btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid transparent; border-radius: 8px; cursor: pointer;
  font-size: 13px; padding: 7px 16px; line-height: 1.4; text-decoration: none !important;
  transition: filter .15s ease, background .15s ease;
  background: var(--at-primary); color: #fff !important;
}
.at-btn:hover { filter: brightness(1.08); }
.at-btn.big { font-size: 14px; padding: 9px 22px; }
.at-btn.plain { background: #fff; color: var(--at-primary) !important; border-color: #c7d7f7; }
.at-btn.plain:hover { background: var(--at-primary-l); }
.at-btn.success { background: var(--at-green); }
.at-btn.warn { background: var(--at-amber); }
.at-btn.danger { background: var(--at-red); }
.at-btn.danger-plain { background: #fff; color: var(--at-red) !important; border-color: #f3b4b4; }
.at-btn.danger-plain:hover { background: var(--at-red-l); }
.at-btn.sm { font-size: 12px; padding: 4px 10px; border-radius: 6px; }

/* ---------- 徽章 ---------- */
.at-badge {
  display: inline-block; font-size: 11.5px; line-height: 1;
  border-radius: 999px; padding: 4px 10px; white-space: nowrap;
  background: var(--at-primary-l); color: var(--at-primary-d);
}
.at-badge.k-green  { background: var(--at-green-l); color: #047857; }
.at-badge.k-amber  { background: var(--at-amber-l); color: #92400e; }
.at-badge.k-red    { background: var(--at-red-l); color: #b91c1c; }
.at-badge.k-teal   { background: var(--at-teal-l); color: #0f766e; }
.at-badge.k-purple { background: var(--at-purple-l); color: #6d28d9; }
.at-badge.k-gray   { background: #f3f4f6; color: var(--at-sub); }

/* ---------- 表格 ---------- */
.at-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.at-table thead th {
  background: #f8fafc; color: var(--at-sub); font-weight: 600; text-align: left;
  padding: 10px 12px; border-bottom: 1px solid var(--at-line); white-space: nowrap;
}
.at-table tbody td { padding: 10px 12px; border-bottom: 1px solid #eef1f5; color: var(--at-ink); }
.at-table tbody tr:nth-child(even) { background: #fbfcfe; }
.at-table tbody tr:hover { background: var(--at-primary-l); }
.at-table tbody tr:last-child td { border-bottom: none; }
.at-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 结果横幅 ---------- */
.at-alert { border-radius: var(--at-radius); padding: 11px 15px; margin-bottom: 14px; font-size: 13px; line-height: 1.7; }
.at-alert.k-ok   { background: var(--at-green-l); border: 1px solid #a7f3d0; color: #065f46; }
.at-alert.k-warn { background: var(--at-amber-l); border: 1px solid #fde68a; color: #92400e; }
.at-alert.k-err  { background: var(--at-red-l); border: 1px solid #fecaca; color: #991b1b; }

/* ---------- 月份切换条 ---------- */
.at-monthnav {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--at-line); border-radius: var(--at-radius);
  padding: 10px 14px; margin-bottom: 14px;
}
.at-monthnav .at-current { font-size: 15px; font-weight: 700; color: var(--at-ink); margin: 0 6px; }
.at-monthnav .at-current small { color: var(--at-faint); font-weight: 400; margin-left: 6px; }
.at-monthnav form { display: flex; align-items: center; gap: 6px; margin: 0; }
.at-monthnav select {
  border: 1px solid var(--at-line); border-radius: 7px; padding: 5px 8px;
  font-size: 13px; color: var(--at-ink); background: #fff;
}
.at-monthnav .nav-arrow {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 7px; text-decoration: none !important;
  border: 1px solid var(--at-line); color: var(--at-primary) !important; background: #fff;
}
.at-monthnav .nav-arrow:hover { background: var(--at-primary-l); border-color: #c7d7f7; }
.at-monthnav .nav-arrow.off { color: #d1d5db !important; pointer-events: none; }

/* ---------- 步骤条 ---------- */
.at-steps { display: flex; gap: 0; margin: 4px 0 16px; flex-wrap: wrap; }
.at-steps .at-step { flex: 1; min-width: 150px; display: flex; align-items: center; gap: 9px; padding: 10px 8px; position: relative; }
.at-steps .at-step .at-no {
  flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--at-primary);
  color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.at-steps .at-step .at-txt { font-size: 12.5px; color: var(--at-ink); line-height: 1.4; }
.at-steps .at-step .at-txt small { display: block; color: var(--at-faint); }
.at-steps .at-step:not(:last-child)::after {
  content: ""; position: absolute; right: -12px; top: 50%; width: 24px; height: 2px;
  background: var(--at-line); z-index: 0;
}
.at-steps .at-step { z-index: 1; }

/* ---------- 时间线（生命周期流水） ---------- */
.at-timeline { list-style: none; margin: 0; padding: 0; }
.at-timeline li { position: relative; padding: 0 0 16px 26px; }
.at-timeline li::before {
  content: ""; position: absolute; left: 7px; top: 5px; bottom: -2px; width: 2px; background: #e8edf3;
}
.at-timeline li:last-child::before { display: none; }
.at-timeline li::after {
  content: ""; position: absolute; left: 2px; top: 5px; width: 12px; height: 12px;
  border-radius: 50%; background: #fff; border: 3px solid var(--at-primary);
}
.at-timeline li.ev-in::after   { border-color: #10b981; }
.at-timeline li.ev-out::after  { border-color: #ef4444; }
.at-timeline li.ev-mgmt::after { border-color: #9ca3af; }
.at-timeline .at-t-head { font-size: 13px; color: var(--at-ink); }
.at-timeline .at-t-head b { margin-right: 6px; }
.at-timeline .at-t-meta { font-size: 12px; color: var(--at-faint); margin-top: 3px; }

/* ---------- Django 原生 module 轻量统一（纯视觉，安全） ---------- */
#content-main .module {
  border: 1px solid var(--at-line); border-radius: var(--at-radius);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04); overflow: hidden; background: #fff;
}
#content-main .module > h2 {
  background: linear-gradient(180deg, #fbfdff, #f1f5f9); color: var(--at-ink);
  font-size: 15px; font-weight: 700; padding: 13px 18px; border-bottom: 1px solid var(--at-line);
}
