/* ============================================================
   蓝云 CDN · 控制台样式
   ============================================================ */
:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --border: #e8edf5;
  --border-strong: #dbe3ee;
  --text: #0f172a;
  --text-soft: #475569;
  --muted: #94a3b8;
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-soft: #eff6ff;
  --danger: #e11d48;
  --success: #059669;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shadow-panel: 0 10px 34px rgba(15, 23, 42, 0.045);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

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

code,
pre {
  font-family: var(--mono);
}

:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-page {
  min-height: 100vh;
  background:
    radial-gradient(1100px 520px at 105% -8%, rgba(37, 99, 235, 0.07), transparent 62%),
    radial-gradient(900px 500px at -10% 40%, rgba(124, 58, 237, 0.04), transparent 60%),
    var(--bg);
}

/* ============================================================
   侧边栏
   ============================================================ */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 26px 18px 20px;
  color: #cbd5e1;
  background: linear-gradient(180deg, #0b1220 0%, #0d1729 55%, #0a111f 100%);
  border-right: 1px solid rgba(148, 163, 184, 0.1);
  overflow: hidden;
}

.sidebar::before {
  content: "";
  position: absolute;
  top: -140px;
  left: -70px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.35), transparent 70%);
  pointer-events: none;
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: none;
  color: #fff;
  border-radius: 14px;
  background: linear-gradient(135deg, #60a5fa, #2563eb 58%, #1d4ed8);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.brand-mark .icon {
  width: 24px;
  height: 24px;
}

.brand-mark-lg {
  width: 48px;
  height: 48px;
  border-radius: 15px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand-text strong {
  color: #fff;
  font-size: 17px;
  letter-spacing: 0.02em;
}

.brand-text small {
  color: #64748b;
  font-size: 12px;
}

.nav {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.18s, color 0.18s;
}

.nav-link:hover {
  background: rgba(148, 163, 184, 0.08);
  color: #e2e8f0;
}

.nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.32), rgba(37, 99, 235, 0.07));
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.22);
}

.nav-link.active .icon {
  color: #60a5fa;
}

.sidebar-footer {
  position: relative;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.driver-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.13);
  border-radius: 14px;
  background: rgba(148, 163, 184, 0.06);
}

.driver-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 10px;
  color: #60a5fa;
  background: rgba(37, 99, 235, 0.18);
}

.driver-icon .icon {
  width: 18px;
  height: 18px;
}

.driver-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.driver-info span {
  color: #64748b;
  font-size: 10.5px;
}

.driver-info strong {
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
}

.driver-card .status-dot {
  margin-left: auto;
}

.logout-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #94a3b8;
  font-size: 13px;
  text-align: left;
  transition: background 0.18s, color 0.18s;
}

.logout-link:hover {
  background: rgba(148, 163, 184, 0.08);
  color: #fff;
}

.logout-link .icon {
  width: 17px;
  height: 17px;
}

.sidebar-copyright {
  margin: 0 4px;
  color: #475569;
  font-size: 11px;
}

/* ============================================================
   主区域
   ============================================================ */
