/* shouquan authd 管理后台样式（无外部依赖） */
:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --sidebar: #0f172a;
  --sidebar-2: #16213b;
  --text: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #4f46e5;
  --accent-2: #6366f1;
  --ok: #059669;
  --ok-bg: #ecfdf5;
  --warn: #d97706;
  --warn-bg: #fffbeb;
  --bad: #dc2626;
  --bad-bg: #fef2f2;
  --grace: #7c3aed;
  --grace-bg: #f5f3ff;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }
.right { text-align: right; }
.block { width: 100%; }

/* ── 登录 ── */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(800px 400px at 10% 10%, #e0e7ff 0%, transparent 60%),
    radial-gradient(700px 400px at 90% 90%, #ede9fe 0%, transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 34px 30px 28px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, .12);
}
.login-logo {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff; font-weight: 800; letter-spacing: .5px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-sub { margin: 0 0 22px; font-size: 12px; }
.form-error { color: var(--bad); font-size: 12px; min-height: 18px; margin: 10px 0 0; }

/* ── 布局 ── */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: var(--sidebar);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 20px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 13px;
}
.brand-name { color: #fff; font-weight: 700; font-size: 15px; }
.brand-sub { color: #64748b; font-size: 11px; margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  appearance: none; border: 0; background: transparent; color: #cbd5e1;
  text-align: left; padding: 10px 12px; border-radius: 9px;
  font-size: 13.5px; cursor: pointer; display: flex; align-items: center; gap: 9px;
}
.nav-item:hover { background: var(--sidebar-2); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .55; }
.nav-item.active .nav-dot { opacity: 1; }
.sidebar-foot { margin-top: auto; padding: 12px 4px 0; border-top: 1px solid #1e293b; }
.side-user { color: #94a3b8; font-size: 12px; padding: 6px 8px 10px; word-break: break-all; }
.sidebar-foot .btn { color: #cbd5e1; border-color: #334155; }
.sidebar-foot .btn:hover { background: #1e293b; color: #fff; border-color: #475569; }
.main { flex: 1; min-width: 0; padding: 22px 26px 60px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: -.2px; }
.topbar p { margin: 4px 0 0; font-size: 12.5px; }
.top-actions { display: flex; align-items: center; gap: 12px; }

/* ── 通用控件 ── */
.btn {
  appearance: none; border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 9px; padding: 8px 14px; font-size: 13px; cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn.small { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn.block { width: 100%; }
.link-btn { appearance: none; border: 0; background: transparent; color: var(--accent); cursor: pointer; font-size: 12px; padding: 0; }
.icon-btn {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  font-size: 22px; line-height: 1; width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
}
.icon-btn:hover { background: #f1f5f9; color: var(--text); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; color: #475569; font-weight: 500; }
.input {
  width: 100%; border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 11px; font-size: 13.5px; color: var(--text); background: #fff;
  outline: none; font-family: inherit;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
textarea.input { resize: vertical; line-height: 1.45; word-break: break-all; }
.select { cursor: pointer; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .input { width: 260px; }
.toolbar .select { width: 150px; }
.toolbar-spacer { flex: 1; }

/* ── 卡片 / 统计 ── */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { margin: 0; font-size: 15px; }
.card-actions { display: flex; gap: 10px; margin-top: 6px; }
.stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat-card::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: #cbd5e1; }
.stat-card.ok::after { background: var(--ok); }
.stat-card.warn::after { background: var(--warn); }
.stat-card.grace::after { background: var(--grace); }
.stat-card.bad::after { background: var(--bad); }
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 700; margin: 6px 0 2px; letter-spacing: -.5px; }
.stat-sub { font-size: 11.5px; color: #94a3b8; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; }
.settings-col { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

/* ── 表格 ── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .3px; padding: 11px 14px;
  border-bottom: 1px solid var(--line); background: #fafbfe; white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table tbody tr:hover { background: #fafbff; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.empty { padding: 36px 16px; text-align: center; color: #94a3b8; font-size: 13px; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line); }
.pager-btns { display: flex; align-items: center; gap: 10px; }

/* ── 徽章 / 标签 ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: #f1f5f9; color: #475569; white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.state-active { background: var(--ok-bg); color: var(--ok); }
.badge.state-expiring { background: var(--warn-bg); color: var(--warn); }
.badge.state-grace { background: var(--grace-bg); color: var(--grace); }
.badge.state-expired { background: var(--bad-bg); color: var(--bad); }
.badge.state-disabled { background: #f1f5f9; color: #64748b; }
.chip {
  display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: 11.5px;
  background: #eef2ff; color: #4338ca; margin: 2px 4px 2px 0; white-space: nowrap;
}
.chip.muted { background: #f1f5f9; color: #64748b; }
.chip.off { background: #f8fafc; color: #94a3b8; text-decoration: line-through; }
.mono-cell { font-size: 12.5px; }
.subline { color: var(--muted); font-size: 11.5px; margin-top: 3px; }

/* ── 概览 ── */
.audit-list { display: flex; flex-direction: column; }
.audit-row { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px dashed #eef2f7; font-size: 12.5px; }
.audit-row:last-child { border-bottom: 0; }
.audit-time { color: #94a3b8; white-space: nowrap; font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; }
.audit-desc { color: #334155; word-break: break-word; }
.resource-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.resource { background: #f8fafc; border: 1px solid #eef2f7; border-radius: 10px; padding: 14px 16px; }
.resource-value { font-size: 22px; font-weight: 700; }
.resource-label { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* ── 抽屉 ── */
.drawer { position: fixed; inset: 0; z-index: 40; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); }
.drawer-panel {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(620px, 94vw);
  background: #fff; box-shadow: -20px 0 60px rgba(15, 23, 42, .18);
  display: flex; flex-direction: column;
  animation: slideIn .18s ease-out;
}
@keyframes slideIn { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 17px; }
.drawer-head p { margin: 4px 0 0; font-size: 12px; }
.drawer-body { padding: 18px 20px 40px; overflow-y: auto; }
.drawer-section { margin-bottom: 22px; }
.drawer-section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 0 0 10px; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.detail-item { min-width: 0; }
.detail-label { font-size: 11.5px; color: var(--muted); }
.detail-value { font-size: 13.5px; margin-top: 2px; word-break: break-word; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mini-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 11px; padding: 7px 8px; border-bottom: 1px solid var(--line); }
.mini-table td { padding: 8px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.mini-table tr:last-child td { border-bottom: 0; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px; padding: 7px 0; font-size: 12.5px; }
.kv-key { color: var(--muted); }
.kv-val { word-break: break-all; }
.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.hint { margin: 10px 0 0; }

/* ── 弹窗 ── */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .5); }
.modal-card {
  position: relative; background: #fff; border-radius: 16px; width: min(560px, 96vw);
  max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(15, 23, 42, .25);
  animation: pop .16s ease-out;
}
@keyframes pop { from { transform: scale(.97); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .field.full { grid-column: 1 / -1; }
.checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.check-row { display: flex; align-items: flex-start; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.check-row:hover { background: #fafbff; }
.check-row input { margin-top: 2px; }
.check-row .check-name { font-size: 13px; }
.check-row .check-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }
.key-reveal {
  background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 12px 14px;
  font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-all; margin-bottom: 12px;
}
.notice { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 9px; padding: 10px 12px; font-size: 12.5px; line-height: 1.55; }
.notice.danger { background: var(--bad-bg); border-color: #fecaca; color: #991b1b; }
.notice.ok { background: var(--ok-bg); border-color: #a7f3d0; color: #065f46; }

/* ── Toast ── */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 13px; z-index: 90; box-shadow: 0 12px 40px rgba(15, 23, 42, .3);
  max-width: 90vw; text-align: center;
}
.toast.ok { background: #065f46; }
.toast.err { background: #991b1b; }

@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .two-col, .settings-col { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { width: 64px; flex-basis: 64px; padding: 14px 8px; }
  .brand > div:last-child, .nav-item span:last-child, .side-user, .sidebar-foot .btn { display: none; }
  .brand { justify-content: center; padding: 4px 0 16px; }
  .nav-item { justify-content: center; padding: 11px 0; }
  .main { padding: 16px 14px 40px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .resource-row { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .toolbar .input, .toolbar .select { width: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
  .top-actions .mono { display: none; }
}

/* 用户店铺数据页 */
.data-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.data-side { padding: 14px; }
.data-side .input { width: 100%; margin-bottom: 10px; }
.data-user-list { max-height: 620px; overflow: auto; }
.data-user-item {
  padding: 10px; border-radius: 9px; cursor: pointer;
  border: 1px solid transparent; margin-bottom: 4px;
}
.data-user-item:hover { background: #fafbff; border-color: var(--line); }
.data-user-item.active { background: #eef2ff; border-color: #c7d2fe; }
.data-user-name { font-weight: 600; font-size: 13px; }
.data-user-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.data-main { min-width: 0; }
.data-main .toolbar { gap: 8px; flex-wrap: wrap; }
.data-tabs { display: flex; gap: 6px; }
.data-tab.active { color: var(--primary); border-color: #c7d2fe; background: #eef2ff; }
.data-main .table td { vertical-align: top; }
@media (max-width: 900px) {
  .data-layout { grid-template-columns: 1fr; }
  .data-user-list { max-height: 220px; }
}
