/* upload.farrentech.com — design tokens lifted from the Claude Design handoff:
   warm cream surface, terracotta accent, espresso text, Newsreader serif + Geist sans. */

:root {
  /* Warm-cream surface palette */
  --ft-bg:        #fbf6e8;
  --ft-bg:        oklch(0.985 0.012 80);
  --ft-surface:   #ffffff;
  --ft-surface-2: #f4eedf;
  --ft-surface-2: oklch(0.96 0.014 82);
  --ft-border:    #e0d6bf;
  --ft-border:    oklch(0.88 0.02 85);
  --ft-text:      #2a201a;
  --ft-text:      oklch(0.25 0.03 50);
  --ft-muted:     #7a6a55;
  --ft-muted:     oklch(0.55 0.025 70);
  --ft-input-bg:  #ffffff;

  /* Terracotta accent */
  --ft-accent:        #a8321b;
  --ft-accent:        oklch(0.50 0.16 35);
  --ft-accent-soft:   #d28666;
  --ft-accent-soft:   oklch(0.70 0.10 45);
  --ft-on-accent:     #ffffff;
  --ft-accent-shadow: rgba(168, 50, 27, 0.18);

  /* Sage secondary */
  --ft-sage:         #7e9a85;
  --ft-sage:         oklch(0.65 0.05 150);
  --ft-sage-soft:    #d2e2d2;
  --ft-sage-soft:    oklch(0.92 0.025 150);

  /* Type */
  --ft-serif: 'Newsreader', Georgia, serif;
  --ft-sans:  'Geist', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --ft-mono:  'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--ft-bg);
  color: var(--ft-text);
  font-family: var(--ft-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;          /* iOS zoom guard */
  touch-action: manipulation;
}

a { color: var(--ft-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Public uploader layout ─────────────────────────────────────────────── */
.shell {
  max-width: 540px;
  margin: 0 auto;
  padding: 24px 22px 120px;   /* room at bottom for sticky CTA on mobile */
  min-height: 100vh;
  min-height: 100dvh;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 4px 0 28px;
}
.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--ft-surface);
  border: 1px solid var(--ft-border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-name {
  font-family: var(--ft-serif);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.h1 {
  font-family: var(--ft-serif);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--ft-text);
  margin: 0 0 14px;
  font-size: clamp(28px, 7vw, 40px);
  text-wrap: balance;
}
.h2 {
  font-family: var(--ft-serif);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ft-text);
  margin: 0 0 8px;
  font-size: clamp(22px, 5.5vw, 28px);
}
.lede {
  font-family: var(--ft-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ft-muted);
  margin: 0 0 28px;
  text-wrap: balance;
}

/* Step dots */
.step-dots {
  display: inline-flex;
  gap: 6px;
  margin: 0 0 14px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--ft-surface-2);
  font-family: var(--ft-mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  color: var(--ft-muted);
}
.step-dots .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ft-border); }
.step-dots .dot.on { background: var(--ft-accent); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--ft-sans);
  font-weight: 500;
  font-size: 15px;
  height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.btn.lg { height: 52px; padding: 0 28px; font-size: 16px; }
