/* MP Tool 设计系统 — 松绿色种子 / 产品向（Register: product）
   桌面侧边栏 + 移动 Tabbar；白底、单一主色、克制语义色。 */

:root {
  --bg: #ffffff;
  --surface: oklch(0.985 0.004 130);
  --panel: oklch(0.970 0.008 130);
  --ink: oklch(0.24 0.014 130);
  --muted: oklch(0.47 0.018 130);
  --faint: oklch(0.55 0.016 130);
  --border: oklch(0.905 0.008 130);
  --border-strong: oklch(0.86 0.012 130);

  --primary: oklch(0.52 0.105 128);
  --primary-hover: oklch(0.46 0.105 128);
  --primary-soft: oklch(0.955 0.026 130);
  --primary-soft-hover: oklch(0.93 0.035 130);
  --on-primary: #ffffff;

  --danger: oklch(0.55 0.185 27);
  --danger-soft: oklch(0.962 0.02 27);
  --warn: oklch(0.60 0.125 70);
  --warn-soft: oklch(0.962 0.035 80);
  --gold: oklch(0.68 0.115 82);
  --gold-soft: oklch(0.965 0.045 90);

  --radius: 12px;
  --radius-s: 8px;
  --shadow: 0 1px 2px oklch(0.2 0.02 130 / 0.04), 0 4px 14px oklch(0.2 0.02 130 / 0.05);
  --z-modal: 50; --z-toast: 60; --z-tabbar: 40;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, "JetBrains Mono", monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.6;
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3 { margin: 0; line-height: 1.35; text-wrap: balance; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }
img { display: block; }

/* ---------- Shell：桌面侧边栏 / 移动端顶栏+Tabbar ---------- */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 232px; z-index: 30;
  background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--primary);
  color: var(--on-primary); display: grid; place-items: center; flex: none;
}
.brand-name { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.brand-sub { font-size: 12px; color: var(--muted); margin-top: -2px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: var(--radius-s); color: var(--muted); font-weight: 500;
  transition: background .18s ease, color .18s ease; cursor: pointer;
}
.nav a:hover { background: oklch(0.94 0.012 130); color: var(--ink); }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav a svg { flex: none; }
.side-foot { margin-top: auto; padding: 10px; border-top: 1px solid var(--border); }

.main { margin-left: 232px; padding: 28px 32px 48px; max-width: 1180px; }
.topbar { display: none; }

.tabbar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-tabbar);
  background: oklch(1 0 0 / 0.92); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-inner { display: grid; grid-template-columns: 1fr 72px 1fr; align-items: end; height: 56px; }
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0;
  color: var(--faint); font-size: 11px; cursor: pointer; transition: color .18s ease;
}
.tab.active { color: var(--primary); }
.tab-add {
  width: 46px; height: 46px; margin: -16px auto 0; border-radius: 50%;
  background: var(--primary); color: var(--on-primary); display: grid; place-items: center;
  box-shadow: 0 4px 12px oklch(0.52 0.105 128 / 0.35); cursor: pointer;
  transition: background .18s ease, transform .18s ease; border: none;
}
.tab-add:active { transform: scale(0.94); }

@media (max-width: 1023px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 16px 16px 96px; max-width: 100%; }
  .topbar {
    display: flex; align-items: center; gap: 10px; padding: 10px 16px;
    position: sticky; top: 0; z-index: 20; background: oklch(1 0 0 / 0.92);
    backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
  }
  .topbar .brand-name { font-size: 15px; }
  .tabbar { display: block; }
}
@media (min-width: 1024px) { .tabbar { display: none; } }

