/* ==========================================================================
   review-portal 控制台
   设计基线：深色、克制、高对比；系统字体栈；零外部依赖。
   ========================================================================== */

:root {
  color-scheme: dark;

  /* 色板：GitHub 深色主题为基线 */
  --bg: #0d1117;
  --bg-inset: #010409;
  --surface: #161b22;
  --surface-raised: #1c2128;
  --surface-hover: #21262d;
  --border: #30363d;
  --border-strong: #484f58;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-faint: #6e7681;
  --accent: #2f81f7;
  --accent-strong: #1f6feb; /* 实心按钮底色：白字对比约 4.6:1 */
  --accent-soft: rgba(47, 129, 247, 0.15);
  --danger: #f85149;
  --danger-strong: #da3633;
  --danger-soft: rgba(248, 81, 73, 0.12);
  --success: #3fb950;
  --warning: #d29922;

  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --shadow-lg: 0 16px 40px rgba(1, 4, 9, 0.65);
  --shadow-sm: 0 1px 0 rgba(1, 4, 9, 0.35);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", "Courier New", monospace;

  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --topbar-h: 56px;
  --content-max: 1120px;
}

/* ---------- 重置 ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: radial-gradient(1100px 380px at 50% -180px, rgba(47, 129, 247, 0.1), transparent 72%);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, figure, ul, ol, dl, dd {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

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

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

a:hover {
  text-decoration: underline;
}

button {
  font: inherit;
  color: inherit;
}

code, kbd, pre, samp {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

[hidden] {
  display: none !important;
}

::selection {
  background: rgba(47, 129, 247, 0.38);
}

/* ---------- 焦点与可访问性 ---------- */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 300;
  padding: 10px 14px;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform 0.15s var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.noscript {
  max-width: 560px;
  margin: 80px auto;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  text-align: center;
}

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(13, 17, 23, 0.86);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 28px;
  max-width: var(--content-max);
  height: var(--topbar-h);
  margin: 0 auto;
  padding: 0 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover {
  text-decoration: none;
}

.brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: linear-gradient(150deg, rgba(47, 129, 247, 0.28), rgba(47, 129, 247, 0.08));
  border: 1px solid rgba(47, 129, 247, 0.45);
  color: #9ec2fb;
}

.brand__mark svg {
  width: 15px;
  height: 15px;
}

.brand__text em {
  color: var(--text-faint);
  font-style: normal;
  padding: 0 1px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav__link {
  position: relative;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.14s var(--ease), background-color 0.14s var(--ease);
}

.nav__link:hover {
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
}

.nav__link.is-active {
  color: var(--text);
  background: var(--surface-hover);
}

.nav__link.is-active::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 50%;
  width: 4px;
  height: 4px;
  margin-top: -2px;
  border-radius: 50%;
  background: var(--accent);
}

.nav__link.is-active {
  padding-left: 16px;
}

.topbar__meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.stat .icon {
  color: var(--text-faint);
}

/* ---------- 主区域 ---------- */

.main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 32px 24px 72px;
  outline: none;
}

.view {
  animation: view-in 0.18s var(--ease);
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.page-head__text {
  min-width: 0;
}

.page-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.page-sub {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 13px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.section-desc {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ---------- 图标 ---------- */

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 16px;
  height: 16px;
}

.icon svg {
  width: 100%;
  height: 100%;
}

.icon--lg {
  width: 28px;
  height: 28px;
}

.icon--xl {
  width: 40px;
  height: 40px;
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.14s var(--ease), border-color 0.14s var(--ease),
    color 0.14s var(--ease), box-shadow 0.14s var(--ease), transform 0.06s var(--ease);
  -webkit-user-select: none;
  user-select: none;
}

.btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  background: var(--accent-strong);
  border-color: rgba(47, 129, 247, 0.65);
  color: #fff;
}

.btn--primary:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.btn--danger {
  background: var(--danger-strong);
  border-color: rgba(248, 81, 73, 0.65);
  color: #fff;
}

.btn--danger:hover {
  background: #f0483e;
  border-color: var(--danger);
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.btn--ghost:hover {
  background: var(--surface-hover);
  border-color: var(--border);
  color: var(--text);
}

.btn--danger-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.btn--danger-ghost:hover {
  background: var(--danger-soft);
  border-color: rgba(248, 81, 73, 0.4);
  color: var(--danger);
}

.btn--sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  gap: 5px;
}

.btn--sm .icon {
  width: 14px;
  height: 14px;
}

.btn--block {
  width: 100%;
}

.btn.is-busy {
  pointer-events: none;
  opacity: 0.8;
}

.btn.is-busy::before {
  content: "";
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  opacity: 0.9;
}

.btn.is-busy > .icon {
  display: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.14s var(--ease), color 0.14s var(--ease);
}

.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: inherit;
  cursor: pointer;
}