.btn.sm { height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn.full { width: 100%; }
.btn.primary {
  background: var(--ft-accent);
  color: var(--ft-on-accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 2px 8px var(--ft-accent-shadow);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.primary:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.btn.secondary {
  background: var(--ft-surface-2);
  color: var(--ft-text);
  border-color: var(--ft-border);
}
.btn.secondary:hover { background: #ece5d3; background: oklch(0.94 0.014 82); }
.btn.ghost {
  background: transparent;
  color: var(--ft-text);
  border: 1px solid var(--ft-border);
}
.btn.ghost:hover { background: var(--ft-surface-2); }
.btn.danger {
  background: transparent;
  color: var(--ft-accent);
  border: 1px solid var(--ft-accent);
}
.btn:active { transform: scale(0.98); }

/* Form fields */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-family: var(--ft-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ft-text);
}
.field-input,
.field-textarea {
  appearance: none;
  height: 48px;
  padding: 0 16px;
  background: var(--ft-input-bg);
  color: var(--ft-text);
  border: 1px solid var(--ft-border);
  border-radius: 12px;
  font-family: var(--ft-sans);
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  width: 100%;
}
.field-input:focus,
.field-textarea:focus { border-color: var(--ft-accent); }
.field-textarea { height: auto; padding: 12px 16px; line-height: 1.4; resize: vertical; min-height: 64px; }
.field-error {
  font-size: 12.5px;
  color: var(--ft-accent);
  font-family: var(--ft-sans);
}
.field-hint {
  font-size: 12.5px;
  color: var(--ft-muted);
  font-family: var(--ft-sans);
}

/* Captcha checkbox */
.captcha {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  background: var(--ft-surface);
  border: 1px solid var(--ft-border);
  border-radius: 14px;
  cursor: pointer;
  font-family: var(--ft-sans);
  font-size: 15px;
  color: var(--ft-text);
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.captcha:hover { border-color: var(--ft-accent-soft); }
.captcha.on { border-color: var(--ft-accent); background: var(--ft-surface); }
.captcha-box {
  width: 26px; height: 26px;
  border: 1.5px solid var(--ft-border);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ft-input-bg);
  flex-shrink: 0;
  transition: all 0.15s;
}
.captcha.on .captcha-box {
  background: var(--ft-accent);
  border-color: var(--ft-accent);
  color: white;
}
.captcha-mark { font-size: 16px; line-height: 1; color: white; }

/* ── Upload zone (drop + browse) ─────────────────────────────────────── */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  border: 2px dashed var(--ft-border);
  border-radius: 18px;
  background: var(--ft-surface);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  text-decoration: none;
  color: var(--ft-text);
}
.dropzone:hover { border-color: var(--ft-accent-soft); background: var(--ft-surface-2); }
.dropzone.over {
  border-color: var(--ft-accent);
  background: #fff5e6;
  background: oklch(0.97 0.04 70);
}
.dropzone-icon { font-size: 32px; color: var(--ft-accent); line-height: 1; }
.dropzone-title { font-family: var(--ft-serif); font-size: 19px; font-weight: 500; }
.dropzone-sub { font-size: 13.5px; color: var(--ft-muted); line-height: 1.4; }

.upload-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0 0;
}
.upload-actions .btn { width: 100%; }

/* File queue */
.queue {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 22px 0 0;
}
.q-item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  padding: 14px;
  background: var(--ft-surface);
  border: 1px solid var(--ft-border);
  border-radius: 14px;
}
.q-thumb {
  width: 64px; height: 64px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--ft-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ft-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: white;
}
.q-thumb img, .q-thumb video { width: 100%; height: 100%; object-fit: cover; }
.q-thumb.placeholder {
  background: linear-gradient(135deg, #d9bfae, #8a5d44);
}
.q-body { min-width: 0; }
.q-name {
  font-family: var(--ft-sans);
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  gap: 8px;
  align-items: baseline;
  justify-content: space-between;
}
.q-size { font-family: var(--ft-mono); font-size: 12px; color: var(--ft-muted); flex-shrink: 0; }
.q-progress {
  height: 6px;
  background: var(--ft-surface-2);
  border-radius: 999px;
  margin: 8px 0 6px;
  overflow: hidden;
}
.q-progress-fill {
  height: 100%;
  background: var(--ft-accent);
  width: 0;
  transition: width 0.18s ease;
}
.q-progress-fill.done { background: var(--ft-sage); }
.q-progress-fill.error { background: #aa3333; }
/* "Preparing…" / "Resuming…" — animated shimmer for any indeterminate
   state (iOS Photos export, or tus reading prior offset before the next
   PATCH actually flies). */
.q-progress-fill.preparing,
.q-progress-fill.resuming {
  width: 100% !important;
  background: linear-gradient(
    90deg,
    var(--ft-accent-soft) 0%,
    var(--ft-accent) 50%,
    var(--ft-accent-soft) 100%
  );
  background-size: 200% 100%;
  animation: prep-shimmer 1.4s linear infinite;
  transition: none;
}
@keyframes prep-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Sticky-bar hint about keeping the tab open during big uploads */
.send-hint {
  text-align: center;
  font-size: 12.5px;
  color: var(--ft-muted);
  margin: 8px 0 0;
}
.send-hint.warn { color: var(--ft-accent); }
.q-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--ft-muted); margin-bottom: 6px; }
.q-desc-row { display: flex; gap: 8px; align-items: stretch; }
.q-desc {
  flex: 1;
  background: var(--ft-input-bg);
  border: 1px solid var(--ft-border);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: var(--ft-sans);
  font-size: 13.5px;
  color: var(--ft-text);
  outline: none;
  resize: vertical;
  min-height: 36px;
  max-height: 120px;
}
.q-desc:focus { border-color: var(--ft-accent); }
.q-remove {
  background: transparent;
  border: 1px solid var(--ft-border);
  color: var(--ft-muted);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12.5px;
  cursor: pointer;
  flex-shrink: 0;
}
.q-remove:hover { color: var(--ft-accent); border-color: var(--ft-accent); }
.q-status {
  font-family: var(--ft-mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  color: var(--ft-sage);
}
.q-status.error { color: #aa3333; }

/* Sticky bottom CTA on mobile */
.send-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 22px -22px 0;
  padding: 16px 22px calc(16px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--ft-bg) 70%, transparent);
}

