:root {
  color-scheme: dark;
  --bg: #05070d;
  --panel: #0d1424;
  --panel-strong: #111d34;
  --ink: #f7fbff;
  --muted: #9fb0c8;
  --line: rgba(255, 255, 255, 0.12);
  --teal: #178bff;
  --teal-strong: #0b62c4;
  --cyan: #39c5ff;
  --amber: #ffffff;
  --rose: #ff5e78;
  --soft: #101a2c;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(23, 139, 255, 0.2), rgba(5, 7, 13, 0.08) 36%, transparent 70%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 44px 44px, 44px 44px, auto;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
label {
  -webkit-tap-highlight-color: transparent;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  flex: 0 0 auto;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 18px;
  padding: 22px 16px;
  background: #05080f;
  color: #f7fbf8;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid rgba(57, 197, 255, 0.45);
  box-shadow: 0 12px 32px rgba(23, 139, 255, 0.28);
}

.brand strong {
  display: block;
  font-size: 1.25rem;
  line-height: 1.1;
}

.brand span {
  display: block;
  margin-top: 3px;
  color: rgba(247, 251, 248, 0.7);
  font-size: 0.84rem;
}

.profile-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(23, 139, 255, 0.12);
  border: 1px solid rgba(57, 197, 255, 0.24);
  border-radius: var(--radius);
}

.profile-card img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid rgba(57, 197, 255, 0.75);
}

.profile-card span {
  display: block;
  color: rgba(247, 251, 248, 0.64);
  font-size: 0.78rem;
}

.profile-card strong {
  display: block;
  overflow: hidden;
  color: #ffffff;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-icon-button {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  cursor: pointer;
}

.mini-icon-button:hover {
  background: rgba(57, 197, 255, 0.18);
}

.nav-list {
  display: grid;
  gap: 6px;
  align-content: start;
  overflow-y: auto;
  padding-right: 2px;
}

.nav-item,
.tool-button,
.icon-button,
.primary-action,
.secondary-action,
.danger-button,
.segmented button {
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}

.nav-item {
  min-height: 42px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  color: rgba(247, 251, 248, 0.78);
  background: transparent;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  color: #ffffff;
  background: rgba(23, 139, 255, 0.18);
}

.nav-item.active {
  box-shadow: inset 3px 0 0 var(--cyan);
}

.nav-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item b {
  min-width: 28px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(247, 251, 248, 0.78);
  font-size: 0.76rem;
  font-weight: 700;
}

.trash-link {
  margin-top: 6px;
  color: #ffd7dd;
}

.side-tools {
  display: grid;
  gap: 8px;
}

.tool-button {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.07);
  color: #f7fbf8;
  text-decoration: none;
}

.tool-button:hover {
  background: rgba(23, 139, 255, 0.22);
}

.workspace {
  min-width: 0;
  padding: 18px;
}

.topbar {
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.search-field {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.search-field svg {
  color: var(--muted);
}

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
}

.icon-button:hover {
  border-color: var(--cyan);
}

.icon-button.menu-button {
  display: none;
}

.primary-action,
.secondary-action,
.danger-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  text-decoration: none;
  white-space: nowrap;
}

.primary-action {
  background: linear-gradient(135deg, #178bff, #0058c8);
  color: #ffffff;
  font-weight: 800;
}

.primary-action:hover {
  background: var(--teal-strong);
}

.secondary-action {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-weight: 700;
}

.danger-button {
  background: rgba(255, 94, 120, 0.14);
  color: var(--rose);
  border: 1px solid rgba(255, 94, 120, 0.35);
  font-weight: 800;
}

.primary-action input,
.secondary-action input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.storage-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 420px);
  gap: 16px;
  align-items: stretch;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.storage-copy {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 7px;
}

.eyebrow {
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 2rem;
  line-height: 1.05;
}

h2 {
  font-size: 1.28rem;
  line-height: 1.2;
}

.storage-copy p {
  max-width: 660px;
  color: var(--muted);
  line-height: 1.45;
}

.storage-meter {
  min-width: 0;
  display: grid;
  gap: 12px;
  align-content: center;
  padding: 14px;
  background: linear-gradient(180deg, rgba(23, 139, 255, 0.14), var(--soft));
  border-radius: var(--radius);
}

.meter-head,
.meter-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.meter-head strong {
  font-size: 1.35rem;
}

.meter-head span,
.meter-foot span,
.meter-foot label {
  color: var(--muted);
  font-size: 0.9rem;
}

.meter-foot label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.meter-foot select {
  height: 34px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.meter-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.meter-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--cyan), #ffffff);
  transition: width 180ms ease;
}

.import-zone {
  min-height: 96px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 18px;
  background: rgba(23, 139, 255, 0.08);
  border: 1px dashed rgba(57, 197, 255, 0.55);
  border-radius: var(--radius);
}

.import-zone.dragging {
  background: rgba(57, 197, 255, 0.16);
  border-color: var(--cyan);
}

.import-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--teal);
}

.import-zone strong {
  display: block;
  font-size: 1rem;
}

.import-zone span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

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

