/* 石头代充 · 管理后台视觉刷新（在 styles.css 之后加载，覆盖旧配色、字号与组件） */
:root {
  --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --faint: #94a3b8;
  --line: #e2e8f0; --line-2: #f1f5f9; --surface: #fff; --surface-2: #f8fafc;
  --brand: #0d9668; --brand-strong: #047857; --brand-soft: #ecfdf5; --brand-ring: rgba(13, 150, 104, .18);
  --danger: #dc2626;
  --card-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .12);
  font-family: "Inter", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink); background: #f5f6f8; -webkit-font-smoothing: antialiased;
}
body { font-size: 14px; line-height: 1.55; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--brand-ring); outline-offset: 2px; }

/* ---------- Sidebar ---------- */
.app-shell { grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { background: #0b1220; border-right: 0; padding: 24px 14px 20px; color: #e2e8f0; }
.brand { padding: 0 10px 32px; }
.brand strong { font-size: 18px; font-weight: 800; color: #fff; }
.brand small { color: #64748b; font-size: 10px; letter-spacing: .14em; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(135deg, #1e293b, #0f172a); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.brand-mark span { box-shadow: none; transform: rotate(-17deg) scale(.72); }
.brand-mark span:nth-child(1) { background: #6ee7b7; }
.brand-mark span:nth-child(2) { background: #34d399; }
.brand-mark span:nth-child(3) { background: #fbbf24; }
.workspace-label { color: #475569; font-size: 11px; font-weight: 700; letter-spacing: .08em; padding: 0 12px; }
.nav-list { gap: 2px; }
.nav-item { height: 40px; padding: 0 12px; border-radius: 10px; color: #94a3b8; font-size: 14px; font-weight: 500; transition: background .15s, color .15s; }
.nav-item:hover { background: rgba(148, 163, 184, .1); color: #f1f5f9; }
.nav-item.active { background: rgba(16, 185, 129, .14); color: #6ee7b7; font-weight: 600; box-shadow: inset 3px 0 0 #10b981; }
.nav-icon { font-size: 16px; opacity: .9; }
.sidebar-footer { border-top: 1px solid rgba(148, 163, 184, .14); padding: 16px 10px 0; }
.secure-badge .dot { background: #34d399; box-shadow: 0 0 0 4px rgba(52, 211, 153, .18); }
.secure-badge b { font-size: 13px; color: #e2e8f0; }
.secure-badge small { color: #64748b; font-size: 12px; }
.sidebar-footer > a { color: #64748b; font-size: 12px; }
.sidebar-footer > a:hover { color: #e2e8f0; }

/* ---------- Topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; height: 64px; padding: 0 36px; background: rgba(255, 255, 255, .85); backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--line); }
.crumb { font-size: 13px; color: var(--faint); }
.crumb b { color: #cbd5e1; }
.crumb strong { color: var(--ink); font-weight: 600; }
.top-actions { gap: 10px; }
.api-state { border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 600; background: var(--brand-soft); border-color: #a7f3d0; color: var(--brand-strong); }
.api-state i { background: #10b981; }
.api-state.error { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.api-state.error i { background: #ef4444; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border-color: var(--line); color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); }
.avatar { width: 36px; height: 36px; background: linear-gradient(135deg, #1e293b, #0b1220); color: #6ee7b7; font-size: 13px; }

/* ---------- Page ---------- */
.content-wrap { padding: 32px 36px 72px; }
.admin-page { max-width: 1180px; }
.eyebrow { color: var(--brand); font-size: 12px; font-weight: 700; letter-spacing: .06em; margin-bottom: 6px; }
.admin-page h1, .page-intro h1 { font-size: 28px; font-weight: 800; letter-spacing: -.01em; color: var(--ink); margin: 0 0 4px; }
.admin-page h2 { font-size: 18px; font-weight: 700; margin: 0; }
.admin-page .admin-finance-head { margin: 32px 0 14px; gap: 16px; }
.admin-page > .admin-finance-head:first-child { margin: 0 0 20px; }
.intro-copy { font-size: 14px; color: var(--muted); line-height: 1.75; }
.card-manager-note { max-width: none; padding: 14px 16px; border-radius: 12px; background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; font-size: 14px; line-height: 1.75; }
#view-cards > h2 { margin: 28px 0 6px; }

/* ---------- Buttons ---------- */
.primary-btn { height: 44px; border-radius: 10px; border: 0; background: linear-gradient(180deg, #10a874, var(--brand)); font-size: 14px; font-weight: 700; box-shadow: 0 8px 18px -8px rgba(13, 150, 104, .7); }
.primary-btn:hover:not(:disabled) { background: linear-gradient(180deg, #0d9668, var(--brand-strong)); }
.secondary-btn, .ghost-btn { height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink-2); font-size: 13px; font-weight: 600; box-shadow: 0 1px 2px rgba(15, 23, 42, .05); transition: background .15s, border-color .15s; }
.secondary-btn:hover:not(:disabled), .ghost-btn:hover:not(:disabled) { background: var(--surface-2); border-color: #cbd5e1; }
.admin-credit-form > .secondary-btn, .plan-price-form .secondary-btn { background: var(--ink); border-color: var(--ink); color: #fff; }
.admin-credit-form > .secondary-btn:hover:not(:disabled), .plan-price-form .secondary-btn:hover:not(:disabled) { background: #1e293b; border-color: #1e293b; }
.danger-btn { height: 38px; border-radius: 10px; border-color: #fecaca; color: #b91c1c; font-size: 13px; font-weight: 600; }
.danger-btn:hover { background: #fef2f2; }
.action-status { font-size: 13px; color: var(--brand-strong); }
.action-status.error { color: var(--danger); }

/* ---------- Inputs ---------- */
.admin-credit-form input, .admin-credit-form select, .user-search input,
.credit-adjust-form input[type=number], .credit-adjust-form input[type=text],
.customer-edit-form input, .customer-edit-form select, .plan-price-form input,
.merchant-card-form input, .task-lookup input, .field-group input, .field-group select,
.field-group textarea, .admin-login input, .created-cdks {
  border: 1px solid var(--line); border-radius: 10px; background-color: #fff; color: var(--ink);
  font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.admin-credit-form input, .admin-credit-form select { height: 42px; padding: 0 12px; margin-top: 8px; }
.admin-credit-form select, .customer-edit-form select {
  appearance: none; padding-right: 34px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 12px center;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand) !important; box-shadow: 0 0 0 4px var(--brand-ring); }
input::placeholder, textarea::placeholder { color: var(--faint); }
.admin-credit-form label, .user-search label, .customer-edit-form label, .merchant-card-form label { font-size: 13px; font-weight: 600; color: var(--ink-2); }

/* ---------- Form cards ---------- */
.admin-credit-form { margin: 0; padding: 20px; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--card-shadow); }
.admin-credit-form label { min-width: 150px; }
.admin-credit-form > .secondary-btn { height: 42px; padding: 0 20px; }
.created-cdks { margin-top: 12px; height: 120px; padding: 14px; font: 13px/1.8 "JetBrains Mono", Consolas, monospace; background: #0b1220; color: #6ee7b7; border-color: #0b1220; }

/* ---------- Plan prices ---------- */
.plan-price-panel { margin: 24px 0 0; padding: 20px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--card-shadow); }
.plan-price-panel h2 { font-size: 18px; margin: 0 0 4px; }
.plan-price-panel > p { font-size: 13px; color: var(--muted); margin: 0 0 16px; }
#plan-price-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.plan-price-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; margin: 0; padding: 14px; border: 1px solid var(--line-2); background: var(--surface-2); border-radius: 12px; }
.plan-price-form strong { grid-column: 1 / -1; min-width: 0; font-size: 15px; }
.plan-price-form input { width: 100%; min-width: 0; height: 40px; padding: 0 12px; }
.plan-price-form .secondary-btn { height: 40px; }

/* ---------- Filters ---------- */
.cdk-filters { gap: 2px; margin: 0 0 14px; padding: 4px; background: #eef2f6; border-radius: 12px; }
.cdk-filter { padding: 8px 14px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); }
.cdk-filter.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .1); }
.cdk-filter span { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: rgba(100, 116, 139, .12); color: var(--muted); font-size: 12px; text-align: center; }
.cdk-filter.active span { background: var(--brand-soft); color: var(--brand-strong); }

/* ---------- Tables & cards ---------- */
.cdk-table-head, .queue-table-head, .merchant-card-head, .table-head {
  background: transparent; border: 0; color: var(--faint); font-size: 12px; font-weight: 600; padding-top: 0; padding-bottom: 8px;
}
.cdk-list, .user-list-pane, .user-detail-pane, .queue-list, .merchant-card-list, .panel, .guide-card, .queue-summary > div {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--card-shadow);
}
.cdk-row, .queue-row, .merchant-card-row, .task-row { padding: 14px 16px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--ink-2); transition: background .15s; }
.cdk-row:hover, .queue-row:hover, .merchant-card-row:hover { background: var(--surface-2); }
.cdk-identity strong { font: 13px/1.5 "JetBrains Mono", Consolas, monospace; color: var(--ink); }
.cdk-identity small, .customer-identity small, .history-row small, .customer-detail-head small { font-size: 12px; color: var(--faint); }
.cdk-amount { font-size: 13px; font-weight: 600; color: var(--ink); }
.cdk-redeemer { color: var(--muted); }
.cdk-actions .secondary-btn, .cdk-actions .danger-btn { height: 32px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.muted-action { font-size: 12px; color: var(--faint); }
.status-tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: #f1f5f9; color: var(--muted); font-size: 12px; font-weight: 600; }
.status-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-tag.success { background: #dcfce7; color: #15803d; }
.status-tag.failed { background: #fef2f2; color: #b91c1c; }
.list-empty { margin: 0; padding: 28px 16px; text-align: center; color: var(--faint); font-size: 14px; }
.list-pagination { font-size: 13px; color: var(--muted); }

/* ---------- Users ---------- */
.user-search { margin: 20px 0 14px; }
.user-search input {
  height: 40px; padding: 0 14px 0 36px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 3 3'/%3E%3C/svg%3E") no-repeat 12px center;
}
/* 表头与行都是 4 列（邮箱、积分、状态、订单），旧样式只定义了 3 列导致换行。 */
.customer-table-head, .customer-row { grid-template-columns: minmax(0, 2fr) 56px 64px minmax(80px, 1fr); }
.customer-table-head { background: var(--surface-2); border-bottom: 1px solid var(--line); padding: 12px 16px; color: var(--faint); font-size: 12px; font-weight: 600; }
.customer-row { padding: 12px 16px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--ink-2); transition: background .15s; }
.customer-table-head + .customer-list .customer-row:first-child { border-top: 0; }
.customer-row:hover { background: var(--surface-2); }
.customer-row.selected { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.customer-identity strong { font-size: 14px; color: var(--ink); }
.customer-row > span:last-child { font-size: 12px; color: var(--muted); }
.customer-status { display: inline-block; width: max-content; padding: 2px 8px; border-radius: 999px; background: #dcfce7; color: #15803d; font-size: 12px; font-weight: 600; }
.customer-status.disabled { background: #fef2f2; color: #b91c1c; }
.user-detail-pane { padding: 22px; min-height: 200px; }
.user-detail-pane > .list-empty, .user-detail-pane > .empty-state { display: grid; place-items: center; min-height: 156px; margin: 0; padding: 0; color: var(--faint); font-size: 14px; }
.user-detail-pane > p:not(.list-empty):not(.empty-state) { font-size: 13px; color: var(--muted); }
.customer-detail-head h2 { font-size: 18px; }
.customer-balance { font-size: 16px; color: var(--brand-strong); }
.customer-edit-form, .credit-adjust-form { padding: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.customer-edit-form input, .customer-edit-form select, .credit-adjust-form input[type=number], .credit-adjust-form input[type=text] { height: 38px; padding: 0 10px; font-size: 13px; }
.adjust-modes label { font-size: 13px; color: var(--ink-2); }
.customer-section { border-top: 1px solid var(--line-2); }
.customer-section h3 { font-size: 14px; }
.history-row { font-size: 13px; border-top: 1px solid var(--line-2); }
.history-row strong { font-size: 13px; }
.history-row > span { color: var(--brand-strong); }
.admin-list { gap: 8px; }
.admin-list > div { padding: 14px 16px; font-size: 13px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.admin-list button { height: 32px; border-radius: 8px; border-color: var(--line); color: var(--ink-2); font-size: 12px; font-weight: 600; }
.admin-list > .list-empty { background: #fff; border: 1px dashed var(--line); border-radius: 12px; }

/* ---------- Queue ---------- */
.queue-summary { gap: 14px; margin: 0 0 14px; }
.queue-summary > div { position: relative; overflow: hidden; padding: 18px 20px 18px 24px; }
.queue-summary > div::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: #10b981; }
.queue-summary > div:nth-child(2)::before { background: #6366f1; }
.queue-summary > div:nth-child(3)::before { background: #f59e0b; }
.queue-summary span { font-size: 13px; color: var(--muted); }
.queue-summary strong { font-size: 30px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.queue-row strong { color: var(--brand-strong); }

/* ---------- Merchant cards ---------- */
.merchant-card-identity strong { font-size: 14px; color: var(--ink); }
.merchant-card-identity small { font-size: 12px; color: var(--faint); }
.merchant-card-state { font-size: 13px; color: var(--muted); }

/* ---------- Toast & login ---------- */
.toast { padding: 12px 16px; border-radius: 12px; background: #0b1220; font-size: 14px; box-shadow: 0 20px 40px -12px rgba(15, 23, 42, .5); }
.admin-login {
  background:
    radial-gradient(600px 320px at 30% 20%, rgba(16, 185, 129, .16), transparent 70%),
    radial-gradient(500px 300px at 80% 80%, rgba(59, 130, 246, .12), transparent 70%), #f5f6f8;
}
.admin-login form { width: min(400px, 100%); padding: 32px; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 24px 60px -20px rgba(15, 23, 42, .28); }
.admin-login h1 { font-size: 24px; margin: 0 0 4px; }
.admin-login p { font-size: 14px; color: var(--muted); margin: 0; }
.admin-login label { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 18px 0 8px; }
.admin-login input { height: 46px; padding: 0 14px; }
.admin-login small { font-size: 13px; color: var(--danger); }
.admin-login a { font-size: 13px; color: var(--muted); }
.admin-login a:hover { color: var(--ink); }

/* ---------- Legacy tool views ---------- */
.panel-heading h2 { font-size: 16px; }
.panel-heading p { font-size: 13px; color: var(--muted); }
.step-number { border-radius: 10px; background: var(--ink); color: #fff; }
.field-group label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field-group input, .field-group select { height: 42px; padding: 0 12px; }
.field-group textarea { padding: 12px; }
.session-box { font-size: 13px !important; }
.guide-card > span { color: var(--brand); font-size: 12px; }
.guide-card h2 { font-size: 16px; }
.guide-card p, .safety-panel p { font-size: 13px; color: var(--muted); }
.task-lookup input { height: 40px; padding: 0 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 216px minmax(0, 1fr); }
  .content-wrap { padding: 28px 24px 56px; }
  .topbar { padding: 0 24px; }
}
@media (max-width: 800px) {
  .sidebar { padding: 14px 14px 10px; }
  .brand { padding: 0 2px 12px; }
  .nav-item { height: 36px; padding: 0 12px; border-radius: 999px; font-size: 13px; }
  .nav-item.active { box-shadow: none; }
  .topbar { height: 56px; padding: 0 16px; }
  .content-wrap { padding: 22px 16px 48px; }
  .admin-page h1 { font-size: 24px; }
  .queue-summary strong { font-size: 22px; }
}
@media (max-width: 650px) {
  .customer-table-head, .customer-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .customer-table-head span:last-child, .customer-row > span:last-child { display: none; }
}

/* ---------- Users page layout fixes ---------- */
@media (min-width: 801px) { .app-shell { background: linear-gradient(90deg, #0b1220 var(--sidebar-w, 248px), transparent 0); } }
@media (min-width: 801px) and (max-width: 1120px) { .app-shell { --sidebar-w: 216px; } }
.user-management-grid { grid-template-columns: minmax(360px, 1fr) minmax(0, 1.35fr); }
.customer-identity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 编辑表单子元素顺序：标签/邮箱、标签/密码、标签/状态、保存、提示、删除。 */
.customer-edit-form { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; }
.customer-edit-form > :nth-child(1) { grid-area: 1 / 1; }
.customer-edit-form > :nth-child(2) { grid-area: 2 / 1; }
.customer-edit-form > :nth-child(3) { grid-area: 1 / 2; }
.customer-edit-form > :nth-child(4) { grid-area: 2 / 2; }
.customer-edit-form > :nth-child(5) { grid-area: 1 / 3; }
.customer-edit-form > :nth-child(6) { grid-area: 2 / 3; }
.customer-edit-form > :nth-child(7) { grid-area: 3 / 1; justify-self: start; margin-top: 6px; }
.customer-edit-form > :nth-child(8) { grid-area: 4 / 1 / 5 / -1; }
.customer-edit-form > :nth-child(9) { grid-area: 3 / 3; justify-self: end; margin-top: 6px; }
.customer-edit-form input, .customer-edit-form select { width: 100%; }
.credit-adjust-form { grid-template-columns: auto minmax(90px, .6fr) minmax(0, 1.2fr) auto; }
@media (max-width: 1000px) { .user-management-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .customer-edit-form { grid-template-columns: 1fr; }
  .customer-edit-form > * { grid-area: auto !important; }
}
