/* 微云图床 · 共用样式（浅色主题） */
:root {
  --bg: #f4f7fc;
  --bg-soft: #eef3fb;
  --surface: #ffffff;
  --surface-2: #f8faff;
  --text: #172033;
  --text-mid: #46536b;
  --muted: #7a869c;
  --border: #e2e8f3;
  --border-strong: #cdd7e8;
  --primary: #2f6bff;
  --primary-dark: #1f52d6;
  --primary-soft: #eaf0ff;
  --success: #12a150;
  --success-soft: #e8f8ef;
  --danger: #e04b55;
  --danger-soft: #fdeced;
  --warning: #c47b0b;
  --warning-soft: #fff5e2;
  --shadow-sm: 0 1px 2px rgba(23, 32, 51, .05), 0 4px 14px rgba(23, 32, 51, .04);
  --shadow-md: 0 8px 30px rgba(31, 61, 130, .10);
  --radius: 14px;
  --radius-sm: 9px;
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100dvh; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(1000px 480px at 12% -8%, #dce9ff 0%, rgba(220, 233, 255, 0) 70%),
    radial-gradient(900px 420px at 92% 4%, #e7e2ff 0%, rgba(231, 226, 255, 0) 72%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid rgba(47, 107, 255, .38);
  outline-offset: 2px;
}

.hidden { display: none !important; }

/* ---------------- 通用组件 ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background .16s ease, transform .16s ease, box-shadow .16s ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--primary-dark); box-shadow: 0 4px 14px rgba(47, 107, 255, .24); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: var(--surface); color: var(--text-mid); border-color: var(--border-strong); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); box-shadow: none; }
.btn-soft { background: var(--primary-soft); color: var(--primary-dark); }
.btn-soft:hover:not(:disabled) { background: #dce6ff; box-shadow: none; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #fbdcde; box-shadow: none; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; font-weight: 600; }
.btn-block { width: 100%; }

.input, .select, .textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .13);
}
.textarea { resize: vertical; min-height: 78px; }

.field { display: block; margin-bottom: 16px; }
.field > label, .field-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-mid);
}
.field-hint { margin-top: 5px; font-size: 12px; color: var(--muted); line-height: 1.5; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .2px;
}
.badge-blue { background: var(--primary-soft); color: var(--primary-dark); }
.badge-green { background: var(--success-soft); color: var(--success); }
.badge-gray { background: var(--bg-soft); color: var(--muted); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-amber { background: var(--warning-soft); color: var(--warning); }

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid transparent;
  white-space: pre-wrap;
  word-break: break-word;
}
.alert-info { background: var(--primary-soft); border-color: #d3e0ff; color: #26459b; }
.alert-ok { background: var(--success-soft); border-color: #cceedd; color: #0f7a3d; }
.alert-error { background: var(--danger-soft); border-color: #f7d3d6; color: #b3303a; }
.alert-warn { background: var(--warning-soft); border-color: #f6e0b6; color: #96600a; }

.toast-wrap {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: min(380px, calc(100vw - 36px));
}
.toast {
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  background: #1d2940;
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow-md);
  animation: toast-in .22s ease both;
}
.toast.error { background: #b8333d; }
.toast.ok { background: #0f8043; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------- 上传页 ---------------- */
.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 26px 20px 60px;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  width: 38px; height: 38px; flex: none;
  border-radius: 11px;
  background: linear-gradient(145deg, #4a83ff, #2550d8);
  box-shadow: 0 5px 14px rgba(47, 107, 255, .28);
  display: grid; place-items: center;
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-text { min-width: 0; }
.brand-title { font-size: 17px; font-weight: 800; letter-spacing: .2px; }
.brand-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-links { display: flex; align-items: center; gap: 10px; flex: none; }

.hero { text-align: center; margin: 6px 0 26px; }
.hero h1 { margin: 0 0 8px; font-size: clamp(24px, 4vw, 33px); letter-spacing: -.6px; }
.hero p { margin: 0; color: var(--muted); font-size: 14px; }

.dropzone {
  position: relative;
  padding: 34px 22px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.dropzone:hover { border-color: var(--primary); background: var(--surface-2); }
.dropzone.is-dragover { border-color: var(--primary); background: var(--primary-soft); transform: scale(1.005); }
.dropzone-icon {
  width: 56px; height: 56px; margin: 0 auto 12px;
  border-radius: 16px; background: var(--primary-soft);
  display: grid; place-items: center;
}
.dropzone-icon svg { width: 28px; height: 28px; }
.dropzone-title { font-size: 16px; font-weight: 700; }
.dropzone-sub { margin-top: 5px; color: var(--muted); font-size: 12.5px; }
.dropzone-actions { margin-top: 16px; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

.upload-options {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding: 14px 16px;
}
.upload-options .field { margin: 0; flex: 1 1 240px; }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 30px 0 12px;
}
.section-head h2 { margin: 0; font-size: 15px; font-weight: 800; }
.section-head .muted { color: var(--muted); font-size: 12.5px; }

.queue { display: flex; flex-direction: column; gap: 10px; }
.queue-item { display: flex; gap: 13px; padding: 12px; align-items: center; }
.thumb {
  width: 52px; height: 52px; flex: none;
  border-radius: 9px; background: var(--bg-soft);
  border: 1px solid var(--border);
  object-fit: cover;
  display: grid; place-items: center;
  overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb svg { width: 24px; height: 24px; }
.queue-main { flex: 1; min-width: 0; }
.queue-name { font-weight: 650; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.progress-track { height: 6px; border-radius: 99px; background: var(--bg-soft); margin-top: 8px; overflow: hidden; }
.progress-bar { height: 100%; width: 0%; border-radius: 99px; background: linear-gradient(90deg, #4a83ff, #2550d8); transition: width .2s ease; }
.progress-bar.error { background: var(--danger); }
.progress-bar.done { background: var(--success); }

.result-item { padding: 15px; }
.result-top { display: flex; gap: 13px; align-items: flex-start; }
.result-body { flex: 1; min-width: 0; }
.format-tabs { display: flex; gap: 5px; flex-wrap: wrap; margin: 11px 0 8px; }
.format-tab {
  padding: 5px 11px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-mid);
  font-size: 12px; font-weight: 650; cursor: pointer;
}
.format-tab.active { background: var(--primary-soft); border-color: #c7d8ff; color: var(--primary-dark); }
.copy-row { display: flex; gap: 8px; }
.copy-row .input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }

.empty { padding: 34px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.footer-note { margin-top: 34px; text-align: center; color: var(--muted); font-size: 12px; }

/* ---------------- 管理后台 ---------------- */
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(420px, 100%); padding: 28px; }
.auth-card h1 { margin: 0 0 4px; font-size: 21px; }
.auth-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }

.admin-shell { display: flex; min-height: 100dvh; }
.sidebar {
  width: 224px; flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 20px 14px;
}
.sidebar .brand { padding: 0 8px 20px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-mid); font-weight: 600; font-size: 13.5px;
  cursor: pointer; border: none; background: transparent; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-dark); }
.nav-item svg { width: 17px; height: 17px; flex: none; }
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }

.admin-main { flex: 1; min-width: 0; }
.admin-header {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 28px; background: rgba(255,255,255,.82);
  border-bottom: 1px solid var(--border); backdrop-filter: blur(8px);
}
.admin-header h2 { margin: 0; font-size: 16px; }
.admin-content { padding: 26px 28px 60px; max-width: 1080px; }
.panel { padding: 20px; margin-bottom: 18px; }
.panel h3 { margin: 0 0 4px; font-size: 15px; }
.panel > .panel-desc { margin: 0 0 18px; color: var(--muted); font-size: 12.5px; }
.panel-foot { margin-top: 16px; display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { padding: 16px 18px; }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.stat-value { margin-top: 6px; font-size: 25px; font-weight: 800; letter-spacing: -.5px; }
.stat-extra { margin-top: 3px; font-size: 11.5px; color: var(--muted); }

.kv-list { display: grid; gap: 9px; }
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv span:first-child { color: var(--muted); }

.check-list { display: flex; flex-wrap: wrap; gap: 8px; }
.check-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 11px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font-size: 12.5px; cursor: pointer;
  background: var(--surface);
}
.check-chip:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.check-chip input { margin: 0; }

.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mode-card {
  position: relative; padding: 15px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); cursor: pointer; background: var(--surface);
}
.mode-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px rgba(47,107,255,.10); }
.mode-card strong { display: block; font-size: 13.5px; margin-bottom: 3px; }
.mode-card small { color: var(--muted); line-height: 1.5; display: block; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td img { width: 42px; height: 42px; object-fit: cover; border-radius: 7px; border: 1px solid var(--border); display: block; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.cell-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.toolbar { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .input { width: auto; flex: 1 1 220px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 14px; font-size: 12.5px; color: var(--muted); }

.guide { font-size: 13px; line-height: 1.8; color: var(--text-mid); }
.guide ol { padding-left: 20px; margin: 8px 0; }
.guide li { margin-bottom: 7px; }
.guide code {
  background: var(--bg-soft); padding: 2px 6px; border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px;
  word-break: break-all;
}

@media (max-width: 860px) {
  .admin-shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; gap: 8px; overflow-x: auto; padding: 10px 12px; border-right: none; border-bottom: 1px solid var(--border); }
  .sidebar .brand { padding: 0 10px 0 4px; }
  .sidebar .brand-sub { display: none; }
  .nav { flex-direction: row; }
  .nav-item { white-space: nowrap; width: auto; padding: 8px 11px; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; border: none; }
  .admin-header { padding: 13px 16px; }
  .admin-content { padding: 18px 16px 48px; }
  .grid-2, .mode-grid { grid-template-columns: 1fr; }
  .page { padding: 18px 14px 48px; }
  .brand-sub { display: none; }
}

/* ==================== 用户体系 ==================== */

.user-nav-slot { display: inline-flex; align-items: center; gap: 8px; }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  text-decoration: none; color: var(--text-mid); font-size: 13px; font-weight: 600;
  transition: border-color .15s ease;
}
.user-chip:hover { border-color: var(--border-strong); }
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex: none;
  border: 1px solid var(--border);
}
.user-avatar-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary-dark);
  font-size: 12px; font-weight: 700;
}
.user-chip .user-avatar-fallback { width: 26px; height: 26px; }