.link-btn:hover {
  text-decoration: underline;
}

/* ---------- 表单 ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.field:last-child {
  margin-bottom: 0;
}

.field__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

.field__optional {
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 400;
}

.input,
.textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px 12px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  transition: border-color 0.14s var(--ease), box-shadow 0.14s var(--ease), background-color 0.14s var(--ease);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-faint);
}

.input:hover,
.textarea:hover {
  border-color: var(--border-strong);
}

.input:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input[aria-invalid="true"] {
  border-color: var(--danger);
}

.input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px var(--danger-soft);
}

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

.hint {
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.5;
}

.field-error {
  color: var(--danger);
  font-size: 12px;
  line-height: 1.5;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group .input {
  padding-right: 42px;
}

.input-group__btn {
  position: absolute;
  right: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.input-group__btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* 复选框：保留原生语义，自绘外观 */
.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.checkbox input {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.checkbox__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
}

.checkbox__desc {
  color: var(--text-muted);
  font-size: 12px;
}

/* ---------- 卡片 ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.card__body {
  padding: 20px;
}

.card__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: rgba(1, 4, 9, 0.18);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ---------- 徽章 ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
}

.badge--accent {
  border-color: rgba(47, 129, 247, 0.45);
  background: var(--accent-soft);
  color: #9ec2fb;
}

.badge--success {
  border-color: rgba(63, 185, 80, 0.4);
  background: rgba(63, 185, 80, 0.12);
  color: #7ee787;
}

.badge--warning {
  border-color: rgba(210, 153, 34, 0.4);
  background: rgba(210, 153, 34, 0.12);
  color: #e3b341;
}

/* ---------- 表格 ---------- */

.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: #12171e;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr {
  transition: background-color 0.12s var(--ease);
}

.table tbody tr:hover {
  background: rgba(110, 118, 129, 0.08);
}

.table .num {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  white-space: nowrap;
}

.cell-project {
  min-width: 200px;
}

.cell-project__title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.cell-project__slug {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.cell-project__slug svg {
  width: 11px;
  height: 11px;
  opacity: 0.7;
}

.cell-actions {
  width: 1%;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

/* ---------- 空状态 / 加载 / 错误 ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 64px 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(22, 27, 34, 0.65), rgba(13, 17, 23, 0.2));
  text-align: center;
}

.empty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-raised);
  color: var(--text-muted);
}

.empty__icon svg {
  width: 24px;
  height: 24px;
}

.empty__title {
  font-size: 15px;
  font-weight: 600;
}

.empty__desc {
  max-width: 46ch;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 13px;
}

.empty__actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 56px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

.state__icon {
  color: var(--text-muted);
}

.state__icon.is-error {
  color: var(--danger);
}

.state__title {
  font-size: 15px;
  font-weight: 600;
}

.state__desc {
  max-width: 52ch;
  color: var(--text-muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.state__actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.skeleton {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.skeleton__row {
  height: 56px;
  background: linear-gradient(90deg, rgba(110, 118, 129, 0.08) 25%, rgba(110, 118, 129, 0.16) 37%, rgba(110, 118, 129, 0.08) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-bottom: 1px solid var(--border);
}

.skeleton__row:last-child {
  border-bottom: 0;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ---------- 上传 ---------- */

.upload-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.upload-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 40px 24px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: rgba(1, 4, 9, 0.35);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.dropzone:hover {
  border-color: var(--border-strong);
  background: rgba(22, 27, 34, 0.7);
}

.dropzone.is-dragover {
  border-color: var(--accent);
  background: rgba(47, 129, 247, 0.08);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.dropzone:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.dropzone__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.dropzone__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-raised);
  color: var(--text-muted);
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.dropzone:hover .dropzone__icon,
.dropzone.is-dragover .dropzone__icon {
  color: var(--accent);
  border-color: rgba(47, 129, 247, 0.5);
}

.dropzone__title {
  font-size: 14px;
  font-weight: 600;
}

.dropzone__hint {
  color: var(--text-muted);
  font-size: 12.5px;
}

.dropzone__browse {
  margin-top: 10px;
}

.filecard {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.filecard__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: var(--radius-sm);
  background: rgba(47, 129, 247, 0.12);
  border: 1px solid rgba(47, 129, 247, 0.3);
  color: #9ec2fb;
}

.filecard__body {
  min-width: 0;
  flex: 1;
}

.filecard__name {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filecard__meta {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12px;
}

.progress {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #21262d;
}

.progress__bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
  transition: width 0.16s linear;
}

.progress.is-indeterminate .progress__bar {
  width: 34%;
  transition: none;
  animation: indeterminate 1.15s var(--ease) infinite;
}

@keyframes indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(320%); }
}

