/* ================= Cursor Subscription 后台设计系统 =================
   以 slate 为基调的「运营控制台」风格，桌面侧边栏 + 移动端抽屉。
   组件类前缀 a-；与 Tailwind CDN 工具类共存（本文件只管结构与组件）。 */

:root {
  --a-sbw: 248px;
  --a-ink: #0f172a;
  --a-ink-2: #334155;
  --a-mut: #64748b;
  --a-line: #e2e8f0;
  --a-bg: #f6f7f9;
  --a-accent: #2563eb;
  --a-radius: 16px;
  --a-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--a-bg);
  color: var(--a-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.mono { font-family: var(--a-mono); }

/* ---------------- 布局外壳 ---------------- */
.a-shell { min-height: 100vh; }

.a-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--a-sbw);
  background: #0b1220; color: #cbd5e1;
  display: flex; flex-direction: column;
  z-index: 60; transform: translateX(-100%);
  transition: transform .25s ease;
  box-shadow: 0 0 40px rgba(2, 6, 23, .25);
}
.a-sidebar.open { transform: translateX(0); }

.a-brand { display: flex; align-items: center; gap: 11px; padding: 20px 18px 14px; }
.a-brand__mark {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  background: #fff; color: #0b1220; font-weight: 900; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}
.a-brand__name { font-size: 14px; font-weight: 800; color: #fff; line-height: 1.15; }
.a-brand__sub { font-size: 11px; color: #64748b; margin-top: 1px; }

.a-nav { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.a-nav__link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; color: #cbd5e1;
  text-decoration: none; transition: background .15s, color .15s;
}
.a-nav__link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.a-nav__link.is-active { background: #fff; color: #0b1220; font-weight: 800; }
.a-nav__icon { width: 18px; height: 18px; flex: none; }

.a-sidebar__foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .08); display: flex; gap: 8px; }
.a-sidebar__foot a {
  flex: 1; text-align: center; padding: 8px 10px; border-radius: 9px;
  font-size: 12px; font-weight: 700; text-decoration: none; transition: .15s;
}
.a-foot-view { color: #cbd5e1; background: rgba(255, 255, 255, .07); }
.a-foot-view:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.a-foot-out { color: #fca5a5; background: rgba(239, 68, 68, .12); }
.a-foot-out:hover { background: rgba(239, 68, 68, .2); color: #fff; }

.a-overlay {
  position: fixed; inset: 0; background: rgba(2, 6, 23, .55);
  z-index: 55; opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s;
}
.a-overlay.open { opacity: 1; visibility: visible; }

.a-main { display: flex; flex-direction: column; min-height: 100vh; }

.a-topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  height: 56px; padding: 0 14px;
  background: rgba(255, 255, 255, .88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--a-line);
}
.a-hamburger {
  display: inline-flex; width: 38px; height: 38px; flex: none;
  align-items: center; justify-content: center; border-radius: 10px;
  border: 1px solid var(--a-line); background: #fff; color: var(--a-ink-2); cursor: pointer;
}
.a-hamburger:active { background: #f1f5f9; }
.a-topbar__title { font-size: 15px; font-weight: 800; color: var(--a-ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a-topbar__spacer { flex: 1; }
.a-topbar__link { font-size: 12.5px; font-weight: 600; color: var(--a-mut); text-decoration: none; white-space: nowrap; }
.a-topbar__link:hover { color: var(--a-ink); }

.a-content { width: 100%; max-width: 1180px; margin: 0 auto; padding: 16px 14px 56px; }

@media (min-width: 640px) { .a-content { padding: 22px 22px 64px; } }
@media (min-width: 1024px) {
  .a-sidebar { transform: none; box-shadow: none; }
  .a-overlay { display: none; }
  .a-main { margin-left: var(--a-sbw); }
  .a-hamburger { display: none; }
}

/* ---------------- 卡片 / 区块 ---------------- */
.a-card { background: #fff; border: 1px solid var(--a-line); border-radius: var(--a-radius); padding: 18px; }
@media (min-width: 640px) { .a-card { padding: 20px; } }
.a-card + .a-card, .a-stack > * + * { margin-top: 16px; }
.a-stack { display: block; }
.a-card__title { font-size: 14px; font-weight: 800; color: var(--a-ink); margin: 0; }
.a-card__desc { font-size: 12.5px; color: var(--a-mut); margin: 4px 0 0; line-height: 1.5; }
.a-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }

.a-page-desc { font-size: 12.5px; color: var(--a-mut); margin: 0 0 16px; line-height: 1.6; }

/* ---------------- 统计 ---------------- */
.a-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 720px) { .a-stats { grid-template-columns: repeat(4, 1fr); } }
.a-stat { background: #fff; border: 1px solid var(--a-line); border-radius: 14px; padding: 14px 16px; }
.a-stat__label { font-size: 12px; font-weight: 700; color: var(--a-mut); }
.a-stat__value { font-size: 23px; font-weight: 800; color: var(--a-ink); margin-top: 4px; line-height: 1.1; }
.a-stat__value small { font-size: 12px; font-weight: 700; color: #059669; }

/* ---------------- 表单 ---------------- */
.a-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .a-grid--2 { grid-template-columns: 1fr 1fr; } }
.a-grid__full { grid-column: 1 / -1; }
.a-field { min-width: 0; }
.a-label { display: block; font-size: 12px; font-weight: 700; color: var(--a-mut); margin-bottom: 5px; }
.a-input, .a-textarea {
  width: 100%; padding: 9px 12px; background: #f8fafc;
  border: 1px solid #cbd5e1; border-radius: 10px;
  font-size: 13.5px; color: var(--a-ink); transition: .15s; font-family: inherit;
}
.a-input:focus, .a-textarea:focus { outline: none; background: #fff; border-color: var(--a-ink); box-shadow: 0 0 0 3px rgba(15, 23, 42, .07); }
.a-textarea { resize: vertical; min-height: 86px; line-height: 1.55; }
.a-help { font-size: 11.5px; color: #94a3b8; margin-top: 5px; line-height: 1.5; }
.a-form-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* 开关 */
.a-switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.a-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.a-switch__track { width: 42px; height: 24px; border-radius: 999px; background: #cbd5e1; position: relative; flex: none; transition: background .2s; }
.a-switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(2, 6, 23, .3); }
.a-switch input:checked + .a-switch__track { background: #10b981; }
.a-switch input:checked + .a-switch__track::after { transform: translateX(18px); }
.a-switch input:focus-visible + .a-switch__track { box-shadow: 0 0 0 3px rgba(16, 185, 129, .3); }
.a-switch__label { font-size: 13px; font-weight: 700; color: var(--a-ink-2); }

/* ---------------- 按钮 ---------------- */
.a-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit; font-weight: 700; font-size: 13px; line-height: 1;
  padding: 9px 15px; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; transition: .15s; white-space: nowrap; text-decoration: none;
}
.a-btn:disabled { opacity: .5; cursor: not-allowed; }
.a-btn--primary { background: var(--a-ink); color: #fff; }
.a-btn--primary:hover:not(:disabled) { background: #1e293b; }
.a-btn--ghost { background: #fff; color: var(--a-ink-2); border-color: #cbd5e1; }
.a-btn--ghost:hover:not(:disabled) { background: #f8fafc; }
.a-btn--danger { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.a-btn--danger:hover:not(:disabled) { background: #fee2e2; }
.a-btn--success { background: #059669; color: #fff; }
.a-btn--success:hover:not(:disabled) { background: #047857; }
.a-btn--warn { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.a-btn--warn:hover:not(:disabled) { background: #fef3c7; }
.a-btn--sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.a-btn--block { width: 100%; }
.a-btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.a-link { color: var(--a-accent); font-weight: 700; text-decoration: none; }
.a-link:hover { text-decoration: underline; }
.a-iconbtn { background: none; border: 0; color: #94a3b8; cursor: pointer; padding: 2px; line-height: 1; }
.a-iconbtn:hover { color: var(--a-ink-2); }

/* ---------------- 徽标 / 标签 ---------------- */
.a-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.a-badge--ok { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.a-badge--err { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.a-badge--warn { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.a-badge--muted { background: #f1f5f9; color: #64748b; border-color: #e2e8f0; }
.a-badge--info { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.a-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 8px; background: #f8fafc; border: 1px solid var(--a-line); font-size: 11.5px; color: var(--a-ink-2); }

/* ---------------- 工具条 / 搜索 / 分页 ---------------- */
.a-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.a-search { display: flex; gap: 8px; align-items: center; flex: 1 1 240px; min-width: 0; }
.a-search .a-input { flex: 1 1 auto; min-width: 0; }
.a-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 18px; font-size: 13px; color: var(--a-mut); }

/* ---------------- Flash 提示 ---------------- */
.a-flash { padding: 12px 15px; border-radius: 12px; font-size: 13px; font-weight: 600; border: 1px solid; white-space: pre-wrap; word-break: break-word; }
.a-flash--ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.a-flash--err { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

/* ---------------- 表格（桌面） + 列表（移动） ---------------- */
.a-table-wrap { background: #fff; border: 1px solid var(--a-line); border-radius: var(--a-radius); overflow: hidden; }
.a-table-wrap--scroll { overflow-x: auto; }
.a-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.a-table thead th { text-align: left; font-size: 11px; font-weight: 700; color: var(--a-mut); padding: 12px 14px; border-bottom: 1px solid var(--a-line); white-space: nowrap; background: #fbfcfd; }
.a-table tbody td { padding: 11px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.a-table tbody tr:last-child td { border-bottom: 0; }
.a-table tbody tr:hover { background: #fbfcfd; }
.a-table .a-td-wrap { white-space: normal; word-break: break-all; }
.a-empty { padding: 42px 16px; text-align: center; color: #94a3b8; font-size: 13px; }

.a-list { display: flex; flex-direction: column; gap: 10px; }
.a-list__item { background: #fff; border: 1px solid var(--a-line); border-radius: 14px; padding: 13px 14px; }
.a-list__item--flag { border-left: 3px solid #10b981; }
.a-kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 3px 0; }
.a-kv__k { color: var(--a-mut); font-weight: 600; flex: none; }
.a-kv__v { color: var(--a-ink); text-align: right; word-break: break-all; min-width: 0; }
.a-list__foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #f1f5f9; }

/* 响应式显隐（md = 768） */
.show-desktop { display: none; }
@media (min-width: 768px) {
  .show-desktop { display: block; }
  .show-mobile { display: none !important; }
}

/* ---------------- Toast ---------------- */
.a-toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); background: var(--a-ink); color: #fff; font-size: 13px; font-weight: 700; padding: 9px 16px; border-radius: 10px; z-index: 100; box-shadow: 0 10px 30px rgba(2, 6, 23, .35); transition: opacity .2s; }
.a-toast--out { opacity: 0; }

/* ---------------- 模态 / 移动端全屏 Sheet ---------------- */
.a-modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; }
.a-modal[hidden] { display: none; }
.a-modal__overlay { position: absolute; inset: 0; background: rgba(2, 6, 23, .55); }
.a-modal__panel { position: relative; background: #fff; border-radius: 16px; width: 100%; max-width: 660px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 24px 70px rgba(2, 6, 23, .4); }
.a-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--a-line); }
.a-modal__title { font-size: 14px; font-weight: 800; color: var(--a-ink); }
.a-modal__body { padding: 18px; overflow-y: auto; }
.a-modal__close { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--a-line); background: #fff; color: var(--a-mut); font-size: 18px; line-height: 1; cursor: pointer; }
.a-modal__close:hover { background: #f1f5f9; color: var(--a-ink); }
@media (max-width: 640px) {
  .a-modal { padding: 0; align-items: stretch; }
  .a-modal__panel { max-width: none; width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
}

/* ---------------- 商品卡（闲鱼） ---------------- */
.a-thumb { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; border: 1px solid var(--a-line); flex: none; background: #f1f5f9; }
.a-prod { display: flex; gap: 12px; align-items: flex-start; }
.a-prod__body { flex: 1; min-width: 0; }
.a-prod__title { font-size: 13.5px; font-weight: 700; color: var(--a-ink); }
.a-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 3px; }
.a-price { font-size: 12px; font-weight: 800; color: #e11d48; }
.img-thumb { width: 78px; height: 78px; }