/* Success */
.success {
  text-align: center;
  padding: 40px 16px 24px;
}
.success-tick {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--ft-sage-soft);
  color: var(--ft-sage);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 18px;
}

/* Subtle dotted divider */
.rule { border: 0; border-top: 1px dashed var(--ft-border); margin: 24px 0; }

/* ── Login page ──────────────────────────────────────────────────────── */
.login-shell {
  max-width: 380px;
  margin: 0 auto;
  padding: 80px 22px;
}

/* ── Admin page ──────────────────────────────────────────────────────── */
.admin-shell { max-width: 1100px; margin: 0 auto; padding: 28px 24px 60px; }
.admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  border-bottom: 1px dashed var(--ft-border);
  margin-bottom: 22px;
}
.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.stat-card {
  padding: 14px 18px;
  background: var(--ft-surface);
  border: 1px solid var(--ft-border);
  border-radius: 14px;
}
.stat-label {
  font-family: var(--ft-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ft-muted);
}
.stat-value {
  font-family: var(--ft-serif);
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.02em;
  color: var(--ft-text);
  line-height: 1.1;
  margin-top: 4px;
}

.storage-card {
  display: flex;
  align-items: center;
  gap: 14px;
}
.storage-meta { min-width: 0; flex: 1; }
.storage-disk {
  font-family: var(--ft-mono);
  font-size: 11px;
  color: var(--ft-muted);
  margin-top: 4px;
  letter-spacing: 0.02em;
}
.disk-donut {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
}
.disk-donut circle {
  fill: none;
  stroke-width: 12;
}
.disk-donut .donut-track   { stroke: var(--ft-surface-2); }
.disk-donut .donut-uploads { stroke: var(--ft-accent, #c8694a); }
.disk-donut .donut-other   { stroke: var(--ft-muted); opacity: 0.55; }

.admin-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  align-items: center;
}
.admin-filters .field-input { height: 40px; font-size: 14px; }
.admin-filters input[type="text"] { min-width: 240px; flex: 1; }
.admin-filters .date-input { width: 150px; }

.uploader-group {
  background: var(--ft-surface);
  border: 1px solid var(--ft-border);
  border-radius: 14px;
  margin-bottom: 12px;
  overflow: hidden;
}
.uploader-group summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  user-select: none;
  font-family: var(--ft-sans);
}
.uploader-group summary::-webkit-details-marker { display: none; }
.uploader-group summary:hover { background: var(--ft-surface-2); }
.uploader-name { font-family: var(--ft-serif); font-size: 18px; font-weight: 500; flex-shrink: 0; }
.uploader-email { font-family: var(--ft-mono); font-size: 12.5px; color: var(--ft-muted); }
.uploader-meta { font-size: 12.5px; color: var(--ft-muted); margin-left: auto; flex-shrink: 0; }
.uploader-meta strong { color: var(--ft-text); font-weight: 500; }

/* ── Group "select all" checkbox in summary ──────────────────────── */
.group-check {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  margin-right: 4px;
}
.group-check input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--ft-accent); }

/* ── File grid (tiled) ───────────────────────────────────────────── */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px;
  padding: 14px 18px 18px;
  border-top: 1px dashed var(--ft-border);
  background: var(--ft-bg);
}