.upload-status {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.upload-status__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.upload-status__label {
  font-size: 13px;
  font-weight: 500;
}

.upload-status__numbers {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.upload-status__pct {
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.upload-result {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(63, 185, 80, 0.35);
  border-radius: var(--radius);
  background: rgba(63, 185, 80, 0.06);
}

.upload-result__head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
}

.upload-result__head .icon {
  color: var(--success);
}

.upload-result__url {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  font-family: var(--font-mono);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.upload-result__url a {
  color: #9ec2fb;
}

.upload-result__meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 12px;
}

.upload-result__meta strong {
  color: var(--text);
  font-weight: 500;
}

.warnings {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid rgba(210, 153, 34, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(210, 153, 34, 0.08);
  font-size: 12.5px;
}

.warnings__item {
  display: flex;
  gap: 8px;
  color: #e3b341;
  overflow-wrap: anywhere;
}

.warnings__item .icon {
  margin-top: 2px;
  flex: none;
}

/* 侧栏提示 */
.aside-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.aside-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.aside-list__item {
  display: flex;
  gap: 10px;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.aside-list__item .icon {
  margin-top: 1px;
  color: var(--text-faint);
  flex: none;
}

.aside-list__item strong {
  display: block;
  color: var(--text);
  font-weight: 500;
}

.aside-list__item code {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-inset);
  color: var(--text);
  font-size: 11.5px;
}

/* ---------- 设置 ---------- */

.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 780px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.token-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.token-value {
  flex: 1 1 260px;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.token-value.is-masked {
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.code-block {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-inset);
  overflow: hidden;
}

.code-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px 8px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(22, 27, 34, 0.7);
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.code-block pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.7;
  tab-size: 2;
}

.code-block code {
  color: #d2d9e0;
  white-space: pre;
}

.code-block code .tok-comment {
  color: var(--text-faint);
}

.settings-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--border);
  overflow: hidden;
}

.settings-meta__item {
  padding: 14px 16px;
  background: var(--surface);
}

.settings-meta__label {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.settings-meta__value {
  margin-top: 4px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* ---------- 登录 ---------- */

.auth {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 200px);
  padding: 24px 0;
}

.auth__card {
  width: 100%;
  max-width: 400px;
  padding: 28px;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(1, 4, 9, 0.55);
}

.auth__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.auth__brand .brand__mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}

.auth__brand .brand__mark svg {
  width: 18px;
  height: 18px;
}

.auth__name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.auth__title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.auth__sub {
  margin-top: 6px;
  margin-bottom: 22px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.auth__error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(248, 81, 73, 0.4);
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: #ffa198;
  font-size: 12.5px;
  line-height: 1.5;
}

.auth__error .icon {
  margin-top: 2px;
  flex: none;
  color: var(--danger);
}

.auth__notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(210, 153, 34, 0.4);
  border-radius: var(--radius-sm);
  background: rgba(210, 153, 34, 0.08);
  color: #e3b341;
  font-size: 12.5px;
  line-height: 1.5;
}

.auth__notice .icon {
  margin-top: 2px;
  flex: none;
}

.auth__foot {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 12px;
  text-align: center;
}

/* ---------- 版本历史 ---------- */

.release-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.release-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  transition: border-color 0.14s var(--ease), background-color 0.14s var(--ease);
}

.release-row:hover {
  border-color: var(--border-strong);
}

.release-row.is-current {
  border-color: rgba(47, 129, 247, 0.45);
  background: rgba(47, 129, 247, 0.07);
}

.release-row__main {
  min-width: 0;
  flex: 1;
}

.release-row__title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.release-row__id {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text);
  overflow-wrap: anywhere;
}

