:root {
  color-scheme: light dark;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;

  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f5f6f9;
  --surface-3: #eceef3;
  --hover: #f4f5f9;
  --border: #e3e6ec;
  --border-strong: #c9ced9;
  --text: #16181d;
  --text-2: #565e6f;
  --text-3: #6b7383;
  --accent: #3e56d9;
  --accent-hover: #3247c2;
  --accent-soft: rgb(62 86 217 / 0.1);
  --accent-softer: rgb(62 86 217 / 0.05);
  --on-accent: #ffffff;
  --danger: #cf3b3b;
  --danger-hover: #b52f2f;
  --danger-soft: rgb(207 59 59 / 0.1);
  --on-danger: #ffffff;
  --warn: #a35d06;
  --success: #2b8a3e;
  --success-soft: rgb(43 138 62 / 0.14);
  --toast-bg: #1d2029;
  --toast-text: #f2f3f6;
  --backdrop: rgb(10 12 18 / 0.42);
  --shadow-sm: 0 1px 2px rgb(16 20 30 / 0.05);
  --shadow-lg: 0 12px 32px rgb(16 20 30 / 0.14), 0 2px 6px rgb(16 20 30 / 0.06);
  --radius: 12px;
  --radius-lg: 20px;

  --k-folder: #d4930f;
  --k-image: #8254e3;
  --k-video: #d3417a;
  --k-audio: #e0650c;
  --k-pdf: #d53a3a;
  --k-archive: #8a6a34;
  --k-code: #0d8587;
  --k-text: #2d6fcc;
  --k-note: #3e56d9;
  --k-file: #768092;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1015;
    --surface: #161920;
    --surface-2: #1b1f27;
    --surface-3: #252a35;
    --hover: #1b1f28;
    --border: #262b36;
    --border-strong: #3a4151;
    --text: #e9ebf0;
    --text-2: #a8afbd;
    --text-3: #7f8899;
    --accent: #8c9dff;
    --accent-hover: #a5b3ff;
    --accent-soft: rgb(140 157 255 / 0.15);
    --accent-softer: rgb(140 157 255 / 0.06);
    --on-accent: #0d1236;
    --danger: #ff7c7c;
    --danger-hover: #ff9a9a;
    --danger-soft: rgb(255 124 124 / 0.13);
    --on-danger: #2b0909;
    --warn: #f2b84b;
    --success: #5fd07a;
    --success-soft: rgb(95 208 122 / 0.16);
    --toast-bg: #2b303c;
    --toast-text: #eef0f4;
    --backdrop: rgb(0 0 0 / 0.55);
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 16px 40px rgb(0 0 0 / 0.45), 0 2px 8px rgb(0 0 0 / 0.3);

    --k-folder: #f0bb4a;
    --k-image: #b39aff;
    --k-video: #f27ba7;
    --k-audio: #ffa35e;
    --k-pdf: #ff8585;
    --k-archive: #d5b47c;
    --k-code: #4fd1c5;
    --k-text: #78b0f5;
    --k-note: #8c9dff;
    --k-file: #a2aabb;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font: 15px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
a { color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.touch-only { display: none; }

@media (hover: none) and (pointer: coarse) {
  .pointer-only { display: none !important; }
  .touch-only { display: inline; }
}

/* Icons */

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-more { stroke-width: 3.2; }

.logo { width: 28px; height: 28px; flex: none; }
.logo-lg { width: 52px; height: 52px; }
.logo-bg { fill: var(--accent); }
.logo-mark {
  fill: none;
  stroke: var(--on-accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
  font: 600 11.5px/1.3 var(--font);
  text-align: center;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 560;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    transform 0.1s ease, box-shadow 0.15s ease;
}

.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 1px 2px rgb(30 40 120 / 0.2);
}

.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--on-danger);
}

.btn.danger:hover:not(:disabled) { background: var(--danger-hover); border-color: var(--danger-hover); }

.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }

.btn.small { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 9px; }
.btn.wide { width: 100%; }

