:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f7f9fc;
  color: #182033;
}

* {
  box-sizing: border-box;
}

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

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

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.sprite {
  display: none;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hidden {
  display: none !important;
}

.shell {
  min-height: 100vh;
}

h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.connect {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(260px, 0.42fr) minmax(320px, 520px);
  align-items: stretch;
  background: #ffffff;
}

.connect-brand {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 32px;
  background: linear-gradient(145deg, #0f62fe 0%, #2f80ed 48%, #18a058 100%);
  color: #ffffff;
}

.brand,
.connect-brand {
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 2px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: #0f62fe;
  color: #ffffff;
  font-weight: 850;
}

.connect-brand .brand-mark {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.34);
}

.connect-form {
  align-self: center;
  width: min(100%, 520px);
  display: grid;
  grid-template-columns: 1fr 1fr 52px;
  gap: 14px;
  padding: 32px;
}

label {
  display: grid;
  gap: 6px;
  color: #526077;
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cfd8e8;
  border-radius: 6px;
  padding: 9px 11px;
  background: #ffffff;
  color: #182033;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(15, 98, 254, 0.24);
  outline-offset: 2px;
}

.app {
  height: 100vh;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  grid-template-rows: 72px minmax(0, 1fr);
  background: #ffffff;
}

.sidebar {
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 18px;
  border-right: 1px solid #dfe6f1;
  background: #f7f9fc;
}

.side-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #526077;
}

.side-icon.active {
  background: #eaf2ff;
  color: #0f62fe;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid #dfe6f1;
  background: #ffffff;
}

.actions,
.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.share-expiration {
  width: 136px;
  min-height: 44px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid #b8d6c2;
  border-radius: 8px;
  padding: 0 10px;
  background: #f0fbf4;
  color: #137333;
}

.share-expiration select {
  min-height: 38px;
  border: 0;
  padding: 0;
  background: transparent;
  color: #182033;
  font-weight: 800;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid #cfd8e8;
  border-radius: 8px;
  background: #ffffff;
  color: #24324a;
  padding: 0;
}

.icon-button:hover {
  border-color: #0f62fe;
  color: #0f62fe;
  background: #f4f8ff;
}

.icon-button.primary {
  align-self: end;
  border-color: #0f62fe;
  background: #0f62fe;
  color: #ffffff;
}

.icon-button.primary:hover {
  background: #0948bd;
  color: #ffffff;
}

.icon-button.danger:hover,
.row-actions .danger:hover {
  border-color: #d92d20;
  color: #d92d20;
  background: #fff3f1;
}

.icon-button.temporary {
  color: #8a5a00;
  background: #fff8e6;
  border-color: #f3d27a;
}

.icon-button.temporary:hover {
  color: #0f62fe;
  border-color: #0f62fe;
  background: #f4f8ff;
}

.icon-button.temporary.active,
.icon-button.temporary[aria-pressed="true"] {
  color: #ffffff;
  border-color: #8a5a00;
  background: #b77900;
}

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

.crumbs button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  background: #eef4ff;
  color: #174ea6;
  font-weight: 750;
}

.crumbs button:hover {
  background: #dceaff;
}

.workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 92px minmax(28px, auto) minmax(0, 1fr);
  background: #ffffff;
}

.dropzone {
  margin: 18px 24px 0;
  min-height: 74px;
  display: grid;
  place-items: center;
  border: 2px dashed #93b7ff;
  border-radius: 8px;
  background: #f4f8ff;
  color: #0f62fe;
}

.dropzone svg {
  width: 28px;
  height: 28px;
}

.dropzone.dragover {
  border-color: #18a058;
  background: #edf9f1;
  color: #0f7b3d;
}

.dropzone.temporary-mode {
  border-color: #f3b344;
  background: #fff8e6;
  color: #8a5a00;
}

.dropzone input {
  display: none;
}

.status {
  min-height: 28px;
  padding: 6px 24px 0;
  color: #526077;
  font-size: 14px;
}

.status.error {
  color: #b42318;
}

.listing {
  min-height: 0;
  overflow: auto;
  padding: 0 24px 24px;
}

.row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 110px 170px 104px;
  gap: 12px;
  align-items: center;
  min-height: 74px;
  border-top: 1px solid #edf1f6;
}

.row:first-child {
  border-top: 0;
}

.row:hover {
  background: #fbfcff;
}

