:root {
  --bg-1: #f4f6f9;
  --bg-2: #eef2f6;
  --card: #ffffff;
  --line: #dce3eb;
  --text: #121925;
  --text-soft: #5a677a;
  --accent: #1f2937;
  --accent-strong: #111827;
  --danger: #dc2626;
  --ok: #15803d;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 520px at 10% -10%, rgba(148, 163, 184, 0.16), transparent 60%),
    radial-gradient(900px 520px at 100% 0%, rgba(203, 213, 225, 0.22), transparent 58%),
    linear-gradient(145deg, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
}

a {
  color: var(--accent);
}

.app-bg {
  width: min(1200px, 100% - 32px);
  margin: 16px auto 32px;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  position: sticky;
  top: 10px;
  z-index: 10;
  backdrop-filter: blur(6px);
}

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

.brand-group h1 {
  margin: 0;
  font-size: 20px;
}

.brand-group p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-soft);
}

.brand-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1f2937, #4b5563);
  box-shadow: 0 0 0 4px rgba(17, 24, 39, 0.08);
}

.nav-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-link {
  color: var(--text-soft);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
}

.nav-link.router-link-active,
.nav-link:hover {
  color: var(--text);
  border-color: var(--line);
  background: #f8fafc;
}

.page-wrap {
  margin-top: 16px;
}

.panel {
  padding: 20px;
}

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

.panel h2 {
  margin: 0;
  font-size: 22px;
}

h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.muted {
  color: var(--text-soft);
  margin: 0;
}

.error {
  color: var(--danger);
  margin-top: 12px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #f9fafb;
  font-weight: 600;
  cursor: pointer;
}

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

.btn-ghost {
  background: #f8fafc;
  color: var(--text);
  border-color: var(--line);
}

.btn-danger {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

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

.form-grid label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--text-soft);
}

input,
select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  padding: 10px 12px;
}

textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  padding: 10px 12px;
  resize: vertical;
}

.toggle-row {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text-soft);
}

.toggle-row label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-page {
  min-height: 90vh;
  display: grid;
  place-items: center;
}

.login-card {
  width: min(420px, 100%);
  padding: 24px;
}

.login-card h1 {
  margin: 0 0 8px;
}

.link-row {
  margin-top: 12px;
}

.guest-note {
  margin-top: 12px;
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.storage-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--text);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.chip.active {
  background: #e5e7eb;
  border-color: #9ca3af;
}

.chip.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dropzone {
  margin: 14px 0;
  border: 2px dashed #cbd5e1;
  border-radius: 16px;
  min-height: 170px;
  display: grid;
  place-items: center;
  text-align: center;
  cursor: pointer;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.dropzone.active,
.dropzone:hover {
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.dropzone-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.url-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 14px;
}

.list-wrap {
  margin-top: 16px;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.list-item,
.result-item,
.storage-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #ffffff;
}

.list-title,
.list-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.progress-track {
  margin: 8px 0;
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: rgba(126, 166, 255, 0.14);
  overflow: hidden;
}

.progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, #86f4cf, #7ea6ff);
}

.result-item,
.storage-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.result-actions,
.storage-actions,
.table-actions,
.form-actions,
.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.table-wrap {
  overflow: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 10px 8px;
  vertical-align: top;
}

.preview-cell {
  width: 68px;
  height: 52px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--text-soft);
  text-decoration: none;
}

.preview-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-col {
  display: grid;
  gap: 2px;
}

.file-col small {
  color: var(--text-soft);
}

.badge {
  display: inline-block;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 3px 8px;
  font-size: 12px;
  color: #475569;
}

.badge-danger {
  border-color: #fecaca;
  color: #991b1b;
}

.badge-ok {
  border-color: #bbf7d0;
  color: #166534;
}

.empty {
  text-align: center;
  color: var(--text-soft);
}

.footer-actions {
  margin-top: 12px;
}

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

.stat-tile {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 6px;
  background: #ffffff;
}

.stat-tile span {
  color: var(--text-soft);
  font-size: 12px;
}

.stat-tile strong {
  font-size: 22px;
}

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