.icon-btn {
  width: 40px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--text-2);
}

.icon-btn:hover { background: var(--surface-3); color: var(--text); }

.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid var(--on-accent);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .icon-btn { width: 44px; }
}

/* Boot and gate views */

.boot {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
}

.pulse { animation: pulse 1.6s ease-in-out infinite; }

.gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background: radial-gradient(80% 55% at 50% 0%, var(--accent-soft), transparent 70%), var(--bg);
}

.gate-card {
  width: min(400px, 100%);
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 40px 28px 32px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  animation: rise 0.35s ease-out;
}

.gate-title { margin: 6px 0 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.lede { margin: 0; color: var(--text-2); }
.lede, .fineprint, .drop-limits, .empty-text, .card-sub { text-wrap: balance; }

.notice {
  width: 100%;
  margin: 6px 0 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 14px;
  text-align: left;
}

.notice.error { background: var(--danger-soft); color: var(--danger); }

.btn.google { width: 100%; min-height: 48px; margin-top: 10px; gap: 12px; font-size: 15px; }
.google-g { width: 20px; height: 20px; }
.fineprint { margin: 6px 0 0; font-size: 12.5px; color: var(--text-3); }

/* Top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
}

.topbar-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-spacer { flex: 1; }

.brand { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.015em; }

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  border-radius: 10px;
}

.live { display: inline-grid; place-items: center; width: 18px; height: 18px; }

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-3);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.live[data-state="live"] .live-dot { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.live[data-state="connecting"] .live-dot { background: var(--warn); animation: blink 1.4s ease-in-out infinite; }
.live[data-state="offline"] .live-dot { background: var(--danger); }

.usage {
  margin: 0;
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.sep { margin: 0 6px; color: var(--text-3); }

.meter {
  display: block;
  width: 52px;
  height: 5px;
  margin-left: 10px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.meter-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.4s ease;
}

.meter.full .meter-fill { background: var(--warn); }

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

.avatar {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.email {
  min-width: 0;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  color: var(--text-2);
}

.signout { padding: 0 12px; }

/* Main layout */

/* minmax(0, 1fr) keeps nowrap content (deep breadcrumbs) from widening the whole column. */
.shell {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px 16px 96px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

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

@media (min-width: 860px) {
  .top { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 650;
}

.card-title .icon { color: var(--k-note); }
.card-sub { margin: 2px 0 0; font-size: 13px; color: var(--text-3); }

/* Drop zone */

.drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 272px;
  padding: 32px 20px;
  text-align: center;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: radial-gradient(90% 75% at 50% 0%, var(--accent-soft), transparent 72%), var(--surface);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

body.dragging .drop { border-color: var(--accent); }

.drop-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 8px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent);
}

.drop-icon .icon { width: 28px; height: 28px; stroke-width: 1.7; }

.drop-title { margin: 0; font-size: 20px; font-weight: 680; letter-spacing: -0.012em; line-height: 1.3; }
.drop-limits { margin: 0; font-size: 14px; color: var(--text-2); }

.drop-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

.drop-hint { margin: 10px 0 0; font-size: 13px; color: var(--text-3); }

.drop-dest {
  max-width: 100%;
  margin: 12px 0 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  font-size: 13px;
  color: var(--text-2);
}

.drop-dest .icon { width: 16px; height: 16px; color: var(--k-folder); }
.drop-dest span { flex: none; }

.drop-dest strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 620;
}

/* Send text */

