:root {
  color-scheme: light;
  --bg: #f7f7f7;
  --panel: #ffffff;
  --line: #e5e5e5;
  --line-strong: #d0d0d0;
  --text: #1f1f1f;
  --muted: #616161;
  --muted-2: #8a8a8a;
  --blue: #0078d4;
  --blue-strong: #005a9e;
  --blue-soft: #e5f1fb;
  --green: #107c41;
  --orange: #ca5010;
  --red: #c4314b;
  --shadow: 0 14px 35px rgba(0, 0, 0, .08);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.setup-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f5f5f5;
}

.setup-panel {
  width: min(540px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.setup-panel.compact {
  width: min(460px, 100%);
}

.brand-row,
.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-row h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}

.brand-row p {
  margin: 5px 0 0;
  color: var(--muted);
}

.brand-mark {
  width: 42px;
  height: 28px;
  position: relative;
  flex: 0 0 auto;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  background: var(--blue);
}

.brand-mark::before {
  width: 30px;
  height: 18px;
  left: 2px;
  top: 8px;
  border-radius: 18px 18px 8px 8px;
}

.brand-mark::after {
  width: 24px;
  height: 14px;
  right: 0;
  top: 12px;
  border-radius: 16px 16px 7px 7px;
  background: #28a8ea;
}

.setup-form {
  display: grid;
  gap: 16px;
  margin-top: 26px;
}

.setup-form label,
.share-options label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.setup-form input,
.setup-form select,
.share-options select,
.link-result input,
.search-wrap input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  min-height: 38px;
  padding: 7px 10px;
  outline: none;
}

.setup-form input:focus,
.setup-form select:focus,
.share-options select:focus,
.link-result input:focus,
.search-wrap input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
}

.redirect-box {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafafa;
  color: var(--muted);
  font-size: 13px;
}

.redirect-box code {
  color: var(--text);
  overflow-wrap: anywhere;
}

.primary-btn,
.ghost-btn,
.toolbar-btn,
.icon-btn {
  border-radius: 4px;
  min-height: 36px;
  border: 1px solid transparent;
}

.primary-btn {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  padding: 8px 14px;
}

.primary-btn:hover {
  background: var(--blue-strong);
}

.ghost-btn {
  background: #fff;
  color: var(--text);
  border-color: var(--line-strong);
  padding: 8px 14px;
}

.as-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.connect-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
}

.side-nav {
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  min-width: 0;
}

.side-brand {
  height: 42px;
  padding: 0 8px;
  font-weight: 600;
}

.side-brand .brand-mark {
  width: 32px;
  transform: scale(.82);
  transform-origin: left center;
}

.nav-stack {
  display: grid;
  gap: 4px;
  margin-top: 22px;
}

.nav-item {
  height: 38px;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: #f0f0f0;
}

.nav-item.active {
  font-weight: 600;
}

.nav-icon {
  width: 18px;
  height: 18px;
  border: 1.8px solid currentColor;
  display: inline-block;
  position: relative;
  color: var(--blue-strong);
}

.nav-icon.cloud {
  border-radius: 10px;
  border-top-color: transparent;
}

.nav-icon.clock {
  border-radius: 50%;
}

.nav-icon.clock::before,
.nav-icon.clock::after {
  content: "";
  position: absolute;
  background: currentColor;
  left: 8px;
  top: 4px;
  width: 1.8px;
  height: 5px;
}

.nav-icon.clock::after {
  transform: rotate(90deg);
  transform-origin: bottom;
}

.nav-icon.share {
  border-radius: 50%;
}

.quota-box {
  margin-top: auto;
  padding: 14px 10px;
  color: var(--muted);
  font-size: 12px;
}

.quota-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.quota-track {
  margin-top: 8px;
  height: 6px;
  border-radius: 4px;
  background: #e6e6e6;
  overflow: hidden;
}

.quota-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--blue);
}

.main-pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.top-bar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(240px, 560px) auto;
  align-items: center;
  gap: 20px;
  padding: 0 22px;
}

.search-wrap {
  position: relative;
}