.name {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  font-weight: 700;
}

.name-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 6px;
}

.name-icon svg {
  width: 18px;
  height: 18px;
}

.folder-name-icon {
  background: #eaf2ff;
  color: #0f62fe;
}

.file-name-icon {
  background: #edf9f1;
  color: #0f7b3d;
}

.preview {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #d7deea;
  border-radius: 7px;
  background: #f7f9fc;
  color: #526077;
  font-size: 11px;
  font-weight: 800;
}

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

.folder-preview {
  background: #eaf2ff;
  border-color: #bad2ff;
  color: #0f62fe;
}

.preview-fallback {
  background: #f2f5f9;
  border-color: #d7deea;
}

.ext-png,
.ext-jpg,
.ext-jpeg,
.ext-webp {
  background: #edf9f1;
  border-color: #b8e7c5;
  color: #0f7b3d;
}

.ext-pdf {
  background: #fff3f1;
  border-color: #ffc9c2;
  color: #b42318;
}

.ext-txt,
.ext-md {
  background: #fff8e6;
  border-color: #f3d27a;
  color: #8a5a00;
}

.ext-zip,
.ext-rar,
.ext-7z {
  background: #f1efff;
  border-color: #c9c0ff;
  color: #5b3fd6;
}

.name button {
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 0;
  padding: 0;
  background: transparent;
  color: #182033;
  font-weight: 750;
  text-align: left;
}

.name button:hover {
  color: #0f62fe;
}

.meta {
  color: #66758d;
  font-size: 13px;
}

.row-actions {
  justify-content: flex-end;
}

.row-actions .icon-button {
  width: 36px;
  height: 36px;
}

.empty {
  min-height: 240px;
  display: grid;
  place-items: center;
  color: #66758d;
  border-top: 1px solid #edf1f6;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(13, 24, 43, 0.42);
}

.modal-panel {
  width: min(720px, 100%);
  max-height: min(680px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid #dfe6f1;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(13, 24, 43, 0.24);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid #edf1f6;
}

.modal-header h2 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
  letter-spacing: 0;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.temporary-share-list {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.temporary-share-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #dfe6f1;
  border-radius: 8px;
  background: #fbfcff;
}

.temporary-share-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.temporary-share-url {
  grid-column: 1 / -1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #0f62fe;
  font-size: 13px;
}

.temporary-share-expiry {
  color: #8a5a00;
  font-size: 13px;
  font-weight: 750;
}

.details-panel {
  width: min(980px, 100%);
}

.details-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  padding: 18px;
}

.details-preview {
  min-height: 420px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #dfe6f1;
  border-radius: 8px;
  background: #f7f9fc;
}

.large-preview {
  width: 100%;
  height: 100%;
  min-height: 420px;
  display: grid;
  place-items: center;
}

.large-preview img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  display: block;
}

.large-preview-fallback {
  display: grid;
  place-items: center;
  gap: 12px;
  color: #0f62fe;
  font-weight: 850;
}

.large-preview-fallback svg {
  width: 72px;
  height: 72px;
}

.details-meta {
  align-self: start;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px 12px;
  margin: 0;
  padding: 16px;
  border: 1px solid #dfe6f1;
  border-radius: 8px;
  background: #fbfcff;
}

.details-meta dt {
  color: #66758d;
  font-size: 13px;
  font-weight: 800;
}

.details-meta dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: #182033;
  font-size: 13px;
  font-weight: 650;
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

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

  .connect-brand {
    min-height: 112px;
  }

  .connect-form {
    grid-template-columns: 1fr;
    align-self: start;
  }

  .app {
    min-height: 100vh;
    height: auto;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .sidebar {
    grid-row: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
  }

  .topbar {
    padding: 12px 16px;
  }

  .workspace {
    grid-template-rows: 86px minmax(28px, auto) minmax(0, 1fr);
  }

  .dropzone {
    margin: 14px 16px 0;
  }

  .status,
  .listing {
    padding-left: 16px;
    padding-right: 16px;
  }

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

  .preview {
    grid-row: 1 / span 2;
  }

  .updated-meta {
    display: none;
  }

  .row-actions {
    grid-column: 3;
    grid-row: 1 / span 2;
    justify-content: flex-end;
  }

  .temporary-share-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .details-body {
    grid-template-columns: 1fr;
  }

  .details-preview,
  .large-preview {
    min-height: 280px;
  }

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