.main {
  min-width: 0;
  margin-left: 248px;
  padding: 34px 40px 36px;
  max-width: 1560px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.eyebrow {
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.topbar h1 {
  margin: 6px 0 7px;
  font-size: 30px;
  letter-spacing: -0.02em;
}

.topbar p {
  margin: 0;
  color: #64748b;
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex: none;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.18s, box-shadow 0.18s, background 0.18s, border-color 0.18s;
}

.btn .icon {
  width: 17px;
  height: 17px;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.32);
}

.btn-ghost {
  color: #334155;
  background: #fff;
  border-color: var(--border-strong);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.btn-ghost:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-sm {
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 12.5px;
}

.btn-block {
  width: 100%;
  padding: 13px 18px;
  font-size: 14.5px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: none;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #fff;
  color: #64748b;
  transition: 0.18s;
}

.icon-btn:hover {
  color: var(--primary);
  border-color: #bfdbfe;
  background: var(--primary-soft);
}

.icon-btn.spinning .icon {
  animation: spin 0.7s linear infinite;
}

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

/* 统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.stat-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -40px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.06), transparent 70%);
  pointer-events: none;
}

.stat-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 14px;
}

.stat-icon .icon {
  width: 23px;
  height: 23px;
}

.stat-blue { color: #2563eb; background: #eff6ff; }
.stat-violet { color: #7c3aed; background: #f5f3ff; }
.stat-emerald { color: #059669; background: #ecfdf5; }

.stat-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.stat-label {
  color: #64748b;
  font-size: 12.5px;
}

.stat-value {
  color: var(--text);
  font-size: 24px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* 面板 */
.panel {
  margin-bottom: 22px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-panel);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel h2,
.files-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.panel p,
.files-head p {
  margin: 5px 0 0;
  color: #64748b;
  font-size: 13px;
}

.soft-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border-radius: 99px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* 上传区 */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 34px 24px;
  text-align: center;
  border: 1.5px dashed #bfdbfe;
  border-radius: 18px;
  background: linear-gradient(180deg, #f9fcff, #f2f7ff);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, transform 0.2s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: #3b82f6;
  background: linear-gradient(180deg, #f2f8ff, #e8f1ff);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.12);
}

.dropzone.dragover {
  transform: scale(1.004);
}

.dropzone-glow {
  position: absolute;
  top: -90px;
  left: 50%;
  width: 340px;
  height: 220px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(59, 130, 246, 0.16), transparent 70%);
  pointer-events: none;
}

.dropzone-icon {
  position: relative;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #fff;
  color: var(--primary);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.15);
}

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

.dropzone h3 {
  position: relative;
  margin: 8px 0 0;
  font-size: 16.5px;
}

.dropzone h3 span {
  color: var(--primary);
}

.dropzone p {
  position: relative;
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
}

.dropzone .btn {
  position: relative;
  margin-top: 10px;
}

/* 上传队列 */
.upload-queue {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #eef2f7;
}

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

.queue-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.queue-title strong {
  font-size: 14px;
}

.queue-title span {
  color: var(--muted);
  font-size: 12px;
}

.queue-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 330px;
  padding-right: 4px;
  overflow: auto;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #eef2f7;
  border-radius: 12px;
  background: #fbfdff;
}

.queue-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
}

.queue-icon .icon {
  width: 18px;
  height: 18px;
}

.queue-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.queue-name {
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-bar {
  height: 6px;
  border-radius: 99px;
  background: #e8eef7;
  overflow: hidden;
}

.queue-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
  transition: width 0.15s ease;
}

