/*
 * snowsummer — "Alpenglow" design system.
 *
 * One stylesheet for every page (dashboard, login, share view).
 * Concept: warm summer light on snow. Cool glacial surfaces, ink-navy text,
 * one warm accent, and a single signature gradient used sparingly.
 * Light and dark themes follow the OS via prefers-color-scheme.
 */

/* ------------------------------------------------------------------ tokens */

:root {
  --bg: #f2f6f9;
  --surface: #ffffff;
  --ink: #1d2f40;
  --ink-2: #51667a;
  --ink-3: #8298ab;
  --line: #dfe8ef;
  --line-soft: #e9f0f5;

  --glacier: #3d7fb2;
  --glacier-soft: #e3eef6;
  --alpen: #c96144;
  --alpen-soft: #faeae3;
  --danger: #bd4a5e;
  --danger-soft: #fae9ec;

  --grad: linear-gradient(118deg, #6aaed6, #b191c4 48%, #ec9877);
  --grad-strong: linear-gradient(118deg, #3d7fb2, #91619b 52%, #cd5f40);

  --sky: linear-gradient(180deg, #dcebf5 0%, #e9edf3 55%, #f7e7dc 100%);
  --mtn-far: rgba(61, 127, 178, 0.14);
  --mtn-near: rgba(50, 96, 133, 0.22);
  --frost: rgba(255, 255, 255, 0.82);

  --toast-bg: #22384e;
  --toast-fg: #f2f6f9;

  --shadow-1: 0 1px 2px rgba(29, 47, 64, 0.05), 0 4px 16px rgba(29, 47, 64, 0.06);
  --shadow-2: 0 2px 4px rgba(29, 47, 64, 0.06), 0 14px 36px rgba(29, 47, 64, 0.12);

  --radius: 16px;
  --font-ui: 'Inter', system-ui, sans-serif;
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e151c;
    --surface: #17222c;
    --ink: #e6eef5;
    --ink-2: #9fb2c2;
    --ink-3: #64798c;
    --line: #26343f;
    --line-soft: #1e2a34;

    --glacier: #74b3dc;
    --glacier-soft: #1c2d3b;
    --alpen: #ef9678;
    --alpen-soft: #2e211d;
    --danger: #e57e90;
    --danger-soft: #301d23;

    --sky: linear-gradient(180deg, #0c121c 0%, #16202e 55%, #33232c 100%);
    --mtn-far: rgba(4, 8, 13, 0.45);
    --mtn-near: rgba(3, 6, 10, 0.65);
    --frost: rgba(23, 34, 44, 0.85);

    --toast-bg: #e6eef5;
    --toast-fg: #14202b;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
    --shadow-2: 0 2px 4px rgba(0, 0, 0, 0.3), 0 14px 36px rgba(0, 0, 0, 0.45);
  }
}

/* ------------------------------------------------------------- base */

* { margin: 0; padding: 0; box-sizing: border-box; }

html { color-scheme: light dark; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Soft aurora wash behind everything. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 50% at 12% 0%, rgba(106, 174, 214, 0.14), transparent 70%),
    radial-gradient(55% 45% at 92% 100%, rgba(236, 152, 119, 0.12), transparent 70%);
}

::selection { background: rgba(106, 174, 214, 0.3); }

button { font-family: inherit; }

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--glacier);
  outline-offset: 2px;
}

.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* --------------------------------------------------------------- logo */

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.logo .mark { width: 30px; height: 30px; }

.logo em {
  font-style: normal;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ------------------------------------------------------------- buttons */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--grad-strong);
  color: #fff;
  border: none;
  padding: 11px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.07);
  box-shadow: var(--shadow-2);
}
.btn-primary:disabled { opacity: 0.6; cursor: wait; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--line);
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--glacier);
  color: var(--ink);
}
.btn-secondary:disabled { opacity: 0.45; cursor: default; }

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 13px;
  padding: 6px 0;
  text-align: left;
  transition: color 0.15s ease;
}
.link-btn:hover { color: var(--ink); }
.link-btn .icon { width: 16px; height: 16px; color: var(--ink-3); }
.link-btn:hover .icon { color: var(--glacier); }

/* -------------------------------------------------------------- inputs */

