:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #f1f3f6;
  --surface-blue: #eef4ff;
  --ink: #15171b;
  --muted: #747b86;
  --muted-strong: #525964;
  --line: #e5e8ed;
  --line-strong: #d8dde5;
  --accent: #1769e8;
  --accent-dark: #0f56ca;
  --accent-soft: #eaf2ff;
  --success: #188454;
  --danger: #c13d4d;
  --shadow-sm: 0 8px 22px rgba(26, 39, 62, .045);
  --shadow-md: 0 18px 48px rgba(26, 39, 62, .075);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { min-width: 320px; scroll-behavior: smooth; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 86% -12%, rgba(218, 231, 255, .62), transparent 29rem),
    var(--bg);
}

body::selection { color: var(--ink); background: #cfe0ff; }

button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; }
a { color: inherit; text-decoration: none; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }

button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, .upload-panel:focus-visible {
  outline: 3px solid rgba(23, 105, 232, .28);
  outline-offset: 3px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .16em;
  line-height: 1.2;
}

.live-indicator {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(23, 105, 232, .11);
}

.mini-label, .detail-label, .stat-label, .sidebar-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .02em;
}

/* Shared application navigation */
.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  width: min(calc(100% - 48px), 1240px);
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto;
  border-bottom: 1px solid rgba(229, 232, 237, .9);
  background: rgba(246, 247, 249, .84);
  backdrop-filter: blur(18px) saturate(130%);
}

.wordmark { display: inline-flex; align-items: center; gap: 10px; min-width: 0; font-size: 17px; font-weight: 730; letter-spacing: -.04em; }
.wordmark-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-symbol {
  position: relative;
  width: 29px;
  height: 29px;
  display: inline-block;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 9px;
  background: var(--ink);
  box-shadow: 0 4px 10px rgba(20, 23, 27, .13);
}
.brand-symbol span { position: absolute; display: block; border-radius: 999px; transform: rotate(-35deg); }
.brand-symbol span:first-child { width: 8px; height: 19px; top: 5px; left: 8px; background: #fff; }
.brand-symbol span:last-child { width: 8px; height: 13px; top: 8px; left: 15px; background: var(--accent); }
.topbar-nav { display: flex; align-items: center; gap: 5px; margin-left: auto; }
.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  color: var(--muted);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  transition: color .2s ease, background .2s ease;
}
.nav-item svg { width: 15px; height: 15px; stroke-width: 1.8; }
.nav-item:hover { color: var(--ink); background: rgba(255, 255, 255, .8); }
.nav-item.is-active { color: var(--ink); background: var(--surface); box-shadow: 0 1px 4px rgba(20, 23, 27, .045); }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.account-menu { display: flex; align-items: center; gap: 8px; min-width: 0; }
.account-avatar {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .02em;
}
.account-label { max-width: 180px; overflow: hidden; color: var(--muted-strong); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.icon-button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: color .2s ease, background .2s ease, border-color .2s ease;
}
.icon-button svg { width: 17px; height: 17px; }
.icon-button:hover { color: var(--ink); background: var(--surface); border-color: var(--line); }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 600; transition: color .2s ease; }
.back-link svg { width: 15px; height: 15px; }
.back-link:hover { color: var(--ink); }

