:root {
  color-scheme: dark;
  --bg: #080d18;
  --bg-deep: #050912;
  --surface: #101827;
  --surface-raised: #151f31;
  --surface-soft: #182338;
  --border: #26344b;
  --border-strong: #354662;
  --text: #f4f7fb;
  --muted: #94a3b8;
  --muted-strong: #bac5d5;
  --accent: #3f7cff;
  --accent-hover: #6395ff;
  --accent-soft: rgba(63, 124, 255, 0.13);
  --cyan: #46d6c6;
  --danger: #ff6b73;
  --danger-soft: rgba(255, 107, 115, 0.12);
  --success: #55d99a;
  --shadow: 0 24px 72px rgba(0, 0, 0, 0.34);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

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

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 78% -10%, rgba(63, 124, 255, 0.12), transparent 34rem),
    var(--bg);
  font-size: 1rem;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

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

button {
  color: inherit;
}

a {
  color: inherit;
}

svg {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 3px solid rgba(99, 149, 255, 0.65);
  outline-offset: 3px;
}

.button {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.7rem 1.05rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.94rem;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.button--primary {
  color: white;
  background: var(--accent);
  box-shadow: 0 10px 28px rgba(63, 124, 255, 0.22);
}

.button--primary:hover {
  background: var(--accent-hover);
}

.button--secondary {
  color: var(--text);
  background: var(--surface-soft);
  border-color: var(--border);
}

.button--secondary:hover {
  border-color: var(--border-strong);
}

.button--danger {
  color: white;
  background: #d94752;
}

.button--danger:hover {
  background: #ec5963;
}

.button--full {
  width: 100%;
}

.brand-mark {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  flex: 0 0 auto;
  color: white;
  border-radius: 0.7rem;
  background: linear-gradient(145deg, #5790ff, #2458dd);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 7px 20px rgba(47, 102, 228, 0.28);
}

.brand-mark svg {
  width: 1.45rem;
  height: 1.45rem;
  stroke-width: 1.55;
}

.brand-mark--large {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1rem;
}

.brand-mark--large svg {
  width: 2.2rem;
  height: 2.2rem;
}

.eyebrow {
  margin: 0 0 0.3rem;
  color: var(--accent-hover);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.alert {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--muted-strong);
  font-size: 0.9rem;
}

.alert svg {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
}

.alert--error {
  color: #ffc3c7;
  border-color: rgba(255, 107, 115, 0.3);
  background: var(--danger-soft);
}

.alert--success {
  color: #bcf4d9;
  border-color: rgba(85, 217, 154, 0.28);
  background: rgba(85, 217, 154, 0.1);
}

/* Login */
.login-page {
  overflow-x: hidden;
  background:
    radial-gradient(circle at 15% 15%, rgba(70, 214, 198, 0.1), transparent 26rem),
    radial-gradient(circle at 85% 80%, rgba(63, 124, 255, 0.17), transparent 34rem),
    var(--bg-deep);
}

.login-page::before,
.login-page::after {
  position: fixed;
  content: "";
  border: 1px solid rgba(99, 149, 255, 0.1);
  border-radius: 999px;
  pointer-events: none;
}

.login-page::before {
  width: 26rem;
  height: 26rem;
  left: -13rem;
  bottom: -12rem;
}

.login-page::after {
  width: 38rem;
  height: 38rem;
  right: -20rem;
  top: -21rem;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.login-card {
  width: min(100%, 27rem);
  padding: clamp(1.5rem, 5vw, 2.4rem);
  border: 1px solid rgba(84, 105, 139, 0.45);
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, rgba(20, 30, 48, 0.95), rgba(12, 19, 32, 0.97));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(22px);
}

.login-heading {
  margin: 1.6rem 0 1.5rem;
}

.login-heading h1 {
  margin: 0;
  font-size: clamp(1.85rem, 8vw, 2.35rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.login-heading > p:last-child {
  margin: 0.65rem 0 0;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 1.05rem;
  margin-top: 1.2rem;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field label {
  color: var(--muted-strong);
  font-size: 0.88rem;
  font-weight: 650;
}

.field input,
.search-box input {
  width: 100%;
  color: var(--text);
  border: 1px solid var(--border);
  outline: none;
  background: rgba(8, 13, 24, 0.7);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.field input {
  min-height: 3.1rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
}

.field input:hover,
.search-box input:hover {
  border-color: var(--border-strong);
}

.field input:focus,
.search-box input:focus {
  border-color: var(--accent);
  background: #0c1422;
  box-shadow: 0 0 0 3px rgba(63, 124, 255, 0.13);
}

.login-form .button {
  margin-top: 0.25rem;
}

.login-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin: 1.4rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.login-note svg {
  width: 1rem;
  height: 1rem;
}

/* App shell */
.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  min-height: 4.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 4vw;
  border-bottom: 1px solid rgba(38, 52, 75, 0.85);
  background: rgba(8, 13, 24, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.account {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--muted-strong);
  font-size: 0.9rem;
}

.account form {
  margin-left: 0.15rem;
}

.avatar {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  color: #d9e4ff;
  border: 1px solid rgba(99, 149, 255, 0.32);
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 0.78rem;
  font-weight: 800;
}

.icon-button {
  display: inline-grid;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  place-items: center;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 0.65rem;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.icon-button:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface-soft);
}

.icon-button--danger:hover {
  color: #ffb7bc;
  border-color: rgba(255, 107, 115, 0.28);
  background: var(--danger-soft);
}

.workspace {
  width: min(100% - 2rem, 76rem);
  margin: 0 auto;
  padding: 3.1rem 0 5rem;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.6rem;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 2.9rem);
  line-height: 1;
  letter-spacing: -0.045em;
}

.page-heading .button svg {
  width: 1.15rem;
  height: 1.15rem;
}

.flash-stack {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.storage-card {
  display: grid;
  grid-template-columns: auto minmax(9rem, 1fr) auto;
  align-items: center;
  gap: 1.3rem;
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(100deg, rgba(24, 35, 56, 0.86), rgba(15, 24, 39, 0.92));
}

.storage-card__copy {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 15rem;
}

.storage-card__copy > div {
  display: grid;
}

.storage-label,
.storage-card small,
.storage-free {
  color: var(--muted);
  font-size: 0.8rem;
}

.storage-card strong {
  font-size: 0.93rem;
}

.storage-card strong span:last-child {
  color: var(--muted-strong);
  font-weight: 500;
}

.storage-icon {
  display: grid;
  width: 2.7rem;
  height: 2.7rem;
  place-items: center;
  color: var(--cyan);
  border: 1px solid rgba(70, 214, 198, 0.18);
  border-radius: 0.8rem;
  background: rgba(70, 214, 198, 0.08);
}

.storage-meter {
  width: 100%;
  height: 0.45rem;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #27344a;
  appearance: none;
}

.storage-meter::-webkit-progress-bar {
  border-radius: 999px;
  background: #27344a;
}

.storage-meter::-webkit-progress-value {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
}

.storage-meter::-moz-progress-bar {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
}

.storage-free {
  white-space: nowrap;
}

.drop-zone {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  padding: 1.25rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: rgba(16, 24, 39, 0.56);
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.drop-zone.is-dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.004);
}

.drop-zone__icon {
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  place-items: center;
  color: var(--accent-hover);
  border: 1px solid rgba(63, 124, 255, 0.25);
  border-radius: 0.85rem;
  background: var(--accent-soft);
}

.drop-zone > div:nth-child(2) {
  display: grid;
}

.drop-zone strong {
  font-size: 0.94rem;
}

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

.text-button {
  display: inline;
  padding: 0;
  color: var(--accent-hover);
  border: 0;
  background: none;
  cursor: pointer;
}

.text-button:hover {
  text-decoration: underline;
}

.drop-zone__hint {
  max-width: 16rem;
  text-align: right;
}

.upload-queue,
.files-section {
  margin-top: 2.4rem;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.section-heading span {
  color: var(--muted);
  font-size: 0.82rem;
}

.upload-items {
  display: grid;
  gap: 0.55rem;
}

.upload-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.upload-item__icon {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  color: var(--accent-hover);
  border-radius: 0.6rem;
  background: var(--accent-soft);
}

.upload-item__content {
  min-width: 0;
  display: grid;
  gap: 0.38rem;
}

.upload-item__line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.83rem;
}

.upload-item__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted-strong);
  font-weight: 650;
}

.upload-item__status {
  flex: 0 0 auto;
  color: var(--muted);
}

.upload-progress {
  height: 0.3rem;
  overflow: hidden;
  border-radius: 999px;
  background: #27344a;
}

.upload-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 120ms linear;
}

.upload-item.is-error {
  border-color: rgba(255, 107, 115, 0.28);
}

.upload-item.is-error .upload-item__status {
  color: #ffadb3;
}

.upload-item.is-complete .upload-progress span {
  background: var(--success);
}

.files-toolbar > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
}