.text-input,
.input-group input {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.text-input::placeholder,
.input-group input::placeholder { color: var(--ink-3); }
.text-input:focus,
.input-group input:focus {
  outline: none;
  border-color: var(--glacier);
  box-shadow: 0 0 0 4px rgba(106, 174, 214, 0.18);
}

.input-group { margin-bottom: 12px; }

.error {
  color: var(--danger);
  font-size: 14px;
  margin-top: 16px;
  display: none;
  line-height: 1.5;
}
.error.show { display: block; }

/* --------------------------------------------------- scene (lock/login/share) */

.scene {
  position: fixed;
  inset: 0;
  background: var(--sky);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
}
.scene.hidden { display: none; }

#lock-screen { z-index: 20000; }

.mountains {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: min(30vh, 300px);
  pointer-events: none;
}
.mountains .far { fill: var(--mtn-far); }
.mountains .near { fill: var(--mtn-near); }

.frost-card {
  position: relative;
  background: var(--frost);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 44px 40px;
  border-radius: 22px;
  box-shadow: var(--shadow-2);
  border: 1px solid var(--line-soft);
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.frost-card .logo { justify-content: center; margin-bottom: 22px; }

.frost-card h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 24px;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

.frost-card p.subtitle {
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.55;
  margin-bottom: 26px;
}

.fine-print {
  margin-top: 22px;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.6;
}

/* --------------------------------------------------------------- topnav */

.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
  padding: 14px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.search-bar {
  flex: 1;
  max-width: 440px;
  position: relative;
}
.search-bar .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--ink-3);
  pointer-events: none;
}
.search-bar input {
  width: 100%;
  padding: 11px 16px 11px 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.search-bar input::placeholder { color: var(--ink-3); }
.search-bar input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--glacier);
  box-shadow: 0 0 0 4px rgba(106, 174, 214, 0.18);
}

.user { display: flex; align-items: center; gap: 12px; }
.user-name { font-weight: 600; font-size: 14px; }
.user-caption { font-size: 12px; color: var(--ink-3); }
.user-avatar {
  width: 38px;
  height: 38px;
  background: var(--grad);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
}

/* --------------------------------------------------------------- layout */

.main {
  display: flex;
  padding: 28px 36px;
  gap: 36px;
  max-width: 1440px;
  margin: 0 auto;
}

.sidebar { width: 210px; flex-shrink: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  margin-bottom: 2px;
  border-radius: 12px;
  color: var(--ink-2);
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item .icon { width: 18px; height: 18px; color: var(--ink-3); transition: color 0.15s ease; }
.nav-item:hover { background: var(--line-soft); color: var(--ink); }
.nav-item.active { background: var(--glacier-soft); color: var(--glacier); }
.nav-item.active .icon, .nav-item:hover .icon { color: inherit; }

.sidebar-trust {
  margin-top: 36px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-3);
}
.sidebar-trust strong {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-2);
  font-weight: 600;
  margin-bottom: 4px;
}
.sidebar-trust .icon { width: 14px; height: 14px; color: var(--glacier); }

.sidebar-tools { margin-top: 18px; padding-left: 4px; display: grid; gap: 2px; }

.content { flex: 1; min-width: 0; }

/* ------------------------------------------------------------ header row */

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  gap: 16px;
  flex-wrap: wrap;
}
.section-header h2 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.015em;
}
.header-group { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.memory-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--alpen-soft);
  color: var(--alpen);
  border: none;
  padding: 8px 15px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.memory-btn:hover { transform: translateY(-1px); filter: brightness(1.03); }
.memory-btn .icon { width: 15px; height: 15px; }

/* ---------------------------------------------------------------- stats */

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  margin-bottom: 28px;
  overflow: hidden;
}
.stat-card { padding: 18px 24px; }
.stat-card + .stat-card { border-left: 1px solid var(--line-soft); }
.stat-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.stat-label { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }

/* ------------------------------------------------------------ file grid */

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

.empty-state {
  grid-column: 1 / -1;
  padding: 64px 40px;
  text-align: center;
  color: var(--ink-3);
  font-size: 14.5px;
  line-height: 1.6;
  border: 1.5px dashed var(--line);
  border-radius: 20px;
}
.empty-state::before {
  content: "❅";
  display: block;
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 1;
  margin-bottom: 14px;
  opacity: 0.45;
}

.file-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-1);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.file-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: var(--line);
}

