:root {
  --bg0: #f4f7fc;
  --bg1: #eef6f4;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0d9488;
  --accent-hover: #0f766e;
  --accent-soft: rgba(13, 148, 136, 0.12);
  --ok: #059669;
  --err: #dc2626;
  --warn-bg: #fff7ed;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 18px 50px -12px rgba(15, 23, 42, 0.12);
  --radius: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'PingFang SC',
    'Microsoft YaHei', sans-serif;
  color: var(--text);
  line-height: 1.55;
  background: linear-gradient(165deg, #e8f4fc 0%, #f0f7ff 38%, #faf5ff 72%, #fff8f4 100%);
  background-attachment: fixed;
}

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.head h1 {
  margin: 0 0 0.4rem;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 52ch;
}

.head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.user-label {
  font-size: 0.875rem;
  color: var(--muted);
}

.btn-ghost {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  border: 0;
  background: var(--surface-2);
  color: var(--muted);
}

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

.btn-primary-inline,
.btn-secondary {
  padding: 0.55rem 1.15rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 0;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-primary-inline {
  background: var(--accent);
  color: #fff;
}

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

.btn-primary-inline.danger {
  background: var(--err);
}

.btn-primary-inline.danger:hover {
  filter: brightness(1.05);
}

.hidden,
[hidden] {
  display: none !important;
}

/* —— 登录全屏 —— */
.login-shell {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(160deg, rgba(232, 244, 252, 0.92) 0%, rgba(250, 245, 255, 0.94) 100%);
  backdrop-filter: blur(10px);
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 2rem 2rem 1.75rem;
  background: var(--surface);
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(15, 23, 42, 0.04);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.5rem;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent) 0%, #14b8a6 100%);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 300;
  box-shadow: 0 8px 20px rgba(13, 148, 136, 0.35);
}

.login-brand-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.login-brand-sub {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.login-title {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 700;
}

.login-hint {
  margin: 0 0 1.35rem;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.login-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.login-form .field span {
  color: var(--muted);
  font-weight: 600;
}

.login-form input {
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-form input::placeholder {
  color: #94a3b8;
}

.login-form input:hover {
  border-color: var(--border-strong);
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface);
}

.btn-login-submit {
  margin-top: 0.25rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 0;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, #0f766e 100%);
  box-shadow: 0 10px 24px rgba(13, 148, 136, 0.28);
  transition: transform 0.12s, filter 0.12s;
}

.btn-login-submit:hover {
  filter: brightness(1.04);
}

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

.login-msg {
  margin: 1rem 0 0;
  min-height: 1.35rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.login-msg.err {
  color: var(--err);
  font-weight: 500;
}

/* —— 上传区 —— */
.dropzone {
  margin-top: 1.5rem;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 2.35rem 1.25rem;
  text-align: center;
  cursor: pointer;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--shadow), 0 0 0 4px var(--accent-soft);
  outline: none;
}

.dropzone.drag {
  border-color: var(--ok);
  background: #ecfdf5;
  box-shadow: var(--shadow), 0 0 0 4px rgba(5, 150, 105, 0.15);
}

.drop-inner {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: var(--muted);
  align-items: center;
}

.drop-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 0.25rem;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.25rem;
  font-weight: 700;
}

.drop-inner strong {
  color: var(--text);
  font-size: 1.08rem;
}

.snippet-panel {
  margin-top: 1.75rem;
  padding: 1.25rem 1.35rem 1.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.snippet-head {
  margin-bottom: 0.85rem;
}

.snippet-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.snippet-desc {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.5;
  max-width: 62ch;
}

.snippet-input {
  display: block;
  width: 100%;
  min-height: 220px;
  margin: 0;
  padding: 0.85rem 1rem;
  font-family: ui-monospace, 'SF Mono', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
    monospace;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.snippet-input::placeholder {
  color: #94a3b8;
}

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

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

.snippet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.85rem;
  justify-content: flex-end;
}

.hint {
  min-height: 1.5rem;
  margin: 0.85rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.hint.err {
  color: var(--err);
}

.hint.ok {
  color: var(--ok);
}

.list {
  margin-top: 2rem;
}

.list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.list h2 {
  font-size: 1.05rem;
  margin: 0;
  color: var(--text);
  font-weight: 700;
}

.batch-toolbar {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.batch-toolbar-hint {
  margin: 0 0 0.65rem;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.5;
}

.batch-toolbar-hint strong {
  color: var(--text);
  font-weight: 600;
}

.batch-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-select {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.card-select input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
  cursor: pointer;
}

#fileList {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.85rem;
  transition: box-shadow 0.15s;
}

.card:hover {
  box-shadow: var(--shadow), 0 4px 14px rgba(15, 23, 42, 0.06);
}

@media (min-width: 640px) {
  .card {
    grid-template-columns: minmax(0, 220px) 1fr;
    align-items: start;
  }
}

.preview {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview img,
.preview video {
  max-width: 100%;
  max-height: 220px;
  vertical-align: middle;
}

.preview iframe {
  width: 100%;
  min-height: 200px;
  border: 0;
  background: #fff;
}

.preview-text iframe {
  min-height: 220px;
  max-height: 360px;
}

.preview-pdf .pdf-object {
  width: 100%;
  min-height: 260px;
  max-height: 420px;
  border: 0;
  background: #f8fafc;
}

.preview-pdf .pdf-fallback {
  padding: 1.25rem;
  text-align: center;
}

.preview-pdf .pdf-fallback a {
  color: var(--accent);
  font-weight: 600;
}

.preview .placeholder {
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  word-break: break-all;
}

.meta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.meta .name {
  font-weight: 600;
  word-break: break-all;
  color: var(--text);
}

.meta .small {
  font-size: 0.85rem;
  color: var(--muted);
}

.url-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.url-row input {
  flex: 1 1 200px;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.85rem;
}

button.copy {
  padding: 0.5rem 0.95rem;
  border-radius: 8px;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.875rem;
}

button.copy:hover {
  background: var(--accent-hover);
}

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

.btn-danger {
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #b91c1c;
}

.btn-danger:hover {
  background: #ffe4e6;
  border-color: #fca5a5;
}

.btn-compact {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

/* —— 确认弹层 —— */
.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(6px);
}

.dialog-card {
  width: 100%;
  max-width: 400px;
  padding: 1.5rem 1.5rem 1.25rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: dialog-in 0.22s ease-out;
}

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

.dialog-title {
  margin: 0 0 0.65rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.dialog-message {
  margin: 0 0 1.35rem;
  font-size: 0.925rem;
  color: var(--muted);
  line-height: 1.55;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: flex-end;
}