.auth-links { display: flex; justify-content: space-between; margin-top: 16px; font-size: 13px; }
.auth-links a { color: var(--primary); text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }
.link-btn {
  background: none; border: none; color: var(--primary); font-size: 13px;
  cursor: pointer; padding: 0; font-weight: 600;
}
.link-btn:hover { text-decoration: underline; }

/* 用户中心 */
.me-profile { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.me-avatar-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.me-avatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }
.me-avatar.me-avatar-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary-dark); font-size: 32px; font-weight: 700;
}
.me-info { flex: 1; min-width: 180px; }
.me-info .muted { font-size: 13px; margin-top: 2px; }
.me-quota { flex: 1.2; min-width: 240px; }
.me-quota .kv {
  display: flex; justify-content: space-between; font-size: 13px;
  color: var(--text-mid); font-weight: 600;
}
.me-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* 我的图片画廊 */
.gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.gallery-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius, 12px); overflow: hidden;
  display: flex; flex-direction: column;
}
.gallery-thumb {
  display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--bg-soft);
}
.gallery-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .18s ease;
}
.gallery-item:hover .gallery-thumb img { transform: scale(1.04); }
.gallery-meta { padding: 10px 12px 4px; min-width: 0; }
.gallery-meta .cell-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gallery-sub { font-size: 12px; margin-top: 2px; }
.gallery-actions { display: flex; gap: 8px; padding: 8px 12px 12px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; }
.pager .muted { font-size: 13px; }

/* 图片详情页 */
.detail-page { max-width: 860px; }
.detail-card { padding: 24px; }
.detail-imglink { display: block; text-align: center; margin-bottom: 18px; }
.detail-img {
  max-width: 100%; max-height: 56vh; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-soft);
}
.detail-name { margin: 0 0 4px; font-size: 17px; word-break: break-all; }
.detail-copy { margin: 16px 0 12px; }
.uploader-chip {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 14px; padding: 8px 14px 8px 8px;
  background: var(--bg-soft); border-radius: 999px;
}
.uploader-chip .user-avatar { width: 32px; height: 32px; }
.uploader-chip .user-avatar-fallback { width: 32px; height: 32px; }
.uploader-name { font-size: 13.5px; font-weight: 700; color: var(--text); }

@media (max-width: 640px) {
  .me-profile { flex-direction: column; }
  .me-grid { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* 分组 / 多存储空间（后台） */
.select-sm { padding: 5px 8px; font-size: 13px; width: auto; max-width: 160px; }
.form-inline-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.subhead { margin: 20px 0 10px; font-size: 14px; color: var(--text); }