.file-select {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 17px;
  height: 17px;
  accent-color: var(--glacier);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.file-card:hover .file-select,
.file-select:checked,
.file-select:focus-visible { opacity: 1; }
@media (hover: none) { .file-select { opacity: 0.55; } }

.fav-btn {
  position: absolute;
  top: 11px;
  right: 38px;
  background: none;
  border: none;
  padding: 2px;
  color: var(--ink-3);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.fav-btn svg { width: 17px; height: 17px; display: block; }
.file-card:hover .fav-btn,
.fav-btn:focus-visible { opacity: 1; }
.fav-btn:hover { color: var(--alpen); transform: scale(1.12); }
.fav-btn.active {
  opacity: 1;
  color: var(--alpen);
}
.fav-btn.active svg { fill: currentColor; }
@media (hover: none) { .fav-btn { opacity: 0.55; } }

.file-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  color: var(--tint, var(--glacier));
  background: color-mix(in srgb, var(--tint, var(--glacier)) 13%, transparent);
}
.file-icon svg { width: 21px; height: 21px; }

.kind-image   { --tint: #7c6bb0; }
.kind-video   { --tint: #c26248; }
.kind-audio   { --tint: #b55d80; }
.kind-pdf     { --tint: #b45454; }
.kind-archive { --tint: #a17a40; }
.kind-text    { --tint: #45897e; }
.kind-file    { --tint: #557d9e; }

@media (prefers-color-scheme: dark) {
  .kind-image   { --tint: #a999dd; }
  .kind-video   { --tint: #e59175; }
  .kind-audio   { --tint: #db8fae; }
  .kind-pdf     { --tint: #dd8888; }
  .kind-archive { --tint: #cca56a; }
  .kind-text    { --tint: #77bcb1; }
  .kind-file    { --tint: #86aecc; }
}

/* Cover thumbnail for image files — the icon tile shows until the
   decrypted thumb fades in. */
.file-thumb {
  position: relative;
  height: 124px;
  border-radius: 12px;
  margin-bottom: 14px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tint, var(--glacier));
  background: color-mix(in srgb, var(--tint, var(--glacier)) 13%, transparent);
}
.file-thumb > svg { width: 26px; height: 26px; }
.file-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.file-thumb img.ready { opacity: 1; }

.file-name {
  font-weight: 600;
  font-size: 14.5px;
  margin-bottom: 6px;
  word-break: break-word;
  line-height: 1.35;
}

.file-meta {
  font-size: 12px;
  color: var(--ink-3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.encrypted-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--glacier-soft);
  color: var(--glacier);
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}
.encrypted-badge svg { width: 10px; height: 10px; }

.file-actions { display: flex; gap: 8px; margin-top: 14px; }
.file-actions button {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn-download { background: var(--glacier-soft); color: var(--glacier); }
.btn-download:hover { background: color-mix(in srgb, var(--glacier) 22%, transparent); }
.btn-delete { background: transparent; color: var(--ink-3); }
.btn-delete:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------------------------------------------------------------- modal */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(13, 24, 36, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 15000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.show { display: flex; }

.modal-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  padding: 28px 30px;
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-2);
  animation: modal-in 0.22s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.modal-header h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
}
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--ink-3);
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}
.modal-close:hover { color: var(--ink); background: var(--line-soft); }

.modal-note {
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.6;
  margin-bottom: 16px;
}

.link-row { display: flex; gap: 8px; }
.link-row input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  background: var(--bg);
  color: var(--ink-2);
}
.copy-btn, .revoke-btn {
  border: none;
  padding: 9px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s ease, background 0.15s ease;
}
.copy-btn { background: var(--grad-strong); color: #fff; }
.copy-btn:hover { filter: brightness(1.07); }
.revoke-btn { background: var(--danger-soft); color: var(--danger); }
.revoke-btn:hover { filter: brightness(0.97); }

.share-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 14px;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid var(--line-soft);
}
.share-row:last-child { border-bottom: none; }
.share-title { font-weight: 600; font-size: 14.5px; word-break: break-word; }
.share-meta { font-size: 12px; color: var(--ink-3); grid-column: 1; }
.share-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 8px; }

/* ------------------------------------------------------------- drop zone */

#drop-zone {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--glacier) 12%, transparent);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
#drop-zone.active { display: flex; }

.drop-content {
  background: var(--surface);
  padding: 48px 64px;
  border-radius: 24px;
  text-align: center;
  box-shadow: var(--shadow-2);
  border: 1.5px dashed var(--glacier);
}
.drop-content .icon { width: 44px; height: 44px; color: var(--glacier); margin-bottom: 16px; }
.drop-content h3 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  margin-bottom: 8px;
}
.drop-content p { color: var(--ink-2); font-size: 14px; }

/* ------------------------------------------------------------- lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(9, 15, 22, 0.9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 16000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 28px;
}
.lightbox.show { display: flex; animation: lightbox-in 0.2s ease; }
@keyframes lightbox-in { from { opacity: 0; } }

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #e6eef5;
  font-size: 24px;
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s ease;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.22); }

.lightbox-stage {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}
.lightbox-stage img,
.lightbox-stage video {
  max-width: min(1100px, 92vw);
  max-height: 72vh;
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  animation: stage-in 0.28s ease;
}
@keyframes stage-in { from { opacity: 0; transform: scale(0.975); } }

.lightbox-stage audio { width: min(480px, 88vw); }

.lightbox-frame {
  width: min(1000px, 92vw);
  height: 72vh;
  border: none;
  border-radius: 14px;
  background: #fff;
}

.lightbox-text {
  width: min(860px, 92vw);
  max-height: 68vh;
  overflow: auto;
  background: var(--surface);
  color: var(--ink);
  border-radius: 14px;
  padding: 22px 26px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.lightbox-caption {
  display: flex;
  align-items: center;
  gap: 20px;
  max-width: min(1100px, 92vw);
}
.lightbox-caption-text { min-width: 0; }
.lightbox-name {
  color: #f2f6f9;
  font-weight: 600;
  font-size: 14.5px;
  word-break: break-word;
}
.lightbox-meta {
  color: rgba(230, 238, 245, 0.65);
  font-size: 12.5px;
  margin-top: 2px;
}
.lightbox .btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  border-color: transparent;
  color: #e6eef5;
}
.lightbox .btn-secondary:hover { border-color: rgba(255, 255, 255, 0.4); color: #fff; }

.file-card.previewable { cursor: pointer; }

/* ------------------------------------------------------- toast + progress */

.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  max-width: 420px;
  background: var(--toast-bg);
  color: var(--toast-fg);
  padding: 13px 20px;
  border-radius: 14px;
  box-shadow: var(--shadow-2);
  font-size: 14px;
  display: none;
  align-items: center;
  gap: 12px;
  z-index: 10000;
  animation: toast-in 0.25s ease;
}
.toast.show { display: flex; }
.toast.error { background: var(--danger); color: #fff; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

.progress-container {
  position: fixed;
  bottom: 92px;
  right: 28px;
  width: 320px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  padding: 16px;
  border: 1px solid var(--line-soft);
  z-index: 10001;
  display: none;
  max-height: 50vh;
  overflow-y: auto;
}
.progress-container.show { display: block; }
#progress-title { font-weight: 600; margin-bottom: 12px; font-size: 13.5px; }
.progress-item { margin-bottom: 12px; }
.progress-item:last-child { margin-bottom: 0; }
.progress-label {
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.progress-label span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.progress-bar {
  height: 6px;
  background: var(--line-soft);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--grad);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* ------------------------------------------------------- share view page */

.share-card { max-width: 560px; text-align: left; }
.share-card .logo { justify-content: center; width: 100%; margin-bottom: 4px; }
.share-card .tagline {
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
  margin-bottom: 30px;
}
.share-card h1 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  text-align: center;
  margin-bottom: 6px;
  word-break: break-word;
}
.share-card .share-heading-meta {
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
  margin-bottom: 26px;
}

.state { text-align: center; padding: 30px 0; }
.state .spinner {
  width: 32px;
  height: 32px;
  margin: 0 auto 18px;
  border: 3px solid var(--line-soft);
  border-top-color: var(--glacier);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.state.error .spinner { display: none; }
.state.error #status { color: var(--danger); font-weight: 600; }
#status { font-size: 15px; margin-bottom: 8px; }
#detail { font-size: 13px; color: var(--ink-3); line-height: 1.6; }

.file-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  margin-bottom: 10px;
}
.file-info { min-width: 0; }
.file-row .file-name { margin-bottom: 0; }
.file-row.previewable { cursor: pointer; transition: border-color 0.15s ease; }
.file-row.previewable:hover { border-color: var(--glacier); }
.file-hint { font-size: 11px; color: var(--glacier); margin-top: 2px; }
.file-size { font-size: 12px; color: var(--ink-3); margin-top: 3px; }

.download-btn {
  background: var(--grad-strong);
  color: #fff;
  border: none;
  padding: 9px 20px;
  border-radius: 11px;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.download-btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.07); }
.download-btn:disabled { opacity: 0.65; cursor: default; }

.row-progress {
  display: none;
  grid-column: 1 / -1;
  height: 5px;
  background: var(--line-soft);
  border-radius: 999px;
  overflow: hidden;
}
.row-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--grad);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.footnote {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.6;
  text-align: center;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 860px) {
  .topnav { flex-wrap: wrap; gap: 12px; padding: 12px 18px; }
  .search-bar { order: 3; max-width: none; flex-basis: 100%; }
  .main { flex-direction: column; padding: 20px 18px; gap: 20px; }
  .sidebar { width: 100%; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
  .nav-item { margin-bottom: 0; }
  .sidebar-trust { display: none; }
  .sidebar-tools { margin-top: 0; display: flex; gap: 14px; }
  .stats { grid-template-columns: 1fr; }
  .stat-card + .stat-card { border-left: none; border-top: 1px solid var(--line-soft); }
  .progress-container, .toast { right: 12px; left: 12px; width: auto; }
}

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