.search-wrap input {
  height: 38px;
  border-color: transparent;
  background: #f3f3f3;
  padding-left: 38px;
}

.search-icon {
  position: absolute;
  left: 13px;
  top: 11px;
  width: 14px;
  height: 14px;
  border: 2px solid var(--muted);
  border-radius: 50%;
}

.search-icon::after {
  content: "";
  width: 7px;
  height: 2px;
  background: var(--muted);
  position: absolute;
  right: -6px;
  bottom: -3px;
  transform: rotate(45deg);
  border-radius: 2px;
}

.account-wrap {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--muted);
}

.account-wrap span {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-bar {
  min-height: 52px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 22px;
}

.toolbar-btn {
  background: #fff;
  border-color: transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  color: var(--text);
}

.toolbar-btn:hover:not(:disabled),
.icon-btn:hover:not(:disabled) {
  background: #f3f3f3;
}

.icon-btn {
  width: 36px;
  height: 36px;
  background: #fff;
  display: inline-grid;
  place-items: center;
  border-color: transparent;
}

.icon-btn.active {
  background: var(--blue-soft);
  color: var(--blue-strong);
}

.view-toggle {
  margin-left: auto;
  display: flex;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px;
}

.folder-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 14px;
}

.folder-head h2 {
  margin: 4px 0 0;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 600;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  min-height: 20px;
  font-size: 13px;
}

.breadcrumb button {
  border: 0;
  background: transparent;
  color: var(--blue-strong);
  padding: 0;
  min-height: 20px;
}

.item-count {
  color: var(--muted);
  align-self: end;
  font-size: 13px;
}

.content-layout {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  padding: 0 24px 24px;
}

.file-surface {
  position: relative;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.loading-state,
.empty-state {
  padding: 28px;
  color: var(--muted);
}

.file-list.is-loading {
  opacity: .45;
}

.file-list.list-mode {
  display: grid;
}

.list-header {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 190px 110px 94px;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.file-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 190px 110px 94px;
  align-items: center;
  min-height: 48px;
  padding: 0 12px;
  border-bottom: 1px solid #f0f0f0;
}

.file-row:hover,
.file-row.selected,
.file-card:hover,
.file-card.selected {
  background: #f5faff;
}

.name-cell {
  min-width: 0;
  height: 48px;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 0;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.date-cell,
.size-cell {
  color: var(--muted);
  font-size: 13px;
}

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

.file-thumb {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: inline-grid;
  place-items: center;
  font-size: 8px;
  font-weight: 700;
  color: #fff;
  border-radius: 3px;
}

.folder-thumb {
  position: relative;
  background: #f7d154;
  border-radius: 3px;
}

.folder-thumb::before {
  content: "";
  position: absolute;
  left: 2px;
  top: -4px;
  width: 13px;
  height: 6px;
  background: #efbd25;
  border-radius: 3px 3px 0 0;
}

.file-badge.generic,
.big-file.generic {
  background: #69797e;
}

.file-badge.word,
.big-file.word {
  background: #185abd;
}

.file-badge.excel,
.big-file.excel {
  background: var(--green);
}

.file-badge.powerpoint,
.big-file.powerpoint {
  background: var(--orange);
}

.file-badge.image,
.big-file.image {
  background: #8764b8;
}

.file-badge.video,
.big-file.video {
  background: #004e8c;
}

.file-badge.pdf,
.big-file.pdf {
  background: var(--red);
}

.file-badge.archive,
.big-file.archive {
  background: #7a7574;
}

.file-list.grid-mode {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(164px, 1fr));
  gap: 12px;
  padding: 12px;
}

.file-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.card-preview {
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 0;
  background: #f8f8f8;
  display: grid;
  place-items: center;
  padding: 0;
}

.card-foot {
  min-height: 46px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
  padding: 8px;
}

.thumb-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.big-folder {
  width: 70px;
  height: 48px;
  position: relative;
  border-radius: 5px;
  background: #f7d154;
}

.big-folder::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 5px;
  width: 34px;
  height: 14px;
  border-radius: 5px 5px 0 0;
  background: #efbd25;
}