.search-box {
  position: relative;
  width: min(18rem, 42vw);
}

.search-box svg {
  position: absolute;
  z-index: 1;
  left: 0.75rem;
  top: 50%;
  width: 1.05rem;
  height: 1.05rem;
  color: var(--muted);
  transform: translateY(-50%);
}

.search-box input {
  min-height: 2.55rem;
  padding: 0.58rem 0.8rem 0.58rem 2.35rem;
  border-radius: 0.7rem;
  font-size: 0.88rem;
}

.file-table {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(16, 24, 39, 0.74);
}

.file-row {
  display: grid;
  grid-template-columns: minmax(15rem, 2.2fr) minmax(5rem, 0.65fr) minmax(7rem, 0.8fr) minmax(8rem, 0.8fr) 5.2rem;
  align-items: center;
  min-height: 4.25rem;
  padding: 0 1rem;
  border-top: 1px solid var(--border);
  transition: background 140ms ease;
}

.file-row:not(.file-row--head):hover {
  background: rgba(24, 35, 56, 0.72);
}

.file-row--head {
  min-height: 2.85rem;
  color: var(--muted);
  border-top: 0;
  background: rgba(8, 13, 24, 0.46);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.file-row > span,
.file-row > time {
  color: var(--muted);
  font-size: 0.84rem;
}

.file-name-cell {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding-right: 1rem;
}

.file-name-cell > div {
  min-width: 0;
  display: grid;
}

.file-type {
  display: grid;
  width: 2.3rem;
  height: 2.3rem;
  place-items: center;
  flex: 0 0 auto;
  color: var(--accent-hover);
  border: 1px solid rgba(63, 124, 255, 0.18);
  border-radius: 0.65rem;
  background: var(--accent-soft);
}

.file-type svg {
  width: 1.2rem;
  height: 1.2rem;
}

.file-link {
  overflow: hidden;
  color: var(--text);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.91rem;
  font-weight: 650;
}

.file-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 0.18rem;
}