.file-tile {
  position: relative;
  background: var(--ft-surface);
  border: 1px solid var(--ft-border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, transform 0.08s ease;
}
.file-tile:has(.tile-check-input:checked) {
  border-color: var(--ft-accent);
  box-shadow: 0 0 0 2px var(--ft-accent-shadow);
}

.tile-check {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(4px);
  cursor: pointer;
}
.tile-check input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--ft-accent); margin: 0; }

.tile-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--ft-surface-2);
  cursor: pointer;
  font-family: var(--ft-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ft-muted);
  overflow: hidden;
}
.tile-thumb { position: relative; }
.tile-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-thumb.is-video {
  background: linear-gradient(135deg, #2c2a28, #1a1816);
  color: rgba(255, 255, 255, 0.92);
}
.tile-thumb .thumb-video { width: 44px; height: 44px; }
.tile-thumb .thumb-ext { letter-spacing: 0.04em; }
/* Pill in the bottom-right of a video tile: shows duration if we have it,
   else a ▶ glyph. Tile-thumb is position:relative so this anchors correctly. */
.tile-thumb .video-badge {
  position: absolute;
  bottom: 6px; right: 6px;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border-radius: 10px;
  font-family: var(--ft-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.tile-meta {
  padding: 8px 10px 10px;
  min-width: 0;
  flex: 1;
}
.tile-name {
  font-family: var(--ft-sans);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ft-text);
}
.tile-sub {
  font-family: var(--ft-mono);
  font-size: 10.5px;
  color: var(--ft-muted);
  margin-top: 3px;
  display: flex;
  gap: 4px;
  white-space: nowrap;
}
.tile-desc {
  font-family: var(--ft-sans);
  font-size: 11.5px;
  color: var(--ft-muted);
  font-style: italic;
  margin-top: 4px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.tile-actions {
  position: absolute;
  top: 8px; right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.file-tile:hover .tile-actions,
.file-tile:focus-within .tile-actions { opacity: 1; }
.tile-action {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(4px);
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-family: var(--ft-sans);
  color: var(--ft-text);
  text-decoration: none;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.tile-action:hover { background: var(--ft-accent); color: var(--ft-on-accent); }

/* ── Selection bar (sticky bottom) ────────────────────────────────── */
.selection-bar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: var(--ft-text);
  color: var(--ft-bg);
  border-radius: 999px;
  padding: 10px 14px 10px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  z-index: 50;
  max-width: calc(100vw - 32px);
}
.selection-bar .sel-count {
  font-family: var(--ft-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.selection-bar .sel-actions { display: flex; gap: 6px; }
.selection-bar .btn {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ft-bg);
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.selection-bar .btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}
.selection-bar .btn.ghost { background: transparent; border-color: transparent; }
.selection-bar .btn.ghost:hover { background: rgba(255, 255, 255, 0.12); }

/* Empty state */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--ft-muted);
}
.empty .h2 { color: var(--ft-text); }

/* Responsive tweaks */
@media (max-width: 720px) {
  /* Drag-and-drop has no place on a touchscreen — hide the dropzone and
     promote the two action buttons to be the only file-picker UI. */
  .dropzone { display: none; }
  .upload-actions {
    margin: 0;
    gap: 10px;
  }
  .upload-actions .btn {
    height: 56px;
    font-size: 16px;
    border-width: 1.5px;
  }
}

@media (max-width: 640px) {
  .admin-stats { grid-template-columns: 1fr 1fr; }
  .admin-stats .stat-card:nth-child(3) { grid-column: span 2; }
  .admin-shell { padding: 22px 16px 60px; }
  .uploader-group summary { padding: 12px 14px; flex-wrap: wrap; }
  .uploader-meta { width: 100%; margin-left: 0; }
  .file-grid {
    padding: 12px 12px 14px;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }
  .tile-actions { opacity: 1; }   /* no hover on touch — keep visible */
  .selection-bar {
    flex-direction: column;
    border-radius: 18px;
    padding: 12px 14px;
    gap: 10px;
    width: calc(100vw - 24px);
  }
  .selection-bar .sel-actions { flex-wrap: wrap; justify-content: center; }
}

/* hidden util */
.hidden { display: none !important; }