.big-file {
  width: 62px;
  height: 76px;
  border-radius: 5px;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

.details-pane {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  overflow: auto;
}

.details-empty {
  color: var(--muted);
  display: grid;
  place-items: center;
  height: 160px;
}

.details-preview {
  height: 150px;
  border-radius: 6px;
  background: #f8f8f8;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.details-pane h3 {
  margin: 14px 0 12px;
  font-size: 18px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.details-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.details-pane dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.details-pane dl div {
  display: grid;
  gap: 3px;
}

.details-pane dt {
  color: var(--muted);
  font-size: 12px;
}

.details-pane dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.link-dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  width: min(560px, calc(100vw - 28px));
  box-shadow: var(--shadow);
}

.link-dialog::backdrop {
  background: rgba(0, 0, 0, .35);
}

.dialog-panel {
  padding: 20px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.dialog-head h3 {
  margin: 0;
  font-size: 20px;
}

.dialog-head p {
  margin: 5px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.share-options {
  display: grid;
  gap: 12px;
}

.link-result {
  display: grid;
  gap: 12px;
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  min-width: min(360px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  background: #1f1f1f;
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
  z-index: 20;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.icon {
  width: 18px;
  height: 18px;
  position: relative;
  display: inline-block;
  color: currentColor;
}

.icon.refresh::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
}

.icon.refresh::after {
  content: "";
  position: absolute;
  right: 1px;
  top: 3px;
  border: 5px solid transparent;
  border-left-color: currentColor;
  transform: rotate(-30deg);
}

.icon.download::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 2px;
  width: 2px;
  height: 10px;
  background: currentColor;
}

.icon.download::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 8px;
  width: 8px;
  height: 8px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}

.icon.link::before,
.icon.link::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 6px;
  border: 2px solid currentColor;
  border-radius: 7px;
  top: 5px;
}

.icon.link::before {
  left: 1px;
  transform: rotate(-35deg);
}

.icon.link::after {
  right: 1px;
  transform: rotate(-35deg);
}

.icon.external::before {
  content: "";
  position: absolute;
  left: 3px;
  bottom: 3px;
  width: 10px;
  height: 10px;
  border: 2px solid currentColor;
}

.icon.external::after {
  content: "";
  position: absolute;
  right: 2px;
  top: 2px;
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
}

.icon.power::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
}

.icon.power::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 1px;
  width: 2px;
  height: 9px;
  background: currentColor;
}

.icon.list::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 4px;
  width: 12px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 5px 0 currentColor, 0 10px 0 currentColor;
}

.icon.grid::before {
  content: "";
  position: absolute;
  inset: 3px;
  background:
    linear-gradient(currentColor 0 0) left top / 5px 5px no-repeat,
    linear-gradient(currentColor 0 0) right top / 5px 5px no-repeat,
    linear-gradient(currentColor 0 0) left bottom / 5px 5px no-repeat,
    linear-gradient(currentColor 0 0) right bottom / 5px 5px no-repeat;
}

.icon.close::before,
.icon.close::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 3px;
  width: 2px;
  height: 13px;
  background: currentColor;
}

.icon.close::before {
  transform: rotate(45deg);
}

.icon.close::after {
  transform: rotate(-45deg);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .side-brand span:not(.brand-mark),
  .nav-item span:last-child,
  .quota-box {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .content-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .details-pane {
    display: none;
  }
}

@media (max-width: 720px) {
  .app-shell {
    display: block;
  }

  .side-nav {
    display: none;
  }

  .top-bar {
    grid-template-columns: 1fr;
    height: auto;
    padding: 10px 12px;
  }

  .account-wrap {
    display: none;
  }

  .command-bar {
    overflow-x: auto;
    padding: 8px 12px;
  }

  .folder-head {
    padding: 16px 14px 10px;
  }

  .content-layout {
    padding: 0 12px 12px;
  }

  .list-header,
  .date-cell,
  .size-cell {
    display: none;
  }

  .file-row {
    grid-template-columns: minmax(0, 1fr) 78px;
    min-height: 54px;
  }

  .row-actions {
    grid-column: 2;
  }

  .toolbar-btn {
    flex: 0 0 auto;
  }
}
