:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --panel: #ffffff;
  --panel-soft: #f0f4f8;
  --line: #d8e0ea;
  --text: #17212f;
  --muted: #697586;
  --brand: #246bfe;
  --brand-dark: #164fc6;
  --accent: #18a77d;
  --danger: #d94c4c;
  --shadow: 0 18px 60px rgba(22, 37, 66, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  min-height: 100vh;
}

.is-hidden {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 20px;
  background:
    linear-gradient(120deg, rgba(36, 107, 254, 0.08), transparent 44%),
    linear-gradient(240deg, rgba(24, 167, 125, 0.1), transparent 42%),
    #f8fafc;
}

.brand-mark,
.small-mark {
  display: grid;
  place-items: center;
  background: var(--brand);
  color: white;
  font-weight: 800;
}

.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  font-size: 28px;
  box-shadow: 0 12px 36px rgba(22, 37, 66, 0.12);
}

.login-view h1 {
  margin: 12px 0 0;
  font-size: 32px;
  line-height: 1;
}

.login-subtitle {
  margin: 6px 0 18px;
  color: var(--muted);
}

.login-panel {
  width: min(320px, 100%);
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid rgba(216, 224, 234, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.login-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.login-panel input,
.search-wrap input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  outline: none;
  color: var(--text);
  background: white;
}

.login-panel input {
  height: 36px;
  border-radius: 8px;
  padding: 0 10px;
}

.login-panel input:focus,
.search-wrap:focus-within,
.drop-zone.is-dragging {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(36, 107, 254, 0.14);
}

.primary-button,
.ghost-button,
.new-group,
.text-button,
.icon-button,
.close-button {
  border: 0;
  border-radius: 8px;
}

.primary-button {
  height: 36px;
  background: var(--brand);
  color: white;
  font-weight: 700;
}

.primary-button:hover,
.ghost-button:hover {
  background: var(--brand-dark);
}

.form-tip {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.drive-view {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 48px 1fr;
}

.topbar {
  display: grid;
  grid-template-columns: 144px minmax(160px, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.topbar-brand,
.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
}

.small-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  font-size: 13px;
}

.search-wrap {
  height: 32px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.search-wrap span {
  color: var(--muted);
}

.search-wrap input {
  border: 0;
}

.ghost-button {
  height: 32px;
  padding: 0 12px;
  background: var(--brand);
  color: white;
  font-weight: 700;
}

.avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e6f4ef;
  color: #0d7d5e;
  font-weight: 800;
}

.text-button {
  color: var(--muted);
  background: transparent;
}

.text-button:hover {
  color: var(--brand);
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 10px;
  border-right: 1px solid var(--line);
  background: #fbfcfe;
}

.sidebar-title {
  padding: 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.group-list {
  display: grid;
  gap: 3px;
}

.group-item {
  width: 100%;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.group-item:hover,
.group-item.is-active {
  color: var(--text);
  background: #eef4ff;
}

.group-icon {
  width: 18px;
  color: var(--brand);
  text-align: center;
}

.new-group {
  height: 32px;
  border: 1px dashed #a9b8cc;
  color: var(--brand);
  background: transparent;
  font-weight: 700;
}

.task-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.task-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.task-head .text-button {
  padding: 0;
  font-size: 12px;
}

.task-list {
  min-height: 92px;
  max-height: 34vh;
  display: grid;
  align-content: start;
  gap: 6px;
  overflow: auto;
}

.task-empty {
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.task-item {
  display: grid;
  gap: 5px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.task-title,
.task-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.task-title strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-title span,
.task-meta,
.task-file {
  color: var(--muted);
  font-size: 11px;
}

.task-item.is-running .task-title span {
  color: var(--brand);
}

.task-item.is-done .task-title span {
  color: var(--accent);
}

.task-item.is-canceled .task-title span {
  color: var(--danger);
}

.task-progress {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef7;
}

.task-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transition: width 180ms ease;
}

.task-file {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-area {
  min-width: 0;
  padding: 14px;
  overflow: auto;
}

.crumb-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

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

.file-area h2 {
  margin: 3px 0 0;
  font-size: 20px;
}

.view-actions {
  display: flex;
  gap: 5px;
}

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

.bulk-button {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: white;
}

.bulk-button:disabled {
  cursor: not-allowed;
  color: #a7b0be;
  background: #f6f8fb;
}

.icon-button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  background: white;
}

.icon-button.is-active {
  color: var(--brand);
  border-color: var(--brand);
}

.drop-zone {
  position: relative;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px dashed #a9b8cc;
  border-radius: 8px;
  background: white;
}

.drop-zone::before {
  content: "↑";
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #edf7ff;
  color: var(--brand);
  font-size: 17px;
  font-weight: 800;
}

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-zone div {
  display: grid;
  gap: 2px;
}

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

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

.file-grid.is-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.file-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.file-card:has(.select-box input:checked) {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px rgba(36, 107, 254, 0.2);
}

.select-box {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  width: 20px;
  height: 20px;
}

.select-box input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.select-box span {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid #b8c3d2;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.select-box input:checked + span {
  border-color: var(--brand);
  background: var(--brand);
}

.select-box input:checked + span::after {
  content: "✓";
  color: white;
  font-size: 13px;
  font-weight: 800;
}

.select-box input:disabled + span {
  cursor: not-allowed;
  opacity: 0.45;
}

.file-card.is-uploading {
  border-color: rgba(36, 107, 254, 0.38);
  box-shadow: inset 0 0 0 1px rgba(36, 107, 254, 0.08);
}

.file-grid.is-list .file-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  min-height: 64px;
}

.file-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background: var(--panel-soft);
  color: var(--muted);
  overflow: hidden;
}

.file-grid.is-list .file-thumb {
  width: 56px;
  height: 56px;
  aspect-ratio: auto;
  border-radius: 0;
}

.sample-thumb {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 10px;
  color: white;
  text-align: center;
  background: #42526e;
}

.sample-thumb.white {
  color: #17212f;
  background:
    linear-gradient(90deg, transparent 31px, rgba(36, 107, 254, 0.16) 32px),
    linear-gradient(transparent 31px, rgba(36, 107, 254, 0.16) 32px),
    #ffffff;
  background-size: 32px 32px;
}

.sample-thumb.detail {
  background:
    linear-gradient(135deg, rgba(24, 167, 125, 0.78), rgba(36, 107, 254, 0.78)),
    #246bfe;
}

.sample-thumb span {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 800;
}

.file-thumb img,
.file-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-badge {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--text);
  color: white;
  font-size: 18px;
}

.file-info {
  display: grid;
  gap: 5px;
  padding: 8px;
}

.file-grid.is-list .file-info {
  grid-template-columns: minmax(0, 1.5fr) minmax(120px, 0.8fr) 168px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  font-size: 13px;
}

.file-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  flex-wrap: wrap;
}

.upload-status {
  display: grid;
  gap: 4px;
}

.upload-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--brand);
  font-size: 11px;
}