/* Login */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #111318;
}
.auth-layout {
  width: min(100%, 1180px);
  min-height: min(760px, calc(100vh - 48px));
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 26px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .26);
}
.auth-story {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  overflow: hidden;
  padding: 44px 50px 34px;
  color: #fff;
  background:
    radial-gradient(circle at 72% 32%, rgba(69, 117, 255, .4), transparent 19rem),
    linear-gradient(145deg, #15181f 0%, #0b0d11 75%);
}
.auth-story::before { position: absolute; inset: 0; opacity: .25; background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 42px 42px; content: ""; mask-image: linear-gradient(to bottom, black, transparent 78%); }
.auth-story > * { position: relative; z-index: 1; }
.wordmark-light { color: #fff; }
.wordmark-light .brand-symbol { background: #fff; box-shadow: none; }
.wordmark-light .brand-symbol span:first-child { background: #111318; }
.wordmark-light .brand-symbol span:last-child { background: var(--accent); }
.story-copy { margin-top: auto; padding: 76px 0 30px; }
.auth-story .eyebrow { color: rgba(255, 255, 255, .52); }
.auth-story .live-indicator { background: #86a9ff; box-shadow: 0 0 0 4px rgba(134, 169, 255, .13); }
.story-copy h1 { max-width: 600px; margin: 0; font-size: clamp(42px, 5.2vw, 70px); font-weight: 650; letter-spacing: -.075em; line-height: 1.05; }
.story-copy h1 em { color: #8eaeff; font-style: normal; }
.story-copy > p:last-child { max-width: 420px; margin: 25px 0 0; color: rgba(255, 255, 255, .62); font-size: 14px; line-height: 1.8; }
.story-visual { position: absolute; top: 88px; right: 7%; width: 250px; height: 190px; opacity: .9; transform: rotate(-7deg); }
.visual-frame { position: absolute; border-radius: 12px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.visual-frame-back { width: 150px; height: 112px; top: 22px; left: 20px; background: linear-gradient(135deg, #343a49, #1a1e27); transform: rotate(-10deg); }
.visual-frame-mid { width: 170px; height: 126px; top: 9px; left: 45px; background: linear-gradient(135deg, #d9e3ff 4%, #5675cc 48%, #27335e 100%); transform: rotate(6deg); }
.visual-frame-front { width: 182px; height: 136px; top: 29px; left: 35px; padding: 15px; background: linear-gradient(145deg, #f7f9ff, #bdcafe 55%, #657dd0); transform: rotate(-2deg); }
.visual-chip { display: block; color: rgba(24, 35, 72, .55); font: 700 8px/1 "SFMono-Regular", Consolas, monospace; letter-spacing: .12em; }
.visual-line { display: block; height: 5px; margin-top: 12px; border-radius: 8px; background: rgba(255, 255, 255, .72); }
.visual-line-one { width: 52%; margin-top: 48px; }
.visual-line-two { width: 72%; }
.visual-line-three { width: 39%; opacity: .58; }
.visual-orbit { position: absolute; width: 235px; height: 82px; top: 43px; left: 9px; border: 1px solid rgba(143, 172, 255, .38); border-radius: 50%; transform: rotate(-25deg); }
.story-footer { margin: 0; color: rgba(255, 255, 255, .38); font-size: 11px; letter-spacing: .04em; }
.auth-panel { display: grid; place-items: center; padding: 48px 44px; background: var(--surface); }
.auth-card { width: min(100%, 370px); }
.auth-mobile-brand { display: none; align-items: center; gap: 9px; margin-bottom: 52px; font-size: 16px; font-weight: 720; letter-spacing: -.04em; }
.auth-heading h1 { margin: 0; font-size: clamp(30px, 4vw, 42px); font-weight: 680; letter-spacing: -.065em; line-height: 1.1; }
.auth-lead { margin: 13px 0 32px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.stack-form { display: grid; gap: 17px; }
.stack-form label, .settings-grid label { display: grid; gap: 8px; color: var(--muted-strong); font-size: 12px; font-weight: 650; }
.stack-form input, .settings-grid input, .settings-grid textarea {
  width: 100%;
  padding: 13px 14px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  outline: 0;
  resize: vertical;
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.stack-form input { height: 46px; }
.stack-form input:focus, .settings-grid input:focus, .settings-grid textarea:focus { background: #fff; border-color: rgba(23, 105, 232, .6); box-shadow: 0 0 0 4px rgba(23, 105, 232, .1); }
.stack-form input::placeholder, .settings-grid input::placeholder, .settings-grid textarea::placeholder { color: #a8aeb8; }
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  color: #fff;
  background: var(--ink);
  border: 0;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 680;
  transition: color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s ease;
}
.primary-button svg { width: 16px; height: 16px; }
.primary-button:hover { background: #2d323b; box-shadow: 0 7px 16px rgba(21, 23, 27, .14); transform: translateY(-1px); }
.primary-button:disabled { opacity: .55; box-shadow: none; transform: none; }
.primary-button-wide { width: 100%; margin-top: 6px; min-height: 48px; }
.form-error { margin: -2px 0 0; color: var(--danger); font-size: 12px; line-height: 1.5; }
.auth-footnote { margin: 28px 0 0; color: #a3a8b1; font-size: 11px; text-align: center; }

/* Main workspace */
.app-shell { width: min(calc(100% - 48px), 1240px); margin: 0 auto; padding: 62px 0 96px; }
.hero-block { display: grid; grid-template-columns: minmax(0, 1fr) 250px; align-items: end; gap: 42px; margin-bottom: 37px; }
.hero-block h1 { margin: 0; font-size: clamp(46px, 6.2vw, 76px); font-weight: 680; letter-spacing: -.085em; line-height: 1.01; }
.hero-block h1 span { color: var(--accent); }
.hero-copy { max-width: 560px; margin: 19px 0 0; color: var(--muted); font-size: 15px; line-height: 1.75; }
.hero-status { align-self: stretch; display: flex; flex-direction: column; justify-content: center; padding: 19px 20px; background: rgba(255, 255, 255, .66); border: 1px solid var(--line); border-radius: var(--radius-md); }
.hero-status strong { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; font-weight: 650; }
.hero-status p { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.status-dot { width: 7px; height: 7px; display: inline-block; flex: 0 0 auto; border-radius: 50%; background: #9ea5af; }
.status-dot.is-live { background: var(--success); box-shadow: 0 0 0 4px rgba(24, 132, 84, .11); }

.upload-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(230px, .72fr);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.upload-panel:hover, .upload-panel.is-dragging, .upload-panel.is-pasting, .upload-panel:focus-visible { border-color: rgba(23, 105, 232, .45); box-shadow: 0 16px 42px rgba(23, 105, 232, .09); }
.upload-panel.is-dragging { transform: translateY(-2px); }
.upload-panel.is-pasting { border-color: rgba(23, 105, 232, .55); box-shadow: 0 0 0 3px rgba(23, 105, 232, .12), 0 16px 42px rgba(23, 105, 232, .1); transform: translateY(-2px); }
.upload-panel.is-pasting .upload-icon { animation: paste-pulse .6s ease; }
.upload-panel.is-uploading { border-color: rgba(23, 105, 232, .5); box-shadow: 0 0 0 3px rgba(23, 105, 232, .1); }
.upload-panel.is-uploading .upload-icon { animation: upload-spin 1.2s linear infinite; }
@keyframes upload-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes paste-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.upload-panel-main { display: flex; align-items: center; gap: 24px; min-height: 236px; padding: 34px 39px; }
.upload-icon { width: 58px; height: 58px; display: grid; place-items: center; flex: 0 0 auto; color: var(--accent); background: var(--accent-soft); border-radius: 17px; }
.upload-icon svg { width: 27px; height: 27px; stroke-width: 1.55; }
.upload-copy { min-width: 0; }
.upload-kicker { margin: 0 0 8px; color: var(--accent); font-size: 10px; font-weight: 750; letter-spacing: .15em; }
.upload-copy h2 { margin: 0; font-size: 24px; font-weight: 670; letter-spacing: -.055em; }
.upload-copy > p:not(.upload-kicker) { margin: 9px 0 18px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.upload-actions { display: flex; align-items: center; gap: 14px; }
.upload-button { min-height: 39px; padding: 9px 13px; background: var(--accent); }
.upload-button:hover { background: var(--accent-dark); box-shadow: 0 7px 16px rgba(23, 105, 232, .2); }
.upload-button svg { width: 16px; height: 16px; }
.upload-hint { color: #a0a6af; font-size: 11px; }
.upload-details { display: grid; grid-template-rows: repeat(3, 1fr); padding: 10px 24px; border-left: 1px solid var(--line); background: #fbfcfd; }
.upload-detail { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 11px 0; }
.upload-detail + .upload-detail { border-top: 1px solid var(--line); }
.upload-detail strong { color: var(--muted-strong); font-size: 11px; font-weight: 650; line-height: 1.55; text-align: right; }
.upload-status { display: flex; align-items: center; min-height: 43px; margin-top: 14px; padding: 11px 14px; color: var(--muted-strong); background: rgba(255, 255, 255, .86); border: 1px solid var(--line); border-radius: 10px; font-size: 12px; }
.upload-status::before { width: 6px; height: 6px; flex: 0 0 auto; margin-right: 9px; border-radius: 50%; background: var(--accent); content: ""; }
.upload-status.is-error { color: var(--danger); background: #fff7f7; border-color: #f2d9dc; }
.upload-status.is-error::before { background: var(--danger); }
.upload-status.is-success { color: var(--success); background: #f0faf5; border-color: #d0eddf; }
.upload-status.is-success::before { background: var(--success); }
.upload-status.is-success::after { content: '✓'; margin-left: 6px; font-weight: 600; }
.status-message { min-width: 0; }

/* 上传队列面板 */
.upload-queue {
  margin-top: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.upload-queue-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}
.upload-queue-title {
  font-size: 12px;
  font-weight: 650;
  color: var(--ink);
}
.upload-queue-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}
.upload-queue-close {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: color .2s, background .2s;
}
.upload-queue-close:hover {
  color: var(--ink);
  background: var(--surface);
}
.upload-queue-list {
  display: grid;
  gap: 0;
  max-height: 320px;
  overflow-y: auto;
}
.upload-queue-item {
  display: grid;
  grid-template-columns: 44px 1fr 80px 56px;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  transition: background .2s;
}
.upload-queue-item:last-child {
  border-bottom: 0;
}
.upload-queue-item:hover {
  background: rgba(23, 105, 232, .03);
}
.upload-queue-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-soft);
  flex-shrink: 0;
}
.upload-queue-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.upload-queue-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.upload-queue-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upload-queue-size {
  font-size: 10px;
  color: var(--muted);
}
.upload-queue-progress {
  height: 6px;
  background: var(--surface-soft);
  border-radius: 3px;
  overflow: hidden;
}
.upload-queue-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width .3s ease;
  width: 0%;
}
.upload-queue-progress-bar.is-complete {
  background: var(--success);
}
.upload-queue-progress-bar.is-error {
  background: var(--danger);
}
.upload-queue-status {
  font-size: 10px;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}
.upload-queue-status.is-pending {
  color: var(--muted);
}
.upload-queue-status.is-uploading {
  color: var(--accent);
}
.upload-queue-status.is-complete {
  color: var(--success);
}
.upload-queue-status.is-error {
  color: var(--danger);
}

.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.stat-card { min-height: 128px; display: flex; flex-direction: column; justify-content: space-between; padding: 18px 20px; background: rgba(255, 255, 255, .72); border: 1px solid var(--line); border-radius: var(--radius-md); }
.stat-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stat-icon { width: 30px; height: 30px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); border-radius: 9px; }
.stat-icon svg { width: 16px; height: 16px; }
.stat-value { display: block; margin-top: 16px; font-size: 29px; font-weight: 670; letter-spacing: -.065em; line-height: 1; }
.stat-value-small { font-size: 20px; letter-spacing: -.045em; }
.stat-caption { margin-top: 8px; color: #a0a6af; font-size: 10px; }

.library-section { margin-top: 72px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.section-title-line { display: flex; align-items: center; gap: 10px; }
.section-heading h2 { margin: 0; font-size: 32px; font-weight: 680; letter-spacing: -.07em; }
.section-count { min-width: 24px; padding: 4px 7px; color: var(--muted); background: var(--surface-soft); border-radius: 99px; font-size: 10px; font-weight: 700; text-align: center; }
.ghost-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 35px; padding: 7px 12px; color: var(--muted-strong); background: transparent; border: 1px solid var(--line-strong); border-radius: 9px; font-size: 11px; font-weight: 650; transition: color .2s ease, border-color .2s ease, background .2s ease, transform .2s ease; }
.ghost-button svg { width: 15px; height: 15px; }
.ghost-button:hover { color: var(--ink); background: var(--surface); border-color: #bbc3cf; transform: translateY(-1px); }
.image-grid { min-height: 100px; }
.image-grid .image-card { width: calc(25% - 12px); margin-bottom: 15px; }
.image-card { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: 0 5px 18px rgba(26, 39, 62, .035); transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.image-card:hover { border-color: #cfd7e3; box-shadow: 0 12px 28px rgba(26, 39, 62, .09); transform: translateY(-2px); }
.image-preview { position: relative; display: block; overflow: hidden; background: #e9edf2; }
.image-preview::after { position: absolute; inset: 0; background: linear-gradient(to top, rgba(11, 14, 20, .24), transparent 40%); opacity: 0; transition: opacity .25s ease; content: ""; pointer-events: none; }
.image-preview img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .35s ease; }
.image-card:hover .image-preview img { transform: scale(1.035); }
.image-card:hover .image-preview::after { opacity: 1; }
.preview-open { position: absolute; z-index: 1; right: 10px; bottom: 10px; width: 29px; height: 29px; display: grid; place-items: center; color: #fff; background: rgba(17, 19, 24, .62); border: 1px solid rgba(255,255,255,.22); border-radius: 8px; opacity: 0; transform: translateY(4px); transition: opacity .2s ease, transform .2s ease; }
.preview-open svg { width: 14px; height: 14px; }
.image-card:hover .preview-open, .image-preview:focus-visible .preview-open { opacity: 1; transform: translateY(0); }
.image-info { padding: 13px 13px 14px; }
.image-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.image-title-group { min-width: 0; display: flex; align-items: baseline; gap: 7px; }
.image-kind { color: var(--accent); font: 750 9px/1 "SFMono-Regular", Consolas, monospace; letter-spacing: .08em; }
.image-name { min-width: 0; overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.copy-button { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; padding: 4px 6px; color: var(--accent); background: var(--accent-soft); border: 0; border-radius: 6px; font-size: 10px; font-weight: 650; transition: background .2s ease, color .2s ease; }
.copy-button svg { width: 13px; height: 13px; }
.copy-button:hover { color: var(--accent-dark); background: #dce9ff; }
.copy-button.is-copied { color: var(--success); background: #e6f6ee; }
.image-meta { display: block; margin-top: 8px; color: var(--muted); font-size: 10px; }
.image-url { width: 100%; height: 29px; margin-top: 11px; padding: 6px 8px; overflow: hidden; color: #7d8590; background: var(--surface-soft); border: 0; border-radius: 6px; outline: 0; font: 10px/1.5 "SFMono-Regular", Consolas, monospace; text-overflow: ellipsis; transition: background .2s ease; }
.image-url:focus { background: var(--accent-soft); box-shadow: 0 0 0 2px rgba(23, 105, 232, .18); }
.empty-state { padding: 68px 20px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius-md); text-align: center; }
.empty-icon { width: 42px; height: 42px; display: grid; place-items: center; margin: 0 auto 14px; color: var(--accent); background: var(--accent-soft); border-radius: 13px; }
.empty-icon svg { width: 22px; height: 22px; }
.empty-state h3 { margin: 0 0 7px; color: var(--ink); font-size: 18px; letter-spacing: -.045em; }
.empty-state p { margin: 0 0 18px; font-size: 12px; }
.empty-state .ghost-button { margin: 0 auto; }

.image-skeleton { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.image-skeleton-preview, .image-skeleton-line { position: relative; overflow: hidden; background: var(--surface-soft); }
.image-skeleton-preview { height: 172px; }
.image-skeleton-info { padding: 14px; }
.image-skeleton-line { height: 10px; margin-bottom: 11px; border-radius: 5px; }
.image-skeleton-line.short { width: 56%; }
.image-skeleton-line.tiny { width: 78%; height: 8px; margin-top: 15px; }
.image-skeleton-preview::after, .image-skeleton-line::after { position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent); animation: shimmer 1.35s infinite; content: ""; transform: translateX(-100%); }
@keyframes shimmer { to { transform: translateX(100%); } }

/* Load more sentinel */
.load-sentinel { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 32px 0 16px; color: var(--muted); font-size: 13px; }
.loading-spinner { width: 20px; height: 20px; flex: 0 0 auto; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.all-loaded { color: #b0b6c0; font-size: 12px; letter-spacing: .04em; }

/* Settings */
.settings-shell { width: min(calc(100% - 48px), 1080px); margin: 0 auto; padding: 62px 0 96px; }
.settings-intro { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding-bottom: 38px; border-bottom: 1px solid var(--line); }
.settings-intro h1 { margin: 0; font-size: clamp(42px, 6vw, 66px); font-weight: 680; letter-spacing: -.08em; line-height: 1; }
.settings-intro p:not(.eyebrow) { margin: 16px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.settings-intro-mark { display: flex; align-items: end; gap: 8px; color: #b7bec9; font: 750 10px/1 "SFMono-Regular", Consolas, monospace; letter-spacing: .12em; }
.settings-intro-mark strong { color: var(--accent); font-size: 28px; font-weight: 500; letter-spacing: -.08em; }
.settings-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 54px; padding-top: 38px; }
.settings-sidebar { position: sticky; top: 104px; align-self: start; }
.sidebar-label { margin: 0 0 14px; }
.settings-sidebar nav { display: grid; gap: 4px; }
.settings-nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 10px; color: var(--muted); border-radius: 8px; font-size: 12px; font-weight: 600; transition: color .2s ease, background .2s ease; }
.settings-nav-link span { width: 20px; color: #a5acb7; font: 10px "SFMono-Regular", Consolas, monospace; }
.settings-nav-link:hover { color: var(--ink); background: var(--surface); }
.settings-nav-link.is-active { color: var(--accent-dark); background: var(--accent-soft); }
.settings-nav-link.is-active span { color: var(--accent); }
.sidebar-note { display: flex; align-items: flex-start; gap: 9px; margin-top: 48px; padding: 12px 10px; color: var(--muted-strong); border-top: 1px solid var(--line); font-size: 11px; line-height: 1.45; }
.sidebar-note .status-dot { margin-top: 4px; }
.sidebar-note small { color: var(--muted); font-size: 10px; }
.settings-content { min-width: 0; }
.settings-form { display: grid; gap: 14px; }
.settings-card { display: grid; gap: 25px; padding: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); scroll-margin-top: 94px; }
.settings-card-heading { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 13px; align-items: start; }
.settings-card-heading .eyebrow { margin-bottom: 7px; }
.settings-card-heading h2 { margin: 0; font-size: 21px; font-weight: 680; letter-spacing: -.055em; }
.settings-card-heading p:not(.eyebrow) { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.card-index { color: var(--accent); font: 750 11px/1 "SFMono-Regular", Consolas, monospace; }
.card-index-muted { color: #a9b0ba; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.settings-grid label small { color: #9da4af; font-size: 10px; font-weight: 450; line-height: 1.45; }
.settings-grid textarea { min-height: 86px; }
.settings-span { grid-column: span 2; }
.checkbox-label { display: flex !important; grid-template-columns: none; align-items: flex-start; gap: 9px !important; padding-top: 23px; }
.checkbox-label input { width: 16px; height: 16px; flex: 0 0 auto; margin: 1px 0 0; padding: 0; accent-color: var(--accent); }
.checkbox-label > span { display: grid; gap: 5px; }
.checkbox-label strong { color: var(--muted-strong); font-size: 12px; font-weight: 650; }


.settings-actions { display: flex; align-items: center; justify-content: flex-end; gap: 16px; padding-top: 2px; }

.action-hint { margin-right: auto; color: #a0a6af; font-size: 10px; }

.settings-actions .primary-button { min-height: 40px; }

.settings-actions .ghost-button { min-height: 40px; color: var(--accent); border-color: rgba(23, 105, 232, .25); }


.settings-actions .ghost-button:hover { color: var(--accent-dark); border-color: rgba(23, 105, 232, .45); }

.password-card, #mcp { margin-top: 14px; }

.mcp-endpoint-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}
.mcp-endpoint {
  display: block;
  margin-top: 8px;
  padding: 12px 14px;
  overflow: auto;
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
  font: 12px/1.45 "SFMono-Regular", Consolas, monospace;
  word-break: break-all;
}
.mcp-help, .mcp-empty, .mcp-env-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.mcp-help code, .mcp-env-note code {
  font-family: "SFMono-Regular", Consolas, monospace;
}
.mcp-token-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}
.mcp-token-form label { display: grid; gap: 8px; }
.mcp-token-once {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
}
.mcp-token-once p { margin: 0; color: var(--accent-dark); font-size: 12px; }
.mcp-token-once code {
  display: block;
  padding: 10px 12px;
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  font: 12px/1.5 "SFMono-Regular", Consolas, monospace;
  word-break: break-all;
}
.mcp-token-list { display: grid; gap: 8px; }
.mcp-token-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
}
.mcp-token-row strong { display: block; font-size: 13px; }
.mcp-token-row span { color: var(--muted); font: 11px/1.4 "SFMono-Regular", Consolas, monospace; }
.mcp-config pre {
  margin: 8px 0 0;
  padding: 14px;
  overflow: auto;
  color: #e8edf5;
  background: #15171b;
  border-radius: var(--radius-sm);
  font: 11px/1.55 "SFMono-Regular", Consolas, monospace;
}
@media (max-width: 680px) {
  .mcp-endpoint-row, .mcp-token-form { grid-template-columns: 1fr; display: grid; }
}


@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (max-width: 1020px) {
  .image-grid .image-card { width: calc(33.333% - 11px); }
  .upload-panel { grid-template-columns: 1fr; }
  .upload-details { grid-template-columns: repeat(3, 1fr); grid-template-rows: none; padding: 0 24px; border-top: 1px solid var(--line); border-left: 0; }
  .upload-detail + .upload-detail { border-top: 0; border-left: 1px solid var(--line); padding-left: 20px; }
}

@media (max-width: 820px) {
  .auth-layout { grid-template-columns: 1fr; min-height: 0; }
  .auth-story { min-height: 390px; padding: 32px 34px 28px; }
  .story-copy { margin-top: auto; padding: 54px 0 20px; }
  .story-copy h1 { font-size: clamp(38px, 8vw, 56px); }
  .story-visual { top: auto; right: 5%; bottom: 6%; opacity: .62; transform: scale(.78) rotate(-7deg); transform-origin: right bottom; }
  .auth-panel { min-height: 480px; padding: 48px 32px 58px; }
}

@media (max-width: 680px) {
  .topbar, .app-shell { width: min(calc(100% - 32px), 1240px); }
  .topbar { height: 64px; }
  .topbar-nav { display: none; }
  .topbar-actions { gap: 7px; }
  .account-label { display: none; }
  .back-link { display: none; }
  .app-shell { padding: 48px 0 70px; }
  .hero-block { grid-template-columns: 1fr; gap: 24px; margin-bottom: 28px; }
  .hero-block h1 { font-size: clamp(43px, 13vw, 64px); }
  .hero-copy { margin-top: 15px; font-size: 14px; }
  .hero-status { min-height: 0; padding: 16px; }
  .upload-panel-main { min-height: 0; align-items: flex-start; gap: 16px; padding: 26px 22px; }
  .upload-icon { width: 46px; height: 46px; border-radius: 13px; }
  .upload-icon svg { width: 22px; height: 22px; }
  .upload-copy h2 { font-size: 20px; }
  .upload-copy > p:not(.upload-kicker) { margin-bottom: 15px; }
  .upload-details { grid-template-columns: 1fr; padding: 4px 22px; }
  .upload-detail { padding: 11px 0; }
  .upload-detail + .upload-detail { border-top: 1px solid var(--line); border-left: 0; padding-left: 0; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 112px; }
  .library-section { margin-top: 58px; }
  .section-heading h2 { font-size: 28px; }
  .image-grid .image-card { width: calc(50% - 6px); }
  .copy-button .button-label { display: none; }
  .copy-button { padding: 6px; }
  .settings-shell { width: min(calc(100% - 32px), 1080px); padding: 48px 0 70px; }
  .settings-intro { padding-bottom: 28px; }
  .settings-intro-mark { display: none; }
  .settings-layout { grid-template-columns: 1fr; gap: 24px; padding-top: 25px; }
  .settings-sidebar { position: static; }
  .settings-sidebar nav { grid-template-columns: repeat(3, 1fr); gap: 5px; }
  .settings-nav-link { display: grid; justify-items: center; gap: 5px; padding: 9px 5px; text-align: center; }
  .settings-nav-link span { width: auto; }
  .sidebar-note { display: none; }
  .settings-card { padding: 21px 18px; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-span { grid-column: auto; }
  .checkbox-label { padding-top: 0; }
  .settings-actions { align-items: stretch; flex-direction: column-reverse; gap: 9px; }
  .settings-actions .primary-button, .settings-actions .ghost-button { width: 100%; }
  .action-hint { margin: 0; text-align: center; }
}

@media (max-width: 440px) {
  .auth-page { padding: 0; }
  .auth-layout { width: 100%; border: 0; border-radius: 0; }
  .auth-story { min-height: 325px; padding: 25px 23px 24px; }
  .story-copy { padding-top: 38px; }
  .story-copy h1 { font-size: 39px; }
  .story-copy > p:last-child { margin-top: 15px; font-size: 12px; }
  .story-visual { display: none; }
  .story-footer { font-size: 10px; }
  .auth-panel { padding: 37px 23px 48px; }
  .auth-mobile-brand { display: flex; margin-bottom: 39px; }
  .auth-heading h1 { font-size: 31px; }
  .image-grid .image-card { width: 100%; }
  .image-preview, .image-skeleton-preview { height: 220px; }
  .settings-nav-link { font-size: 11px; }
  .settings-nav-link span { font-size: 9px; }
}

/* Admin page styles */
.admin-section {
  margin-bottom: 60px;
}

.admin-description {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  min-height: 100px;
}

.user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.user-card:hover {
  border-color: #cfd7e3;
  box-shadow: 0 12px 28px rgba(26, 39, 62, .09);
  transform: translateY(-2px);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.user-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 750;
}

.user-details {
  min-width: 0;
}

.user-details h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 670;
  letter-spacing: -.03em;
}

.user-email {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 650;
}

.user-role.admin {
  color: var(--accent);
  background: var(--accent-soft);
}

.user-role.user {
  color: var(--muted);
  background: var(--surface-soft);
}

.user-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.user-actions button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: color .2s ease, background .2s ease, border-color .2s ease;
}

.user-actions button svg {
  width: 16px;
  height: 16px;
}

.user-actions button:hover {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.user-actions .delete-user-btn:hover {
  color: var(--danger);
  background: #fff7f7;
  border-color: #f2d9dc;
}

.image-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.image-actions button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  transition: color .2s ease, background .2s ease, border-color .2s ease;
}

.image-actions button svg {
  width: 14px;
  height: 14px;
}

.image-actions button:hover {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.image-actions .delete-image-btn:hover {
  color: var(--danger);
  background: #fff7f7;
  border-color: #f2d9dc;
}

.modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(4px);
}

.modal-content {
  width: min(90%, 480px);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .26);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 680;
  letter-spacing: -.04em;
}

.modal-content form {
  padding: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 650;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 13px 14px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  outline: 0;
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.form-group input:focus,
.form-group select:focus {
  background: #fff;
  border-color: rgba(23, 105, 232, .6);
  box-shadow: 0 0 0 4px rgba(23, 105, 232, .1);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 24px 24px;
}

.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  color: #fff;
  background: var(--danger);
  border: 0;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 680;
  transition: color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s ease;
}

.danger-button:hover {
  background: #b02a3a;
  box-shadow: 0 7px 16px rgba(193, 61, 77, .2);
  transform: translateY(-1px);
}

@media (max-width: 680px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
  
  .user-card {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .user-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