.storage-list,
.storage-form {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #ffffff;
}

.card-lite {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #ffffff;
}

.storage-panel {
  display: grid;
  gap: 14px;
}

.storage-head {
  margin-bottom: 0;
}

.storage-layout {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(340px, 1fr);
  gap: 14px;
}

.storage-listing {
  gap: 10px;
}

.storage-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 10px;
}

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

.storage-row-top strong {
  margin-right: 4px;
}

.storage-row-main {
  display: grid;
  gap: 6px;
}

.storage-test {
  font-size: 12px;
  margin: 0;
}

.storage-test.ok {
  color: var(--ok);
}

.storage-test.fail {
  color: var(--danger);
}

.storage-editor {
  display: grid;
  gap: 12px;
  align-content: start;
}

.field-grid {
  display: grid;
  gap: 10px;
}

.field-grid label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--text-soft);
}

.test-detail {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #f8fafc;
  display: grid;
  gap: 8px;
}

.test-detail.ok {
  border-color: #bbf7d0;
}

.test-detail.fail {
  border-color: #fecaca;
}

.test-detail pre {
  margin: 0;
  padding: 10px;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  max-height: 220px;
  overflow: auto;
  font-size: 12px;
}

.drive-panel {
  display: grid;
  gap: 14px;
}

.drive-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.adapter-visibility {
  display: grid;
  gap: 10px;
}

.adapter-visibility-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.adapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.adapter-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 6px;
  background: #ffffff;
  cursor: pointer;
}

.adapter-card.active {
  border-color: #94a3b8;
  box-shadow: inset 0 0 0 1px #cbd5e1;
}

.adapter-card.unavailable {
  opacity: 0.85;
}

.adapter-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.adapter-status {
  margin: 0;
  font-size: 12px;
}

.adapter-status.ok {
  color: var(--ok);
}

.adapter-status.warn {
  color: #d97706;
}

.adapter-status.fail {
  color: var(--danger);
}

.adapter-hint {
  margin: 0;
  font-size: 12px;
  color: var(--text-soft);
}

.drive-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  padding: 22px 14px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.drive-dropzone:hover,
.drive-dropzone.active {
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.drive-layout {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  gap: 12px;
}

.folder-tree {
  display: grid;
  gap: 10px;
  max-height: 680px;
  overflow: auto;
  align-content: start;
}

.folder-tree-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tree-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 3px;
}

.tree-item {
  border-radius: 8px;
}

.tree-item.active {
  background: #f1f5f9;
}

.tree-link {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 0;
  background: transparent;
  padding: 8px 8px;
  text-align: left;
  cursor: pointer;
  color: var(--text);
}

.tree-link small {
  color: var(--text-soft);
}

.drive-main {
  display: grid;
  gap: 10px;
}

.drive-toolbar {
  display: grid;
  gap: 10px;
}

.breadcrumbs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.crumb {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
}

.folder-inline-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.folder-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 8px;
  background: #ffffff;
}

.folder-open {
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 4px;
  color: var(--text);
}

.folder-open small {
  color: var(--text-soft);
}

.folder-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

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

.file-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 8px;
  background: #ffffff;
}

.file-check {
  justify-self: start;
}

.file-preview {
  width: 100%;
  min-height: 120px;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  text-decoration: none;
  color: var(--text-soft);
  overflow: hidden;
}

.file-preview img {
  width: 100%;
  height: 120px;
  object-fit: cover;
}

.file-name {
  word-break: break-all;
}

.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-panel {
  display: grid;
  gap: 12px;
}

.diagnostic-card {
  display: grid;
  gap: 8px;
}

.diag-list,
.diag-steps {
  margin: 0;
  padding-left: 18px;
  color: var(--text-soft);
  display: grid;
  gap: 4px;
}

@media (max-width: 960px) {
  .app-bg {
    width: calc(100% - 20px);
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .url-row {
    grid-template-columns: 1fr;
  }

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

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

  .storage-layout {
    grid-template-columns: 1fr;
  }

  .drive-layout {
    grid-template-columns: 1fr;
  }

  .folder-tree {
    max-height: 260px;
  }

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