.mobile-file-meta {
  display: none;
}

.file-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.1rem;
}

.no-results,
.empty-state {
  padding: 3rem 1rem;
  color: var(--muted);
  text-align: center;
}

.empty-state {
  display: grid;
  justify-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(16, 24, 39, 0.6);
}

.empty-state__icon {
  display: grid;
  width: 3.6rem;
  height: 3.6rem;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--surface-raised);
}

.empty-state h3 {
  margin: 1rem 0 0.25rem;
  color: var(--text);
  font-size: 1rem;
}

.empty-state p {
  margin: 0;
  font-size: 0.88rem;
}

.confirm-dialog {
  width: min(calc(100% - 2rem), 28rem);
  padding: 0;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: transparent;
  box-shadow: var(--shadow);
}

.confirm-dialog::backdrop {
  background: rgba(2, 5, 10, 0.72);
  backdrop-filter: blur(5px);
}

.dialog-card {
  padding: 1.5rem;
  border-radius: inherit;
  background: var(--surface);
}

.dialog-icon {
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  place-items: center;
  color: #ffadb3;
  border-radius: 0.85rem;
  background: var(--danger-soft);
}

.dialog-card h2 {
  margin: 1rem 0 0.35rem;
  font-size: 1.25rem;
}

.dialog-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.dialog-card p strong {
  color: var(--muted-strong);
  word-break: break-word;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1.4rem;
}

.toast {
  position: fixed;
  z-index: 30;
  right: 1.25rem;
  bottom: 1.25rem;
  max-width: min(24rem, calc(100% - 2.5rem));
  padding: 0.8rem 1rem;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  box-shadow: var(--shadow);
  font-size: 0.88rem;
}

.error-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.error-code {
  margin-top: 1.4rem;
  color: var(--accent-hover);
  font-weight: 800;
  letter-spacing: 0.12em;
}

.error-shell h1 {
  margin: 0.35rem 0;
  font-size: clamp(2rem, 8vw, 3.2rem);
  letter-spacing: -0.04em;
}

.error-shell p {
  margin: 0 0 1.4rem;
  color: var(--muted);
}

@media (max-width: 820px) {
  .storage-card {
    grid-template-columns: 1fr auto;
  }

  .storage-meter {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .storage-free {
    grid-column: 2;
    grid-row: 1;
  }

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

  .drop-zone__hint {
    display: none;
  }

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

  .file-row--head,
  .desktop-cell {
    display: none;
  }

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

  .mobile-file-meta {
    display: inline;
    margin-top: 0.12rem;
    color: var(--muted);
    font-size: 0.78rem;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 0 1rem;
  }

  .account-name {
    display: none;
  }

  .workspace {
    width: min(100% - 1.25rem, 76rem);
    padding-top: 2rem;
  }

  .page-heading {
    align-items: center;
  }

  .page-heading .button {
    width: 2.85rem;
    padding-inline: 0;
    font-size: 0;
  }

  .page-heading .button svg {
    width: 1.25rem;
    height: 1.25rem;
  }

  .storage-card {
    gap: 0.9rem;
    padding: 1rem;
  }

  .storage-card__copy {
    min-width: 0;
  }

  .storage-icon {
    display: none;
  }

  .storage-free {
    align-self: end;
  }

  .drop-zone {
    padding: 1rem;
  }

  .drop-zone__icon {
    width: 2.45rem;
    height: 2.45rem;
  }

  .files-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    width: 100%;
  }

  .file-row {
    min-height: 4.6rem;
    padding: 0 0.7rem;
  }

  .file-name-cell {
    gap: 0.65rem;
    padding-right: 0.4rem;
  }

  .file-actions .icon-button {
    width: 2.2rem;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