.release-row__meta {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.release-row__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.release-empty {
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

.modal__title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.modal__subtitle {
  margin-top: 3px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.modal__text {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.65;
}

.modal__text strong {
  color: var(--text);
  font-weight: 600;
}

/* ---------- 弹窗 ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(1, 4, 9, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade-in 0.14s var(--ease);
  overflow-y: auto;
}

.modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  max-height: min(84vh, 760px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.16s var(--ease);
  outline: none;
}

.modal--wide {
  max-width: 640px;
}

.modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border);
}

.modal__head-text {
  min-width: 0;
}

.modal__body {
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: rgba(1, 4, 9, 0.18);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.modal__foot--split {
  justify-content: space-between;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

body.modal-open {
  overflow: hidden;
}

/* ---------- Toast ---------- */

.toasts {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 10px 11px 13px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  line-height: 1.5;
  pointer-events: auto;
  animation: toast-in 0.18s var(--ease);
}

.toast.is-leaving {
  animation: toast-out 0.18s var(--ease) forwards;
}

.toast--error {
  border-left-color: var(--danger);
}

.toast--success {
  border-left-color: var(--success);
}

.toast--warning {
  border-left-color: var(--warning);
}

.toast__icon {
  margin-top: 2px;
  flex: none;
}

.toast--error .toast__icon { color: var(--danger); }
.toast--success .toast__icon { color: var(--success); }
.toast--warning .toast__icon { color: var(--warning); }
.toast--info .toast__icon { color: var(--accent); }

.toast__text {
  flex: 1;
  min-width: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.toast__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  flex: none;
}

.toast__close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(16px); }
}

/* ---------- 工具栏 / 搜索 ---------- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.search {
  position: relative;
  flex: 1 1 260px;
  max-width: 340px;
}

.search > .icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

.search .input {
  height: 34px;
  padding-left: 34px;
}

.toolbar__meta {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

/* ---------- 表单补充与工具类 ---------- */

.upload-form {
  margin-top: 18px;
}

.inline-confirm-text {
  margin-right: 2px;
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.btn__label {
  white-space: nowrap;
}

.auth__error-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.mt-10 {
  margin-top: 10px;
}

.mb-12 {
  margin-bottom: 12px;
}

/* ---------- 响应式 ---------- */

@media (max-width: 960px) {
  .topbar__inner {
    flex-wrap: wrap;
    gap: 6px 16px;
    height: auto;
    padding: 10px 16px;
  }

  .brand { order: 1; }
  .topbar__meta { order: 2; margin-left: auto; }

  .nav {
    order: 3;
    flex-basis: 100%;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .upload-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .settings-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .main {
    padding: 20px 16px 56px;
  }

  .page-title {
    font-size: 19px;
  }

  .page-head {
    align-items: flex-start;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .btn--primary {
    flex: 1;
  }

  .stat {
    display: none;
  }

  /* 表格折叠为卡片 */
  .table-wrap {
    border: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .table tbody tr {
    margin-bottom: 12px;
    padding: 6px 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
  }

  .table tbody tr:last-child {
    margin-bottom: 0;
  }

  .table tbody tr:hover {
    background: var(--surface);
  }

  .table td {
    padding: 8px 16px;
    border-bottom: 0;
  }

  .table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .table td.cell-project {
    padding-top: 12px;
  }

  .table td.cell-actions {
    width: auto;
    padding-top: 4px;
    padding-bottom: 12px;
  }

  .cell-actions .row-actions {
    justify-content: flex-start;
  }

  .row-actions .btn--ghost {
    padding-left: 8px;
    padding-right: 8px;
  }

  .form-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .settings-meta {
    grid-template-columns: minmax(0, 1fr);
  }

  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    max-width: none;
    max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: 0;
    animation: sheet-up 0.2s var(--ease);
  }

  .modal__foot {
    border-radius: 0;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }

  @keyframes sheet-up {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: none; }
  }

  .release-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .release-row__actions {
    width: 100%;
    justify-content: flex-end;
  }

  .auth {
    min-height: calc(100vh - 120px);
    padding: 8px 0;
  }

  .auth__card {
    padding: 22px;
    border-radius: var(--radius);
  }
}

@media (max-width: 480px) {
  .page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .toasts {
    top: auto;
    bottom: 12px;
    left: 12px;
    right: 12px;
    width: auto;
  }

  .dropzone {
    padding: 28px 16px;
  }

  .upload-result__url {
    flex-wrap: wrap;
  }

  .modal__foot {
    flex-wrap: wrap;
  }

  .modal__foot .btn {
    flex: 1;
  }
}

/* ---------- 动效偏好 ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- 滚动条（克制） ---------- */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
  background-clip: content-box;
}