/* ---------- 通用元件 ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 20px; font-weight: 650; letter-spacing: -0.015em; }
.page-desc { color: var(--muted); font-size: 13px; margin-top: 3px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 15px; border-radius: var(--radius-s);
  border: 1px solid var(--border-strong); background: var(--bg); color: var(--ink);
  font-size: 13.5px; font-weight: 550; cursor: pointer; user-select: none;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--surface); border-color: var(--faint); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.btn.soft:hover { background: var(--primary-soft-hover); }
.btn.danger-soft { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn.block { width: 100%; }
.icon-btn {
  width: 32px; height: 32px; border-radius: var(--radius-s); border: none; background: transparent;
  color: var(--muted); display: inline-grid; place-items: center; cursor: pointer;
  transition: background .18s ease, color .18s ease;
}
.icon-btn:hover { background: var(--panel); color: var(--ink); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 550; color: var(--ink); }
.input, .select {
  height: 38px; padding: 0 12px; border-radius: var(--radius-s); border: 1px solid var(--border-strong);
  background: var(--bg); color: var(--ink); font-size: 14px; font-family: inherit; width: 100%;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.input::placeholder { color: var(--faint); }
.input:focus, .select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea.input { height: auto; padding: 10px 12px; min-height: 72px; }

.card {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
}
.card.pad { padding: 20px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  border-radius: 999px; font-size: 12px; font-weight: 550;
}
.chip.gray { background: var(--panel); color: var(--muted); }
.chip.green { background: var(--primary-soft); color: var(--primary); }
.chip.red { background: var(--danger-soft); color: var(--danger); }
.chip.gold { background: var(--gold-soft); color: oklch(0.5 0.11 75); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--faint);
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }

.mono { font-family: var(--mono); font-size: 12.5px; }

/* ---------- 骨架/空态 ---------- */
.skel {
  border-radius: var(--radius-s); background: linear-gradient(90deg, var(--panel) 25%, var(--surface) 45%, var(--panel) 65%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 56px 20px; color: var(--muted); text-align: center;
}
.empty svg { color: var(--border-strong); }
.empty .btn { margin-top: 6px; }

/* ---------- 弹窗 / 提示 ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: var(--z-modal); background: oklch(0.2 0.02 130 / 0.4);
  display: grid; place-items: center; padding: 20px; animation: fade .18s ease;
}
.modal {
  width: 100%; max-width: 420px; background: var(--bg); border-radius: 14px;
  box-shadow: var(--shadow); padding: 22px; animation: pop .2s cubic-bezier(0, 0, 0.2, 1);
  max-height: 86vh; overflow: auto;
}
.modal h3 { font-size: 16px; font-weight: 650; margin-bottom: 14px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

.toast-wrap { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  padding: 9px 16px; border-radius: 999px; font-size: 13px; font-weight: 550;
  background: oklch(0.25 0.014 130); color: #fff; box-shadow: var(--shadow);
  animation: pop .2s cubic-bezier(0, 0, 0.2, 1); max-width: 86vw;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--primary); }

/* ---------- 登录页 ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--surface); }
.auth-card { width: 100%; max-width: 400px; background: var(--bg); border: 1px solid var(--border); border-radius: 16px; padding: 30px 28px; box-shadow: var(--shadow); }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; text-align: center; }
.auth-brand .brand-mark { width: 44px; height: 44px; border-radius: 13px; }
.auth-brand h1 { font-size: 19px; font-weight: 680; letter-spacing: -0.02em; }
.auth-brand p { color: var(--muted); font-size: 13px; }
.seg { display: grid; grid-template-columns: 3fr 3fr 4fr; background: var(--panel); border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.seg button {
  height: 32px; border: none; background: transparent; border-radius: 7px; font-size: 13px;
  font-weight: 550; color: var(--muted); cursor: pointer; transition: all .18s ease;
}
.seg button.on { background: var(--bg); color: var(--ink); box-shadow: 0 1px 3px oklch(0.2 0.02 130 / 0.1); }
.auth-qr { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 6px 0 2px; }
.auth-qr img { width: 190px; height: 190px; border-radius: 10px; border: 1px solid var(--border); }
.qr-tip { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.qr-tip.ok { color: var(--primary); font-weight: 600; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- 账号卡片 ---------- */
.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.acc-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; transition: border-color .18s ease, box-shadow .18s ease; cursor: pointer; }
.acc-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.acc-top { display: flex; gap: 12px; align-items: center; }
.avatar { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: var(--panel); flex: none; }
.avatar.ph { display: grid; place-items: center; color: var(--on-primary); font-weight: 650; font-size: 20px; background: var(--primary); }
.acc-name { font-weight: 620; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-alias { color: var(--faint); font-size: 12.5px; margin-top: 1px; }
.acc-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat {
  flex: 1; min-width: 76px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 1px;
}
.stat b { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat span { font-size: 11.5px; color: var(--faint); }
.acc-foot { display: flex; align-items: center; gap: 8px; }

/* ---------- 资源列表 ---------- */
.res-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.type-seg { display: inline-flex; background: var(--panel); border-radius: 10px; padding: 3px; }
.type-seg button {
  height: 32px; padding: 0 16px; border: none; background: transparent; border-radius: 8px;
  font-size: 13px; font-weight: 550; color: var(--muted); cursor: pointer; transition: all .18s ease;
}
.type-seg button.on { background: var(--bg); color: var(--ink); box-shadow: 0 1px 3px oklch(0.2 0.02 130 / 0.1); }
.res-search { flex: 1; min-width: 180px; max-width: 340px; }
.res-list { display: flex; flex-direction: column; }
.res-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-bottom: 1px solid var(--border); transition: background .15s ease;
}
.res-row:hover { background: var(--surface); }
.res-row:last-child { border-bottom: none; }
.res-check { flex: none; width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }
.res-cover {
  width: 76px; height: 43px; border-radius: 8px; object-fit: cover; background: var(--panel); flex: none;
  display: grid; place-items: center; color: var(--border-strong); overflow: hidden;
}
.res-body { flex: 1; min-width: 0; }
.res-title { font-weight: 560; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-meta { display: flex; gap: 10px; color: var(--faint); font-size: 12px; margin-top: 2px; align-items: center; }
.res-vid { font-family: var(--mono); font-size: 11.5px; color: var(--faint); cursor: pointer; }
.res-vid:hover { color: var(--primary); }
.res-actions { display: flex; gap: 6px; flex: none; }
.res-foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; color: var(--muted); font-size: 13px; }
.pager { display: flex; gap: 8px; align-items: center; }
.batch-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 72px; z-index: 35;
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: oklch(0.25 0.014 130); color: #fff; border-radius: 12px; box-shadow: var(--shadow);
  animation: pop .2s ease; max-width: 94vw; flex-wrap: wrap;
}
.batch-bar .btn { border-color: transparent; background: oklch(1 0 0 / 0.14); color: #fff; }
.batch-bar .btn:hover { background: oklch(1 0 0 / 0.24); }
.batch-bar .cnt { font-size: 13px; font-weight: 600; padding: 0 4px; }
@media (min-width: 1024px) { .batch-bar { bottom: 24px; } }
@media (max-width: 640px) {
  .res-actions { flex-direction: column; }
  .res-row { flex-wrap: wrap; }
  .res-cover { width: 100%; height: 120px; }
}

/* ---------- 设置/表单面板 ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
.form-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }

.vip-banner {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius);
  background: var(--gold-soft); border: 1px solid oklch(0.9 0.05 90); color: oklch(0.42 0.09 70);
  font-size: 13px; margin-bottom: 16px;
}

/* ---------- 无障碍与动效 ---------- */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
.fade-enter-active, .fade-leave-active { transition: opacity .18s ease; }
.fade-enter-from, .fade-leave-to { opacity: 0; }