.upload-row strong {
  font-size: 11px;
}

.progress-track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef7;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  transition: width 180ms ease;
}

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

.file-grid.is-list .file-actions {
  justify-self: end;
  width: 168px;
}

.file-actions button,
.file-actions a {
  flex: 1;
  min-height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: white;
  text-decoration: none;
  font-size: 12px;
}

.file-actions .danger-button {
  color: var(--danger);
}

.file-card.is-uploading .file-actions {
  justify-content: flex-end;
}

.file-card.is-uploading .danger-button {
  flex: 0 0 auto;
  min-width: 54px;
}

.empty-state {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: white;
  text-align: center;
}

.preview {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 20, 32, 0.72);
}

.preview-panel {
  position: relative;
  width: min(920px, 100%);
  max-height: 90vh;
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 8px;
  background: white;
}

.close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  background: rgba(23, 33, 47, 0.82);
  color: white;
  font-size: 24px;
}

#previewBody {
  min-height: 280px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #0d1522;
}

#previewBody img,
#previewBody video {
  max-width: 100%;
  max-height: 72vh;
}

.preview-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.preview-meta a {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

@media (max-width: 820px) {
  body {
    font-size: 13px;
  }

  .drive-view {
    grid-template-rows: auto 1fr;
  }

  .topbar {
    grid-template-columns: auto 1fr auto auto;
    height: auto;
    gap: 8px;
    padding: 8px;
  }

  .topbar-brand {
    min-width: 0;
  }

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

  .search-wrap {
    grid-column: 1 / -1;
    order: 3;
    height: 30px;
  }

  .ghost-button {
    height: 30px;
    padding: 0 10px;
  }

  .avatar {
    width: 26px;
    height: 26px;
  }

  .text-button {
    padding: 0;
  }

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

  .sidebar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px;
    overflow: hidden;
  }

  .group-list {
    display: flex;
    gap: 5px;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .group-list::-webkit-scrollbar {
    display: none;
  }

  .group-item {
    width: auto;
    flex: 0 0 auto;
    height: 30px;
    padding: 0 9px;
    white-space: nowrap;
  }

  .group-icon {
    width: auto;
  }

  .new-group {
    height: 30px;
    margin-top: 0;
    padding: 0 8px;
    white-space: nowrap;
  }

  .task-panel {
    grid-column: 1 / -1;
    margin-top: 0;
    padding-top: 8px;
  }

  .task-list {
    max-height: 138px;
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 1fr);
    overflow-x: auto;
    overflow-y: hidden;
  }

  .file-area {
    padding: 10px;
  }

  .crumb-row {
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
  }

  .toolbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .crumb {
    display: none;
  }

  .file-area h2 {
    font-size: 18px;
  }

  .drop-zone {
    min-height: 42px;
    margin: 8px 0;
    padding: 8px 10px;
  }

  .drop-zone::before {
    width: 26px;
    height: 26px;
  }

  .drop-zone span {
    display: none;
  }

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

  .file-grid.is-list .file-card {
    grid-template-columns: 46px minmax(0, 1fr);
    min-height: 54px;
  }

  .file-grid.is-list .file-thumb {
    width: 46px;
    height: 46px;
  }

  .file-grid.is-list .file-info {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    padding: 6px 8px;
  }

  .file-grid.is-list .file-meta {
    display: none;
  }

  .file-grid.is-list .file-actions {
    width: 116px;
  }

  .file-grid.is-list .file-actions button[data-preview] {
    display: none;
  }

  .file-actions a {
    min-height: 24px;
  }
}

@media (max-width: 420px) {
  .small-mark {
    width: 24px;
    height: 24px;
  }

  .topbar {
    grid-template-columns: auto 1fr auto;
  }

  .topbar-brand strong {
    display: none;
  }

  .user-menu {
    gap: 5px;
  }

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

  .sidebar-title {
    display: none;
  }

  .sidebar {
    grid-template-columns: 1fr auto;
  }
}