.stat-tile {
  min-width: 0;
  min-height: 94px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stat-tile span {
  color: var(--muted);
  font-size: 0.88rem;
}

.stat-tile strong {
  overflow-wrap: anywhere;
  font-size: 1.45rem;
  line-height: 1.08;
}

.file-area {
  margin-top: 16px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.folder-area {
  margin-top: 16px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.folder-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

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

.folder-card {
  min-height: 96px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.folder-card:hover,
.folder-card.active {
  border-color: rgba(57, 197, 255, 0.75);
  box-shadow: 0 0 0 1px rgba(57, 197, 255, 0.24);
}

.folder-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: rgba(23, 139, 255, 0.16);
  color: var(--cyan);
}

.folder-card strong,
.folder-card small {
  grid-column: 2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-card small {
  color: var(--muted);
}

.file-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.file-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.segmented {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 4px;
  background: var(--soft);
  border-radius: var(--radius);
}

.segmented button {
  min-height: 32px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.segmented button.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}

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

.file-card {
  min-width: 0;
  min-height: 272px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.file-card:hover {
  border-color: var(--cyan);
}

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

.file-badge {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: rgba(23, 139, 255, 0.15);
  color: var(--teal);
}

.file-badge.images {
  background: rgba(57, 197, 255, 0.16);
  color: #74ddff;
}

.file-badge.videos {
  background: rgba(23, 139, 255, 0.18);
  color: #ffffff;
}

.file-badge.music {
  background: rgba(255, 255, 255, 0.12);
  color: #dbeafe;
}

.file-badge.pdf,
.file-badge.psd {
  background: rgba(255, 255, 255, 0.13);
  color: var(--rose);
}

.file-badge.archives {
  background: rgba(57, 197, 255, 0.12);
  color: #9be7ff;
}

.file-name {
  display: -webkit-box;
  min-height: 44px;
  overflow: hidden;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.file-meta {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.file-preview {
  height: 104px;
  display: grid;
  place-items: center;
  overflow: hidden;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(23, 139, 255, 0.18), rgba(255, 255, 255, 0.04)),
    #070c16;
  color: var(--cyan);
}

.file-preview > svg {
  width: 42px;
  height: 42px;
}

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

.document-thumb {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  padding: 10px;
  text-align: center;
}

.document-thumb svg {
  width: 28px;
  height: 28px;
}

.document-thumb strong {
  color: #ffffff;
  font-size: 0.88rem;
}

.document-thumb span {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.file-actions button {
  min-width: 0;
  min-height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.file-actions button:hover {
  border-color: var(--cyan);
}

.file-actions .remove {
  color: var(--rose);
}

.empty-state {
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  width: 44px;
  height: 44px;
  color: var(--teal);
}

.empty-state strong {
  color: var(--ink);
}

.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 19;
  background: rgba(10, 20, 18, 0.42);
}

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(10, 20, 18, 0.58);
}

.preview-panel {
  width: min(920px, 100%);
  max-height: min(780px, 92vh);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.preview-panel > header,
.preview-panel > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.preview-panel > footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.preview-title {
  min-width: 0;
}

.preview-body {
  min-height: 360px;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 16px;
  background: #060a12;
}

.preview-body img,
.preview-body video,
.preview-body iframe {
  max-width: 100%;
  max-height: 62vh;
  border: 0;
  border-radius: var(--radius);
  background: #ffffff;
}

.preview-body audio {
  width: min(520px, 100%);
}

.preview-fallback {
  width: min(520px, 100%);
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
}

.preview-fallback svg {
  width: 48px;
  height: 48px;
  color: var(--teal);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 60;
  max-width: min(520px, calc(100vw - 32px));
  min-height: 44px;
  display: none;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: #07111f;
  color: #ffffff;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

.toast.show {
  display: flex;
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 7, 13, 0.72);
}

.settings-panel {
  width: min(760px, 100%);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.settings-panel > header,
.settings-panel > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.settings-panel > footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.settings-grid article {
  min-height: 132px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.settings-grid svg {
  color: var(--cyan);
}

.settings-grid span {
  color: var(--muted);
  line-height: 1.4;
}

.app-footer {
  padding: 18px 0 6px;
  color: rgba(247, 251, 248, 0.62);
  text-align: center;
  font-weight: 800;
}

[hidden] {
  display: none !important;
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(300px, 88vw);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .icon-button.menu-button {
    display: inline-grid;
  }

  .topbar {
    grid-template-columns: auto minmax(220px, 1fr) auto;
  }

  .workspace {
    padding: 14px;
  }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .top-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .top-actions .primary-action {
    flex: 1 1 auto;
  }

  .storage-band {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  h1 {
    font-size: 1.55rem;
  }

  .import-zone {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .import-zone .secondary-action {
    grid-column: 1 / -1;
  }

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

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

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

  .file-controls {
    align-items: stretch;
    justify-content: space-between;
  }

  .segmented {
    width: 100%;
    justify-content: space-between;
  }

  .segmented button {
    flex: 1 1 0;
  }
}

@media (max-width: 520px) {
  .workspace {
    padding: 10px;
  }

  .topbar {
    gap: 8px;
  }

  .search-field {
    min-height: 44px;
    padding: 0 10px;
  }

  .top-actions {
    gap: 8px;
  }

  .storage-band,
  .file-area,
  .folder-area {
    padding: 14px;
  }

  .meter-head,
  .meter-foot {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats-grid,
  .file-grid {
    grid-template-columns: 1fr;
  }

  .preview-modal {
    padding: 10px;
  }

  .preview-panel {
    max-height: 94vh;
  }

  .preview-panel > footer {
    align-items: stretch;
    flex-direction: column;
  }

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

  .settings-panel > footer {
    align-items: stretch;
    flex-direction: column;
  }
}
