:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #182033;
  --muted: #657089;
  --line: #dfe5ef;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --success: #16a34a;
  --danger: #dc2626;
  --shadow: 0 14px 34px rgba(29, 41, 57, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(79, 70, 229, 0.16), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.12), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 14px;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1100px, calc(100% - 24px));
  margin: 0 auto;
  padding: 24px 0;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(28px, 5vw, 48px);
  line-height: 0.95;
  letter-spacing: -0.06em;
}

h2 {
  margin-bottom: 0;
}

.subtitle {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.status-card {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 180px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  white-space: nowrap;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.12);
}

.auth-card {
  max-width: 460px;
  padding: 18px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 14px;
  padding: 5px;
  border-radius: 13px;
  background: #eef2ff;
}

.tab {
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  font-weight: 700;
}

.tab.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: 0 10px 24px rgba(79, 70, 229, 0.12);
}

.form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  padding: 8px 10px;
  color: var(--text);
  background: #fff;
}

textarea {
  width: 100%;
  min-height: 100px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  padding: 8px 10px;
  color: var(--text);
  background: #fff;
  font: inherit;
  line-height: 1.5;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.primary,
.ghost,
.danger {
  border: 0;
  border-radius: 10px;
  padding: 8px 11px;
  font-weight: 800;
  font-size: 13px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

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

.primary:hover {
  background: var(--primary-dark);
}

.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.danger {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
}

.app-grid {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 14px;
}

.profile-card,
.workspace-card {
  padding: 16px;
}

.profile-card {
  align-self: start;
}

.workspace-card {
  grid-column: 2;
}

.profile-card .ghost {
  width: 100%;
  margin-top: 8px;
}

.profile-line {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.profile-line span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.profile-line strong {
  overflow-wrap: anywhere;
  font-size: 16px;
}

.bili-badge {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--success);
  background: rgba(22, 163, 74, 0.1);
  font-size: 12px;
  font-weight: 800;
}

.bili-badge.warning {
  color: #b45309;
  background: rgba(245, 158, 11, 0.14);
}

.help-text {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

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

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

.workspace-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 6px;
  margin-bottom: 16px;
  padding: 5px;
  border-radius: 13px;
  background: #eef2ff;
}

.workspace-tab {
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  font-weight: 800;
}

.workspace-tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 12px 26px rgba(79, 70, 229, 0.12);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.drop-zone {
  display: grid;
  place-items: center;
  width: 820px;
  height: 500px;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border: 2px dashed #b6c2d9;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(14, 165, 233, 0.08));
  color: var(--muted);
  text-align: center;
  transition: 0.2s ease;
}

.drop-zone.dragover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(79, 70, 229, 0.16);
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 10px;
  border-radius: 18px;
  background: var(--primary);
  color: #fff;
  font-size: 38px;
  line-height: 1;
}

.drop-zone p {
  margin-bottom: 6px;
  color: var(--text);
  font-weight: 800;
}

.progress {
  height: 8px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.progress div {
  width: 40%;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  animation: loading 1s ease-in-out infinite alternate;
}

@keyframes loading {
  from {
    transform: translateX(-80%);
  }
  to {
    transform: translateX(260%);
  }
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-input {
  width: min(320px, 46vw);
}

.image-list {
  display: grid;
  gap: 8px;
}

.image-list.empty {
  display: block;
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.image-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  transition: 0.2s ease;
}

.image-row:hover {
  border-color: rgba(79, 70, 229, 0.35);
  box-shadow: 0 14px 34px rgba(29, 41, 57, 0.08);
  transform: translateY(-1px);
}

.image-thumb {
  display: block;
  width: 74px;
  height: 54px;
  object-fit: cover;
  border-radius: 9px;
  background: #eef2ff;
}

.image-info {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.image-name {
  overflow: hidden;
  margin: 0;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-url {
  overflow: hidden;
  margin: 0;
  color: var(--primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-meta {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.image-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.image-actions button,
.image-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 66px;
  border-radius: 9px;
  padding: 7px 9px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
}

.image-actions a {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-weight: 800;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.summary-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.summary-item strong {
  display: block;
  margin-bottom: 6px;
  font-size: 20px;
}

.summary-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.admin-setting h3,
.admin-columns h3 {
  margin: 0 0 8px;
}

.switch {
  display: inline-flex;
  align-items: center;
}

.switch input {
  display: none;
}

.switch span {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: 0.2s ease;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: 0.2s ease;
}

.switch input:checked + span {
  background: var(--primary);
}

.switch input:checked + span::after {
  transform: translateX(22px);
}

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

.admin-list {
  display: grid;
  gap: 8px;
}

#uploadLogs {
  max-height: 430px;
  overflow-y: auto;
  padding-right: 4px;
}

.admin-list-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.admin-list-title h3 {
  margin: 0;
}

.admin-row {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.admin-row-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  font-weight: 800;
}

.admin-row p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.log-row .admin-row-title span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--primary);
  font-size: 12px;
}

.badge.danger {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  max-width: 360px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #111827;
  color: #fff;
  box-shadow: var(--shadow);
}


.hidden {
  display: none !important;
}

@media (max-width: 840px) {
  .hero,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-grid {
    grid-template-columns: 1fr;
  }

  .workspace-card {
    grid-column: auto;
  }

  .workspace-tabs {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .drop-zone {
    width: 100%;
    height: auto;
    min-height: min(460px, calc(100vw - 48px));
  }

  .search-input {
    width: 100%;
  }

  .image-row {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .image-thumb {
    width: 76px;
    height: 60px;
  }

  .image-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .summary-grid,
  .admin-columns {
    grid-template-columns: 1fr;
  }
}
