/* 南时悠图链基地 · 设计系统
   清爽自然 · 高可读性 · 轻量加载（无任何第三方依赖） */

:root {
  --bg: #f5f7f9;
  --surface: #ffffff;
  --ink: #1d2430;
  --ink-2: #46525f;
  --muted: #6b7684;
  --line: #e4e9ef;
  --line-strong: #d5dce4;
  --accent: #0071e3;
  --accent-hover: #0062c4;
  --accent-weak: #eaf3fe;
  --success: #2fae5e;
  --success-weak: #e8f6ee;
  --danger: #e5484d;
  --danger-weak: #fdecec;
  --warn: #e08a00;
  --warn-weak: #fdf1dc;

  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 8px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-2: 0 12px 32px rgba(16, 24, 40, .08);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC",
          "Segoe UI", "Microsoft YaHei", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

img { display: block; max-width: 100%; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ============ 顶栏 ============ */
#topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, .06);
}
.topbar-inner {
  display: flex; align-items: center; gap: 8px;
  height: 54px;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 16px; font-weight: 700; letter-spacing: .01em;
  color: var(--ink); margin-right: 18px;
}
.brand:hover { text-decoration: none; }
.brand svg { width: 26px; height: 26px; }
.brand .brand-sub {
  font-size: 12.5px; font-weight: 500; color: var(--muted); letter-spacing: 0;
}
.nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav a {
  color: var(--ink-2); font-size: 14px; padding: 7px 13px;
  border-radius: 980px; transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(0, 0, 0, .05); text-decoration: none; }
.nav a.active { color: var(--accent); background: var(--accent-weak); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-weak); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px; border-radius: 980px;
  border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; font-size: 13px; color: var(--ink-2);
}
.user-chip:hover { border-color: var(--line-strong); }

/* ============ 通用组件 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 18px; border-radius: 980px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  border: none; cursor: pointer; white-space: nowrap;
  transition: background .15s, transform .1s, box-shadow .15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: #edf1f5; color: var(--ink); }
.btn-secondary:hover { background: #e3e9ef; }
.btn-danger { background: var(--danger-weak); color: var(--danger); }
.btn-danger:hover { background: #f9dcdc; }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-weak); }
.btn-sm { height: 32px; padding: 0 13px; font-size: 13px; }
.btn-block { width: 100%; }

.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--ink-2); margin-bottom: 7px;
}
.input {
  width: 100%; height: 42px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  font-size: 15px; font-family: inherit; color: var(--ink);
  background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 10px 14px; resize: vertical; min-height: 80px; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 113, 227, .15); }
.input::placeholder { color: #9aa4b0; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 10px; border-radius: 980px;
  font-size: 12px; font-weight: 600;
}
.chip-public { background: var(--accent-weak); color: var(--accent); }
.chip-private { background: var(--warn-weak); color: var(--warn); }
.chip-admin { background: #efeafd; color: #6c4fd8; }

.segmented {
  display: inline-flex; padding: 3px; gap: 3px;
  background: #edf1f5; border-radius: 980px;
}
.segmented button {
  height: 30px; padding: 0 15px; border: none; border-radius: 980px;
  background: transparent; color: var(--ink-2);
  font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: all .15s;
}
.segmented button.active {
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-1);
}

/* ============ 页面结构 ============ */
main { flex: 1; padding: 36px 0 64px; }
.page-head { margin-bottom: 26px; }
.page-head h1 { font-size: 28px; letter-spacing: -.02em; line-height: 1.25; }
.page-head p { color: var(--muted); margin-top: 6px; font-size: 15px; }

.hero {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap; margin-bottom: 30px;
}
.hero h1 { font-size: 34px; letter-spacing: -.025em; line-height: 1.2; }
.hero p { color: var(--muted); margin-top: 8px; font-size: 16px; }
.hero-actions { display: flex; gap: 10px; }

.section-title {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 26px 0 14px;
}
.section-title h2 { font-size: 19px; letter-spacing: -.01em; }
.section-title .count { color: var(--muted); font-size: 13px; }