.queue-item.done .queue-bar span { background: #10b981; }
.queue-item.error .queue-bar span { background: #f43f5e; }

.queue-sub {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 11.5px;
}

.queue-status {
  min-width: 0;
  max-width: 82%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item.error .queue-status {
  color: var(--danger);
}

.queue-result {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.mini-btn .icon {
  width: 13px;
  height: 13px;
}

.mini-btn:hover {
  background: #dbeafe;
}

.mini-btn.danger {
  border-color: #fecdd3;
  background: #fff1f2;
  color: var(--danger);
}

/* 文件列表 */
.files-panel {
  padding-bottom: 16px;
}

.files-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.files-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-tabs {
  display: flex;
  gap: 2px;
  padding: 4px;
  border-radius: 11px;
  background: #f1f5f9;
}

.filter-tab {
  padding: 8px 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: 0.15s;
}

.filter-tab:hover {
  color: var(--text);
}

.filter-tab.active {
  color: var(--primary);
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-box:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.search-box .icon {
  width: 16px;
  height: 16px;
}

.search-box input {
  width: 160px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  min-height: 120px;
  transition: opacity 0.2s;
}

.file-grid[hidden] {
  display: none;
}

.file-grid.loading {
  opacity: 0.5;
  pointer-events: none;
}

.file-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  animation: cardIn 0.3s ease both;
}

.file-card:hover {
  transform: translateY(-3px);
  border-color: #dbeafe;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.09);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.file-preview {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  padding: 0;
  border: 0;
  background: #f1f5f9;
  overflow: hidden;
  cursor: pointer;
}

.file-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s;
}

.file-card:hover .file-preview img {
  transform: scale(1.035);
}

.kind-image { background: linear-gradient(135deg, #e0f2fe, #dbeafe); }
.kind-video { color: #6d28d9; background: linear-gradient(135deg, #ede9fe, #e0e7ff); }
.kind-audio { color: #be185d; background: linear-gradient(135deg, #fce7f3, #fae8ff); }
.kind-doc { color: #047857; background: linear-gradient(135deg, #ecfdf5, #d1fae5); }
.kind-other { color: #475569; background: linear-gradient(135deg, #f1f5f9, #e2e8f0); }

.preview-icon {
  height: 100%;
  display: grid;
  place-items: center;
}

.preview-icon .icon {
  width: 42px;
  height: 42px;
  stroke-width: 1.4;
  opacity: 0.9;
}

.ext-badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.62);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  backdrop-filter: blur(4px);
}

.preview-hover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.42);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.18s;
}

.preview-hover .icon {
  width: 17px;
  height: 17px;
}

.file-preview:hover .preview-hover {
  opacity: 1;
}

.file-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  padding: 13px 14px 14px;
}

.file-name {
  margin: 0;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
}

.meta-dot {
  width: 3px;
  height: 3px;
  flex: none;
  border-radius: 50%;
  background: #cbd5e1;
}

.file-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 1;
  padding: 7px 9px;
  border: 1px solid #e8eef7;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 600;
  transition: 0.15s;
}

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

.chip-btn:hover {
  border-color: #bfdbfe;
  background: var(--primary-soft);
  color: var(--primary);
}

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

/* 骨架屏 */
.skeleton-card {
  padding: 12px;
  border: 1px solid #eef2f7;
  border-radius: 16px;
  background: #fff;
}

.skeleton-preview,
.skeleton-line {
  background: linear-gradient(90deg, #eef2f7 25%, #f7f9fc 50%, #eef2f7 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

.skeleton-preview {
  aspect-ratio: 16 / 10;
  border-radius: 10px;
}

.skeleton-line {
  width: 60%;
  height: 10px;
  margin-top: 10px;
  border-radius: 6px;
}

.skeleton-line.wide {
  width: 85%;
}

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

/* 空状态 */
.empty-state {
  padding: 52px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 20px;
  background: var(--primary-soft);
  color: var(--primary-light);
}

.empty-icon .icon {
  width: 30px;
  height: 30px;
}

.empty-state h3 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 16px;
}

.empty-state p {
  margin: 0;
  font-size: 13px;
}

/* 分页 */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px 0 6px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 600;
  transition: 0.15s;
}

.page-btn:hover:not(:disabled) {
  border-color: #bfdbfe;
  background: var(--primary-soft);
  color: var(--primary);
}

.page-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-btn .icon {
  width: 15px;
  height: 15px;
}

.page-ellipsis {
  padding: 0 3px;
  color: var(--muted);
  font-size: 12px;
}

.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 4px 0;
  color: var(--muted);
  font-size: 11.5px;
}

.page-footer code {
  padding: 2px 6px;
  border-radius: 5px;
  background: #eef2f7;
  color: var(--text-soft);
}

/* ============================================================
   预览弹窗
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 15, 30, 0.64);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.18s ease;
}

.modal-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(860px, 100%);
  max-height: 90vh;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(2, 6, 23, 0.35);
  overflow: hidden;
  animation: modalIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid #eef2f7;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.kind-chip {
  flex: none;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.modal-title-wrap h3 {
  margin: 0;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  max-height: 64vh;
  background: #0b1220;
  overflow: auto;
}

.preview-body img,
.preview-body video {
  max-width: 100%;
  max-height: 64vh;
  object-fit: contain;
}

.preview-body iframe {
  width: 100%;
  height: 64vh;
  border: 0;
  background: #fff;
}

.audio-preview {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 48px 24px;
  color: #93c5fd;
}

.audio-preview .icon {
  width: 56px;
  height: 56px;
}

.audio-preview audio {
  width: min(520px, 100%);
}

.audio-fallback {
  color: #94a3b8;
  font-size: 12px;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-top: 1px solid #eef2f7;
}

.preview-meta {
  color: var(--muted);
  font-size: 12px;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

body.modal-open {
  overflow: hidden;
}

/* ============================================================
   提示
   ============================================================ */
.toast-container {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 14px 34px rgba(2, 6, 23, 0.3);
  animation: toastIn 0.25s ease;
}

.toast .icon {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: #4ade80;
}

.toast.error .icon {
  color: #fb7185;
}

.toast.leaving {
  animation: toastOut 0.2s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(8px); }
}

/* ============================================================
   登录页
   ============================================================ */
.login-page {
  min-height: 100vh;
  background: #070d1a;
  overflow: hidden;
}

.login-bg {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  background:
    radial-gradient(900px 500px at 15% 0%, rgba(37, 99, 235, 0.35), transparent 60%),
    radial-gradient(700px 500px at 90% 100%, rgba(124, 58, 237, 0.25), transparent 60%),
    linear-gradient(180deg, #070d1a, #0b1424 55%, #070d1a);
}

.login-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(circle at 50% 40%, #000, transparent 75%);
  mask-image: radial-gradient(circle at 50% 40%, #000, transparent 75%);
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  animation: float 9s ease-in-out infinite;
}

.orb-1 {
  width: 320px;
  height: 320px;
  left: 8%;
  top: 12%;
  background: #2563eb;
}

.orb-2 {
  width: 260px;
  height: 260px;
  right: 10%;
  bottom: 14%;
  background: #7c3aed;
  animation-delay: -4s;
}

@keyframes float {
  50% { transform: translateY(-22px); }
}

.login-card {
  position: relative;
  width: min(420px, 100%);
  padding: 34px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 24px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px rgba(2, 6, 23, 0.5);
  animation: modalIn 0.35s ease;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.login-brand strong {
  display: block;
  color: #fff;
  font-size: 16px;
}

.login-brand small {
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-size: 12px;
}

.login-card h1 {
  margin: 0 0 8px;
  color: #fff;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.login-desc {
  margin: 0 0 22px;
  color: #94a3b8;
  font-size: 13.5px;
  line-height: 1.6;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-form label {
  color: #cbd5e1;
  font-size: 12.5px;
  font-weight: 500;
}

.password-field {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.5);
  color: #64748b;
  transition: 0.2s;
}

.password-field:focus-within {
  border-color: #3b82f6;
  color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.password-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font-size: 14px;
}

.password-field input::placeholder {
  color: #475569;
}

.login-form .btn {
  margin-top: 8px;
}

.login-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  color: #64748b;
  font-size: 11.5px;
}

.login-copyright {
  position: relative;
  margin: 22px 0 0;
  color: #475569;
  font-size: 11.5px;
  text-align: center;
}

.alert {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 16px;
  padding: 11px 13px;
  border-radius: 11px;
  font-size: 12.5px;
}

.alert .icon {
  width: 17px;
  height: 17px;
}

.alert-error {
  border: 1px solid rgba(244, 63, 94, 0.28);
  background: rgba(244, 63, 94, 0.12);
  color: #fda4af;
}

/* ============================================================
   API 文档
   ============================================================ */
.docs-main {
  max-width: 1440px;
}

.docs-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.docs-toc {
  position: sticky;
  top: 28px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
}

.toc-title {
  padding: 0 10px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.docs-toc a {
  padding: 8px 10px;
  border-radius: 8px;
  color: #64748b;
  font-size: 12.5px;
  transition: 0.15s;
}

.docs-toc a:hover {
  background: #f1f5f9;
  color: var(--primary);
}

.docs-toc a.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.docs-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.doc-intro,
.doc-card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.035);
}

.doc-intro-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.doc-intro h2,
.doc-card h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.doc-badge {
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.doc-card p {
  margin: 0 0 14px;
  color: var(--text-soft);
  font-size: 13.5px;
  line-height: 1.75;
}

.doc-card p:last-child {
  margin-bottom: 0;
}

.doc-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.doc-card-head .soft-badge {
  margin-left: auto;
}

.method {
  padding: 5px 8px;
  border-radius: 6px;
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.method-get { background: #059669; }
.method-post { background: #2563eb; }
.method-delete { background: #e11d48; }

.endpoint {
  padding: 5px 10px;
  border-radius: 7px;
  background: #f1f5f9;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.inline-code {
  padding: 2px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f1f5f9;
  color: #1e293b;
  font-size: 12.5px;
  word-break: break-all;
}

.doc-note {
  padding: 11px 14px;
  border: 1px solid #fde68a;
  border-radius: 10px;
  background: #fffbeb;
  color: #92400e !important;
  font-size: 12.5px !important;
}

.param-table {
  margin: 14px 0 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.param-row {
  display: grid;
  grid-template-columns: 1.1fr 0.7fr 2.2fr;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid #eef2f7;
  color: var(--text-soft);
  font-size: 12.5px;
}

.param-row:first-child {
  border-top: 0;
}

.param-head {
  background: #f8fafc;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.param-row code {
  color: var(--primary);
  font-size: 12px;
}

.error-table .param-row {
  grid-template-columns: 0.6fr 2.4fr;
}

.code-block {
  margin: 14px 0;
  border: 1px solid #1e293b;
  border-radius: 12px;
  background: #0b1220;
  overflow: hidden;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-bottom: 1px solid #1e293b;
  background: #111c2f;
  color: #64748b;
  font-size: 11px;
  letter-spacing: 0.05em;
}

.copy-code {
  padding: 3px 7px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #94a3b8;
  font-size: 11px;
}

.copy-code:hover {
  background: #1e293b;
  color: #e2e8f0;
}

.code-block pre {
  margin: 0;
  padding: 16px;
  max-height: 420px;
  overflow: auto;
}

.code-block code {
  color: #cbd5e1;
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre;
}

.type-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.type-group {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #eef2f7;
  border-radius: 10px;
  background: #f8fafc;
}

.type-group span {
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 700;
}

.type-group p {
  margin: 0;
  color: #64748b;
  font-size: 12.5px;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1180px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }

  .docs-toc {
    display: none;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    position: static;
    width: auto;
    flex-direction: row;
    align-items: center;
    gap: 18px;
    padding: 14px 22px;
    border-right: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    overflow: visible;
  }

  .sidebar::before {
    display: none;
  }

  .brand-text small {
    display: none;
  }

  .nav {
    flex-direction: row;
    margin-left: 12px;
  }

  .nav-link {
    padding: 9px 12px;
  }

  .sidebar-footer {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin: 0 0 0 auto;
  }

  .driver-card,
  .sidebar-copyright {
    display: none;
  }

  .logout-link {
    padding: 8px 10px;
  }

  .logout-link span {
    display: none;
  }

  .main {
    margin-left: 0;
    padding: 26px 22px 32px;
  }
}

@media (max-width: 760px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .btn {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 16px 18px;
  }

  .panel {
    padding: 18px;
    border-radius: 16px;
  }

  .files-head {
    flex-direction: column;
  }

  .files-tools {
    width: 100%;
  }

  .filter-tabs {
    width: 100%;
    overflow-x: auto;
  }

  .search-box {
    flex: 1;
  }

  .search-box input {
    width: 100%;
  }

  .file-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }

  .file-actions {
    flex-direction: column;
  }

  .modal {
    padding: 12px;
  }

  .modal-foot {
    align-items: flex-start;
  }

  .modal-actions {
    width: 100%;
  }

  .modal-actions .btn {
    flex: 1;
  }
}

@media (max-width: 520px) {
  .sidebar {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
  }

  .brand-text strong {
    font-size: 15px;
  }

  .nav {
    margin-left: 0;
  }

  .nav-link {
    padding: 9px 10px;
  }

  .nav-link span {
    display: none;
  }

  .main {
    padding: 20px 14px 28px;
  }

  .topbar h1 {
    font-size: 24px;
  }

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

  .file-preview {
    aspect-ratio: 4 / 3;
  }

  .param-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .param-head {
    display: none;
  }

  .type-group {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
