/* 经营看板 · 管理后台样式（桌面优先，纯手写 CSS，无第三方依赖） */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --indigo: #4f46e5;
  --purple: #7c3aed;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(17, 24, 39, 0.06), 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow-lg: 0 10px 30px rgba(17, 24, 39, 0.12);
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* ── 通用控件 ─────────────────────────────────────────── */

.input {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

select.input {
  cursor: pointer;
  padding-right: 8px;
}

.input-search {
  min-width: 200px;
  flex: 1 1 200px;
}

.btn {
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.btn:hover {
  background: #f9fafb;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  background: #f3f4f6;
  color: var(--text);
}

.btn-block {
  width: 100%;
  height: 42px;
  font-size: 15px;
}

.btn-sm {
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
}

.btn-xs {
  height: 24px;
  padding: 0 8px;
  font-size: 11px;
  border-radius: 6px;
}

/* ── 登录页 ───────────────────────────────────────────── */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-title {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
}

.login-tip {
  margin: 0 0 22px;
  font-size: 13px;
  color: var(--muted);
}

.login-card .input {
  width: 100%;
  height: 42px;
  margin-bottom: 14px;
  text-align: center;
  letter-spacing: 1px;
}

.login-error {
  min-height: 18px;
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--red);
}

/* ── 顶栏 ─────────────────────────────────────────────── */

.topbar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-name {
  font-size: 16px;
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input {
  cursor: pointer;
}

.updated {
  font-size: 12px;
  color: #9ca3af;
  margin-right: 4px;
}

/* ── 主体 ─────────────────────────────────────────────── */

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px 48px;
}

/* 统计卡片 */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat-amount {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.stat-amount .unit {
  font-size: 14px;
  font-weight: 500;
  margin-right: 2px;
  color: var(--muted);
}

.stat-count {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 4px;
}

.stat-card.c-blue .stat-amount {
  color: var(--primary);
}

.stat-card.c-green .stat-amount {
  color: var(--green);
}

.stat-card.c-amber .stat-amount {
  color: var(--amber);
}

.stat-card.c-purple .stat-amount {
  color: var(--purple);
}

/* 标签页 */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.tab {
  border: none;
  background: none;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.tab:hover {
  color: var(--text);
}

.tab.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* 面板 */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: #fcfcfd;
}

.range-sep {
  font-size: 12px;
  color: var(--muted);
}

.spacer {
  flex: 1 1 auto;
}

/* 表格 */
.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table thead th {
  position: sticky;
  top: 0;
  background: #fafbfc;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid #f1f2f4;
  vertical-align: middle;
}

.table tbody tr:hover {
  background: #fafbff;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.ta-r {
  text-align: right !important;
}

.mono {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.nowrap {
  white-space: nowrap;
}

.strong {
  font-weight: 600;
}

.amount {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cell-items {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub {
  font-size: 12px;
  color: #9ca3af;
}

.empty {
  padding: 48px 16px;
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
}

/* 状态药丸 */
.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}

.pill-green {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.pill-amber {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.pill-blue {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.pill-indigo {
  background: #eef2ff;
  color: #4338ca;
  border-color: #c7d2fe;
}

.pill-red {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.pill-purple {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ddd6fe;
}

.pill-gray {
  background: #f3f4f6;
  color: #4b5563;
  border-color: #e5e7eb;
}

/* 分页 */
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

/* ── 弹窗 ─────────────────────────────────────────────── */

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--shadow-lg);
}

.modal-title {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 600;
}

.modal-body {
  font-size: 13px;
  color: #374151;
  margin-bottom: 20px;
}

.modal-body .input {
  width: 100%;
}

.modal-text {
  margin: 0;
  line-height: 1.7;
}

.modal-text.danger {
  color: var(--red);
  font-size: 12px;
}

/* 弹窗内的"高敏操作"提示条，复用 amber 配色 */
.warning-line {
  margin-top: 12px;
  padding: 8px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 12px;
  color: #92400e;
  line-height: 1.5;
}

/* 凭据行：标签 + 单行密码值 + 复制按钮 */
.cred-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 10px;
}

.cred-row + .cred-row {
  margin-top: 8px;
}

.cred-label {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--muted);
}

.cred-value {
  flex: 1 1 auto;
  font-size: 14px;
  color: var(--text);
  word-break: break-all;
  user-select: all;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Toast ────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  top: 24px;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 10px;
  background: #111827;
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  max-width: 80vw;
}

.toast.is-error {
  background: var(--red);
}

.toast.is-success {
  background: var(--green);
}

/* ── 窄屏适配 ─────────────────────────────────────────── */

@media (max-width: 900px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .container {
    padding: 16px 14px 40px;
  }

  .topbar {
    padding: 0 14px;
  }

  .updated {
    display: none;
  }
}