/* ============ 图片卡片网格 ============ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 16px;
}
.img-card {
  background: var(--surface); border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow-1); cursor: pointer;
  transition: transform .18s, box-shadow .18s;
}
.img-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.img-card .thumb {
  aspect-ratio: 4 / 3; width: 100%; object-fit: cover;
  background: #edf1f5;
}
.img-card .meta { padding: 10px 12px 12px; }
.img-card .name {
  font-size: 13px; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.img-card .sub {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: 6px;
}
.img-card .time { font-size: 12px; color: var(--muted); }

.empty {
  text-align: center; padding: 64px 20px; color: var(--muted);
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1);
}
.empty .icon { font-size: 40px; margin-bottom: 10px; }
.empty p { margin-bottom: 16px; }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(23, 32, 42, .45);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; animation: fadeIn .18s ease;
}
.modal {
  background: var(--surface); border-radius: 18px;
  width: 100%; max-width: 860px; max-height: 88vh;
  overflow: auto; box-shadow: var(--shadow-2);
  animation: popIn .22s cubic-bezier(.2, .9, .3, 1.2);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 0;
}
.modal-head h3 { font-size: 17px; letter-spacing: -.01em; }
.modal-close {
  width: 30px; height: 30px; border-radius: 50%; border: none;
  background: #edf1f5; color: var(--muted); font-size: 15px;
  cursor: pointer; line-height: 1;
}
.modal-close:hover { background: #e3e9ef; }
.modal-body { padding: 18px 22px 22px; }

.detail { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(240px, .8fr); gap: 22px; }
.detail .preview {
  width: 100%; border-radius: var(--r-md); background: #edf1f5;
  max-height: 60vh; object-fit: contain;
}
.detail .info dt { font-size: 12px; color: var(--muted); margin-top: 12px; }
.detail .info dd { font-size: 14px; word-break: break-all; }
.link-box {
  display: flex; gap: 8px; margin-top: 6px;
}
.link-box input {
  flex: 1; height: 36px; padding: 0 12px; font-size: 13px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: #f7f9fb; color: var(--ink-2); font-family: inherit;
}
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.94) translateY(8px); } to { opacity: 1; transform: none; } }

/* ============ Toast ============ */
#toast-root {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  background: rgba(29, 36, 48, .92); color: #fff;
  padding: 10px 20px; border-radius: 980px; font-size: 14px;
  box-shadow: var(--shadow-2); animation: toastIn .25s ease;
  max-width: 80vw;
}
.toast.error { background: rgba(229, 72, 77, .95); }
.toast.success { background: rgba(47, 174, 94, .95); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ============ 认证卡片 ============ */
.auth-wrap {
  min-height: calc(100vh - 220px);
  display: flex; align-items: center; justify-content: center; padding: 30px 0;
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--surface); border-radius: 20px;
  box-shadow: var(--shadow-2); padding: 36px 34px;
}
.auth-card h1 { font-size: 23px; letter-spacing: -.02em; margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.auth-links {
  display: flex; justify-content: space-between;
  margin-top: 18px; font-size: 13px;
}
.form-tip {
  background: var(--accent-weak); color: var(--accent);
  border-radius: var(--r-sm); padding: 10px 13px; font-size: 13px;
  margin-bottom: 16px;
}

/* ============ 上传页 ============ */
.dropzone {
  border: 2px dashed var(--line-strong); border-radius: var(--r-lg);
  background: var(--surface); padding: 52px 24px; text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent); background: var(--accent-weak);
}
.dropzone .icon { font-size: 38px; margin-bottom: 10px; }
.dropzone h3 { font-size: 17px; margin-bottom: 4px; }
.dropzone p { color: var(--muted); font-size: 13px; }

.upload-settings {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  margin: 22px 0 14px;
}
.upload-settings .label { font-size: 13px; color: var(--muted); font-weight: 600; }

.queue { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.queue-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border-radius: var(--r-md);
  box-shadow: var(--shadow-1); padding: 12px 14px;
}
.queue-item .q-thumb {
  width: 52px; height: 52px; border-radius: var(--r-sm);
  object-fit: cover; background: #edf1f5; flex-shrink: 0;
}
.queue-item .q-info { flex: 1; min-width: 0; }
.queue-item .q-name {
  font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.queue-item .q-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.progress {
  height: 5px; border-radius: 980px; background: #edf1f5;
  overflow: hidden; margin-top: 7px;
}
.progress .bar {
  height: 100%; width: 0; border-radius: 980px;
  background: var(--accent); transition: width .2s;
}
.queue-item.done .bar { background: var(--success); }
.queue-item .q-status { font-size: 12px; font-weight: 600; color: var(--muted); flex-shrink: 0; }
.queue-item.done .q-status { color: var(--success); }
.queue-item.failed .q-status { color: var(--danger); }

.result-links {
  background: var(--surface); border-radius: var(--r-md);
  box-shadow: var(--shadow-1); padding: 16px 18px; margin-bottom: 14px;
}
.result-links h4 { font-size: 14px; margin-bottom: 10px; }

/* ============ 工具栏（我的/管理） ============ */
.toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.toolbar .search { position: relative; flex: 1; min-width: 200px; max-width: 320px; }
.toolbar .search .input { padding-left: 38px; height: 38px; }
.toolbar .search svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted);
}

/* ============ 管理后台 ============ */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px; margin-bottom: 26px;
}
.stat-card {
  background: var(--surface); border-radius: var(--r-md);
  box-shadow: var(--shadow-1); padding: 18px 20px;
}
.stat-card .num { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.stat-card .label { font-size: 13px; color: var(--muted); margin-top: 2px; }

.kv-list { display: grid; grid-template-columns: 170px 1fr; gap: 9px 18px; font-size: 14px; }
.kv-list dt { color: var(--muted); }
.kv-list dd { word-break: break-all; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
}

.tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.tabs button {
  padding: 10px 18px; border: none; background: transparent;
  font-size: 15px; font-weight: 600; color: var(--muted);
  font-family: inherit; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

.table-wrap {
  background: var(--surface); border-radius: var(--r-md);
  box-shadow: var(--shadow-1); overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; padding: 12px 14px; color: var(--muted);
  font-weight: 600; font-size: 12px; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }
td .t-thumb {
  width: 46px; height: 34px; border-radius: 6px; object-fit: cover;
  background: #edf1f5;
}
td .t-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-actions { display: flex; gap: 6px; }
.pager {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; margin-top: 18px; color: var(--muted); font-size: 13px;
}

/* ============ 页脚 ============ */
#footer {
  padding: 22px 0 30px; color: var(--muted);
  font-size: 12.5px; text-align: center;
}

/* ============ 响应式 ============ */
@media (max-width: 720px) {
  .container { padding: 0 16px; }
  .hero h1 { font-size: 27px; }
  .page-head h1 { font-size: 23px; }
  .detail { grid-template-columns: 1fr; }
  .nav { gap: 0; }
  .nav a { padding: 7px 9px; }
  .brand .brand-sub { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}
