:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f7fb;
  color: #1d2733;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: #2364d2;
  color: white;
  padding: 10px 14px;
  cursor: pointer;
}

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

input {
  width: 100%;
  border: 1px solid #d7deea;
  border-radius: 8px;
  padding: 11px 12px;
  background: white;
  color: #1d2733;
}

.hidden {
  display: none !important;
}

.login,
.share {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #f6f8fb, #e9eef7);
}

.login-panel,
.share-panel {
  width: min(420px, 100%);
  background: white;
  border: 1px solid #e1e6ef;
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 60px rgba(38, 54, 77, 0.12);
}

.share-panel {
  width: min(760px, 100%);
}

.login-panel h1,
.share-panel h1 {
  margin: 0 0 22px;
  font-size: 28px;
}

.login-panel button {
  width: 100%;
  margin-top: 12px;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: #4c5c70;
  cursor: pointer;
  user-select: none;
}

.remember-row input {
  width: 16px;
  height: 16px;
  padding: 0;
  cursor: pointer;
}

#loginError {
  min-height: 20px;
  color: #c3362b;
}

.shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid #e1e6ef;
  backdrop-filter: blur(12px);
}

.topbar strong {
  display: block;
  font-size: 18px;
}

#breadcrumb {
  margin-top: 4px;
  font-size: 13px;
  color: #657386;
}

.ghost,
.secondary,
.icon-btn {
  background: #eef3fb;
  color: #29435f;
}

.workspace {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
  padding: 18px;
}

.panel {
  background: white;
  border: 1px solid #e1e6ef;
  border-radius: 8px;
}

.upload-panel {
  align-self: start;
  padding: 16px;
}

.upload-drop {
  display: grid;
  place-items: center;
  min-height: 132px;
  border: 1px dashed #9eb2d0;
  border-radius: 8px;
  color: #29435f;
  background: #f8fbff;
  cursor: pointer;
  text-align: center;
}

.upload-drop.dragging {
  border-color: #2364d2;
  background: #edf5ff;
  color: #1d4fa5;
}

.upload-drop input {
  display: none;
}

.upload-panel .secondary {
  width: 100%;
  margin-top: 12px;
}

.queue {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.queue-item {
  font-size: 13px;
  color: #4c5c70;
}

.queue-item small {
  display: block;
  margin-top: 5px;
  color: #657386;
}

.queue-item.failed {
  color: #b3261e;
}

.queue-item.failed small {
  color: #b3261e;
}

.progress {
  height: 7px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6ebf2;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: #18a058;
}

.file-panel {
  min-width: 0;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid #e1e6ef;
}

.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 18px;
}

#pathText {
  overflow: hidden;
  color: #657386;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-list {
  display: grid;
}

.file-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 120px 170px 218px;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 14px;
  border-bottom: 1px solid #edf1f6;
}

.file-row:hover {
  background: #f8fbff;
}

.file-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef3fb;
  font-size: 20px;
  overflow: hidden;
  cursor: pointer;
}

.file-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.file-meta {
  color: #657386;
  font-size: 13px;
}

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

.actions button {
  padding: 7px 9px;
  background: #eef3fb;
  color: #29435f;
  cursor: pointer;
}

.actions .danger {
  color: #b3261e;
}

#previewDialog {
  width: min(900px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  border: 0;
  border-radius: 8px;
  padding: 0;
}

#previewDialog::backdrop {
  background: rgba(13, 20, 30, 0.64);
}

.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  width: 36px;
  height: 36px;
  padding: 0;
  background: rgba(0, 0, 0, 0.62);
}

#previewBody img,
#previewBody video {
  display: block;
  width: 100%;
  max-height: calc(100vh - 24px);
  object-fit: contain;
  background: #0d141e;
}

.share-password {
  display: flex;
  gap: 10px;
}

#shareInfo {
  margin-top: 18px;
}

#shareInfo img,
#shareInfo video {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: min(68vh, 720px);
  margin-top: 14px;
  border-radius: 8px;
  object-fit: contain;
  background: #f5f7fb;
}

.share-download {
  display: inline-block;
  margin-top: 14px;
  border-radius: 8px;
  background: #2364d2;
  color: white;
  padding: 10px 14px;
  text-decoration: none;
  cursor: pointer;
}

@media (max-width: 860px) {
  .workspace {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .file-row {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px;
  }

  .file-row .file-meta,
  .file-row .actions {
    grid-column: 2;
  }

  .actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .topbar {
    padding: 12px;
  }
}