.note { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.note-form { flex: 1; display: flex; flex-direction: column; gap: 10px; }

.field {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.field::placeholder { color: var(--text-3); }

.field:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

.note-text { flex: 1; min-height: 104px; resize: vertical; font-size: 14px; line-height: 1.45; }

.note-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hint { font-size: 12.5px; color: var(--text-3); }

@media (hover: none) and (pointer: coarse) {
  .hint { visibility: hidden; }
}

/* Upload queue */

.queue {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 14px 16px;
  animation: rise 0.25s ease-out;
}

.queue-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-height: 32px; }

.queue-summary {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 13px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.bar {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.bar-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.25s ease-out, background-color 0.2s ease;
}

.queue-bar { height: 4px; }

.queue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  max-height: 340px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.up-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.up-row + .up-row { border-top: 1px solid var(--border); }
.up-row[data-status="done"] { animation: fade-out 0.45s ease 3.5s forwards; }

.up-main { min-width: 0; display: grid; gap: 5px; }
.up-line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-width: 0; }

.up-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 560;
}

.up-size, .up-status {
  font-size: 12.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.up-size { flex: none; color: var(--text-3); }
.up-row[data-status="queued"] .bar-fill { transform: scaleX(0) !important; }
.up-row[data-status="done"] .bar-fill { background: var(--success); }
.up-row[data-status="done"] .up-status { color: var(--success); }
.up-row[data-status="error"] .bar { display: none; }
.up-row[data-status="error"] .up-status { color: var(--danger); }
.up-actions { display: flex; align-items: center; gap: 2px; }

.up-done {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--success);
}

.queue-more { margin: 0; font-size: 13px; color: var(--text-3); text-align: center; }

/* File listing */

.files { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }

.toolbar { display: flex; align-items: center; gap: 8px; min-height: 44px; }

.crumbs-nav {
  flex: 1;
  min-width: 0;
  margin: -4px;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.crumbs-nav::-webkit-scrollbar { display: none; }

.crumbs-nav.clipped {
  -webkit-mask-image: linear-gradient(to right, transparent 4px, #000 36px);
  mask-image: linear-gradient(to right, transparent 4px, #000 36px);
}

.crumbs {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
  white-space: nowrap;
}

.crumbs li { flex: none; display: flex; align-items: center; }

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 8px;
  border-radius: 9px;
  color: var(--text-2);
  font-weight: 560;
  text-decoration: none;
}

a.crumb:hover { background: var(--surface-3); color: var(--text); }
.crumb[aria-current="page"] { color: var(--text); font-size: 16px; font-weight: 680; }
.crumb .icon { width: 18px; height: 18px; }
.crumb-label { max-width: 14em; overflow: hidden; text-overflow: ellipsis; }
.crumb-sep { width: 16px; height: 16px; color: var(--text-3); }

.listing {
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.listing:empty { display: none; }

.row {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 10px 8px 10px 10px;
  border-radius: 14px;
  transition: background-color 0.15s ease;
}

.row + .row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 68px;
  right: 12px;
  border-top: 1px solid var(--border);
  transition: opacity 0.15s ease;
}

.row:hover { background: var(--hover); }
.row:hover::before, .row:hover + .row::before { opacity: 0; }
.row.is-new { animation: arrive 2.6s ease-out; }

.tile {
  --k: var(--k-file);
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  color: var(--k);
  background: color-mix(in srgb, var(--k) 13%, transparent);
}

.tile.small { width: 36px; height: 36px; border-radius: 10px; }
.tile .icon { width: 22px; height: 22px; }
.tile.small .icon { width: 18px; height: 18px; }

.k-folder { --k: var(--k-folder); }
.k-folder .icon { fill: color-mix(in srgb, var(--k-folder) 22%, transparent); }
.k-image { --k: var(--k-image); }
.k-video { --k: var(--k-video); }
.k-audio { --k: var(--k-audio); }
.k-pdf { --k: var(--k-pdf); }
.k-archive { --k: var(--k-archive); }
.k-code { --k: var(--k-code); }
.k-text { --k: var(--k-text); }
.k-note { --k: var(--k-note); }

.thumb { cursor: zoom-in; }

.thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.thumb.loaded img { opacity: 1; }
.thumb.loaded .icon { visibility: hidden; }

.row-main { min-width: 0; display: grid; gap: 1px; }

/* Two lines rather than one: notes and camera files differ only near the end of their names. */
.row-name {
  justify-self: start;
  max-width: 100%;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  color: var(--text);
  font-weight: 580;
  text-decoration: none;
  border-radius: 4px;
}

.is-file .row-name:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.stretch::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
}

.stretch:focus-visible { outline: none; }
.stretch:focus-visible::after { outline: 2px solid var(--accent); outline-offset: -2px; }

.row-meta {
  margin: 0;
  overflow: hidden;
  font-size: 13px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.meta-line { display: flex; flex-wrap: wrap; align-items: center; margin-left: -14px; }
.meta-item { display: inline-flex; align-items: center; white-space: nowrap; }
.meta-item .sep { flex: none; width: 14px; margin: 0; text-align: center; }
.expiry.soon { color: var(--warn); font-weight: 620; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 8px 0 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 640;
}

.badge .icon { width: 12px; height: 12px; fill: currentColor; stroke-width: 2; }
.badge.kept { color: var(--accent); background: var(--accent-soft); }

.row-preview {
  justify-self: start;
  max-width: 100%;
  margin: 4px 0 0;
  padding: 2px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
  font: 12.5px/1.5 var(--mono);
}

.row:hover .row-preview { background: var(--surface-3); }

.row-actions { position: relative; z-index: 1; display: flex; align-items: center; gap: 2px; }
.row-actions .icon-btn { color: var(--text-3); }
.row:hover .row-actions .icon-btn { color: var(--text-2); }
.row-actions .icon-btn:hover { color: var(--text); background: var(--surface-3); }
.row-actions .keep[aria-pressed="true"] { color: var(--accent); }
.keep[aria-pressed="true"] .icon { fill: currentColor; }
.row-actions [aria-expanded="true"] { background: var(--surface-3); color: var(--text); }

/* Loading, empty and error states */

.skeleton {
  display: grid;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.skel-row { display: flex; align-items: center; gap: 14px; padding: 10px; }
.skel-tile { flex: none; width: 44px; height: 44px; border-radius: 12px; }
.skel-lines { flex: 1; display: grid; gap: 9px; }
.skel-lines span { height: 10px; border-radius: 6px; width: 42%; }
.skel-lines span + span { width: 24%; }
.skel-row:nth-child(2) .skel-lines span { width: 55%; }
.skel-row:nth-child(3) .skel-lines span { width: 33%; }
.skel-row .skel-lines span + span { width: 22%; }

.skel-tile, .skel-lines span {
  background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.empty {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 40px 20px 48px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.empty-art {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-3);
}

.empty-art .icon { width: 30px; height: 30px; stroke-width: 1.5; }
.empty-title { margin: 0; font-size: 16px; font-weight: 650; }
.empty-text { margin: 0; color: var(--text-2); font-size: 14px; }

.list-error {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 32px 20px;
  text-align: center;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.list-error > .icon { width: 28px; height: 28px; color: var(--danger); }
.list-error-text { margin: 0; }

/* Drag overlay */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0s linear 0.15s;
}

.overlay.visible { opacity: 1; visibility: visible; transition: opacity 0.15s ease; }

.overlay-card {
  width: min(560px, 100%);
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 56px 24px;
  text-align: center;
  border: 2px dashed var(--accent);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: scale(0.97);
  transition: transform 0.18s ease;
}

.overlay.visible .overlay-card { transform: scale(1); }
.overlay-title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.015em; }

.overlay-dest {
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
}

.overlay-dest strong { color: var(--text); }

/* Menu */

.menu {
  position: fixed;
  z-index: 50;
  min-width: 190px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  animation: menu-in 0.12s ease-out;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 12px 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.menu-item .icon { width: 18px; height: 18px; color: var(--text-2); }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); outline: none; }
.menu-item.danger, .menu-item.danger .icon { color: var(--danger); }
.menu-item.danger:hover, .menu-item.danger:focus-visible { background: var(--danger-soft); }

/* Dialogs */

.dialog {
  width: min(420px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

.dialog[open] { animation: pop 0.16s ease-out; }
.dialog::backdrop { background: var(--backdrop); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.dialog[open]::backdrop { animation: fade-in 0.16s ease-out; }

.dialog-body { display: grid; gap: 10px; padding: 22px; }
.dialog-title { margin: 0 0 2px; font-size: 18px; font-weight: 680; letter-spacing: -0.01em; }
.dialog-text { margin: 0; color: var(--text-2); overflow-wrap: anywhere; }
.dialog-note { margin: 0; font-size: 13px; color: var(--text-3); }
.field-label { font-size: 13px; font-weight: 620; color: var(--text-2); }
.field-error { margin: 0; font-size: 13px; color: var(--danger); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 10px; }

.preview { width: fit-content; max-width: min(1100px, calc(100vw - 32px)); }
.preview-body { gap: 10px; padding: 10px; }
.preview-bar { display: flex; align-items: center; gap: 4px; padding-left: 8px; min-width: 0; }

.preview-name {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 620;
}

.preview-stage {
  display: grid;
  place-items: center;
  min-width: min(280px, calc(100vw - 54px));
  min-height: 160px;
  border-radius: 12px;
  background: var(--surface-2);
  overflow: hidden;
}

.preview-stage img {
  max-width: 100%;
  max-height: calc(100dvh - 130px);
  object-fit: contain;
}

/* Toasts */

.toasts {
  position: fixed;
  z-index: 80;
  left: 16px;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: grid;
  justify-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: min(440px, 100%);
  padding: 6px 6px 6px 14px;
  border-radius: 14px;
  background: var(--toast-bg);
  color: var(--toast-text);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  animation: toast-in 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.15);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.leaving { opacity: 0; transform: translateY(6px); }
.toast-text { flex: 1; min-width: 0; margin: 0; overflow-wrap: anywhere; }
.toast-icon { width: 18px; height: 18px; }
.toast.success .toast-icon { color: #6ee089; }
.toast.error .toast-icon { color: #ff8b8b; }
.toast.info .toast-icon { color: #a9b6ff; }

.toast-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  opacity: 0.65;
  cursor: pointer;
}

.toast-close:hover { opacity: 1; background: rgb(255 255 255 / 0.1); }
.toast-close .icon { width: 16px; height: 16px; }

.clipboard-proxy { position: fixed; top: 0; left: -9999px; opacity: 0; }

/* Narrow screens */

@media (min-width: 640px) {
  .toasts { left: auto; right: 24px; bottom: 24px; justify-items: end; }
}

@media (max-width: 759.98px) {
  .email { display: none; }
}

@media (max-width: 639.98px) {
  .topbar-inner { gap: 8px; padding: 8px 16px; }
  .brand { font-size: 17px; }
  .brand-link { gap: 8px; }
  .usage-files, .usage-sep, .signout-label { display: none; }
  .signout { width: 40px; padding: 0; }
  .shell { gap: 12px; padding-top: 14px; }
  .top { gap: 12px; }
  .drop { min-height: 0; padding: 26px 16px 22px; }
  .drop-title { font-size: 18px; }
  .note { gap: 10px; padding: 16px; }
  /* Shorter than its four rows so the file list starts above the fold on a phone. */
  .note-text { flex: none; min-height: 0; height: 72px; }
  .wide-only { display: none !important; }
  .row { gap: 12px; min-height: 60px; padding: 8px 4px 8px 8px; }
  .row + .row::before { left: 60px; }
  .tile { width: 40px; height: 40px; border-radius: 11px; }
  .row-meta { font-size: 12.5px; }
  .queue { padding: 12px 14px; }
}

@media (max-width: 399.98px) {
  .new-folder-label { display: none; }
  #new-folder { width: 40px; padding: 0; }
  .meter { display: none; }
}

@media (pointer: coarse) and (max-width: 399.98px) {
  #new-folder, .signout { width: 44px; }
}

/* Motion */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.6; transform: scale(0.94); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes arrive { 0%, 35% { background-color: var(--accent-soft); } 100% { background-color: transparent; } }

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