/* ─────────────────────────────────────────────────────────────────────────────
   ayanami.upload — design system
   Matches ayanami.design: pure black, monochrome, Space Grotesk, scramble UX.
───────────────────────────────────────────────────────────────────────────── */

:root {
  --bg:         #0a0a0a;
  --bg-2:       #141414;
  --bg-3:       #1c1c1c;
  --border:     #252525;
  --border-2:   #333333;
  --text:       #ebebeb;
  --text-muted: #888888;
  --text-dim:   #444444;
  --accent:     #ebebeb;
  --accent-dim: rgba(235,235,235,0.06);
  --danger:     #e05252;
  --danger-bg:  rgba(224,82,82,0.08);
  --success:    #52b788;
  --success-bg: rgba(82,183,136,0.08);
  --font:       'Space Grotesk', 'Inter', system-ui, -apple-system, sans-serif;
  --mono:       'IBM Plex Mono', 'JetBrains Mono', monospace;
  --radius:     10px;
  --radius-lg:  14px;
  --shadow:     0 4px 32px rgba(0,0,0,0.7);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--text-muted); }

img, video { max-width: 100%; display: block; }

.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.mono { font-family: var(--mono); font-size: 0.88em; }
.inline-form { display: inline; }

/* ─── Top bar ─────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 58px;
  background: rgba(10,10,10,0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.topbar-logo:hover { color: var(--text); }

.logo-img   { width: 22px; height: 22px; object-fit: contain; border-radius: 4px; }
.logo-text  { font-size: 0.95rem; letter-spacing: -0.02em; }
.logo-accent { color: var(--text-muted); }

.topbar-nav { display: flex; align-items: center; gap: 0.1rem; }

.nav-link {
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.12s, background 0.12s;
}
.nav-link:hover { color: var(--text); background: var(--bg-3); }
.nav-link--cta {
  color: var(--text);
  border: 1px solid var(--border-2);
  padding: 0.35rem 0.7rem;
}
.nav-link--cta:hover { background: var(--bg-3); color: var(--text); }
.nav-link--admin { color: #c9a84c; }
.nav-link--admin:hover { color: #c9a84c; background: rgba(201,168,76,0.08); }

.nav-btn {
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  transition: color 0.12s, background 0.12s;
}
.nav-btn:hover { color: var(--text); background: var(--bg-3); }

/* ─── Main content ────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.main-content--wide { max-width: 1400px; }

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.footer {
  width: 100%;
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  margin-top: 4rem;
}
.footer-left { display: flex; flex-direction: row; align-items: center; }
.footer-nav { display: flex; flex-direction: row; align-items: center; gap: 0.25rem; }
.footer-wordmark {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}
.footer-accent { color: var(--text-muted); }
.footer-copy { font-size: 0.72rem; color: var(--text-muted); margin-left: 0.6rem; letter-spacing: 0.02em; }
.footer-copy-sym { font-family: Georgia, 'Times New Roman', serif; font-size: 0.8rem; }
.footer-text {
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ─── Legal page ──────────────────────────────────────────────────────────── */
.legal-list { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 0.5rem; }
.legal-item {
  display: flex;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.legal-num {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  padding-top: 0.1rem;
  width: 1.2rem;
}
.legal-item strong { color: var(--text); font-weight: 600; }
.legal-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.legal-meta { color: var(--text-dim); font-size: 0.75rem; }
.legal-meta a { color: var(--text-muted); text-decoration: underline; text-decoration-color: var(--border-2); }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  border: 1px solid var(--border-2);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  text-decoration: none;
  white-space: nowrap;
}
.btn--accent {
  background: var(--bg-3);
  color: var(--text);
  border-color: var(--border-2);
}
.btn--accent:hover { background: var(--bg-2); color: var(--text); border-color: #444; }
.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn--ghost:hover { background: var(--bg-2); color: var(--text); border-color: var(--border-2); }
.btn--danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(224,82,82,0.2);
}
.btn--danger:hover { background: rgba(224,82,82,0.15); }
.btn--full { width: 100%; }
.btn--sm { padding: 0.45rem 1rem; font-size: 0.72rem; }
.btn--xs { padding: 0.28rem 0.65rem; font-size: 0.68rem; }

/* ─── Hero ────────────────────────────────────────────────────────────────── */
.hero {
  padding: 5rem 0 3rem;
  text-align: center;
}
.hero-content { max-width: 580px; margin: 0 auto; }
.hero-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.hero-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
}
.hero-wordmark {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text);
}
.hero-sub {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-weight: 400;
}
.hero-auth-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-size: 0.875rem;
}

/* ─── Upload section ──────────────────────────────────────────────────────── */
.upload-section { max-width: 600px; margin: 0 auto 4rem; }

.upload-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.dropzone {
  padding: 3.5rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  border: 1px dashed var(--border-2);
  border-radius: calc(var(--radius-lg) - 1px);
  margin: 1px;
}
.dropzone:hover, .dropzone.drag-over {
  background: var(--bg-3);
  border-color: #555;
}
.dropzone-icon { color: var(--text-dim); margin-bottom: 1rem; }
.dropzone.drag-over .dropzone-icon { color: var(--text-muted); }
.dropzone-label { font-size: 1rem; font-weight: 500; color: var(--text); margin-bottom: 0.4rem; }
.dropzone-hint { font-size: 0.8rem; color: var(--text-muted); }
.file-input-label {
  color: var(--text);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--border-2);
}
.file-input-label:hover { text-decoration-color: var(--text-muted); }

/* Progress */
.upload-progress { padding: 2rem; text-align: center; }
.progress-bar {
  height: 2px;
  background: var(--bg-3);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.progress-fill {
  height: 100%;
  background: var(--text);
  border-radius: 9999px;
  transition: width 0.15s ease;
}
.progress-fill--error { background: var(--danger); }
.progress-label { font-size: 0.85rem; color: var(--text-muted); }

/* Result card */
.result-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.result-preview {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  max-height: 420px;
  overflow: hidden;
}
.result-img, .result-video { width: 100%; max-height: 420px; object-fit: contain; }
.result-info { padding: 1.25rem 1.5rem; }
.result-url-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.result-url {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  word-break: break-all;
  flex: 1;
}
.result-meta { font-size: 0.78rem; color: var(--text-dim); }

/* ─── Viewer ──────────────────────────────────────────────────────────────── */
.viewer-container { margin: 2rem 0 4rem; }
.viewer-media {
  background: #000;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  max-height: 80vh;
}
.viewer-img { width: 100%; max-height: 80vh; object-fit: contain; }
.viewer-video { width: 100%; max-height: 80vh; }
.viewer-unknown {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem;
  color: var(--text-muted);
}
.viewer-meta-bar {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.viewer-filename-wrap { display: flex; align-items: center; gap: 0; margin-bottom: 0.2rem; }
.viewer-filename { font-weight: 600; font-size: 0.95rem; word-break: break-all; }
.viewer-filename-wrap .inline-edit-form { margin-bottom: 0; }
.viewer-uploader { font-size: 0.78rem; color: var(--text-muted); display: block; margin-bottom: 0.4rem; }
.viewer-stats { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.stat {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.76rem;
  color: var(--text-muted);
}
.stat--type {
  font-family: var(--mono);
  font-size: 0.7em;
  background: var(--bg-3);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}
.stat--expiry {
  color: #c9a84c;
  font-size: 0.8em;
}
.viewer-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* ─── Auth pages ──────────────────────────────────────────────────────────── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 58px - 80px);
  padding: 2rem 0;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
}
.auth-header { margin-bottom: 1.75rem; }
.auth-title { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.03em; }
.auth-sub { color: var(--text-muted); font-size: 0.875rem; margin-top: 0.25rem; }
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-footer-text {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 1.25rem;
}
.auth-link { color: var(--text); text-decoration: underline; text-decoration-color: var(--border-2); }
.auth-link:hover { text-decoration-color: var(--text-muted); }

/* ─── Form elements ───────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.form-input {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.7rem 0.95rem;
  transition: border-color 0.15s;
  outline: none;
  width: 100%;
}
.form-input:focus { border-color: var(--border-2); }
.form-input::placeholder { color: var(--text-dim); }

.form-card {
  max-width: 480px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}
.form-card + .form-card { margin-top: 1.5rem; }
.form-cards-row { display: flex; gap: 2rem; align-items: flex-start; flex-wrap: wrap; }
.form-cards-row .form-card { flex: 1; min-width: 280px; max-width: none; }
.form-cards-row .form-card + .form-card { margin-top: 0; }
.danger-zone { border-color: rgba(224,82,82,0.25); }
.danger-title { color: var(--danger); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.5rem; }

/* ─── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
.alert--error  { background: var(--danger-bg); border: 1px solid rgba(224,82,82,0.2); color: var(--danger); }
.alert--success { background: var(--success-bg); border: 1px solid rgba(82,183,136,0.2); color: var(--success); }

/* ─── Dashboard layout ────────────────────────────────────────────────────── */
.dash-layout {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 2.5rem;
  padding: 2.5rem 0 4rem;
  align-items: start;
}

@media (max-width: 768px) {
  .dash-layout { grid-template-columns: 1fr; }
}

.dash-sidebar { position: sticky; top: 74px; }
.dash-nav { display: flex; flex-direction: column; gap: 1px; }
.dash-nav-item {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.12s, background 0.12s;
}
.dash-nav-item:hover { color: var(--text); background: var(--bg-2); }
.dash-nav-item--active { color: var(--text); background: var(--bg-3); }
.dash-nav-item--active:hover { color: var(--text); background: var(--bg-3); }

.dash-main { min-width: 0; }
.dash-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.dash-title { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.03em; }
.count-badge {
  display: inline-block;
  background: var(--bg-3);
  border-radius: 9999px;
  padding: 0.1rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  vertical-align: middle;
  margin-left: 0.5rem;
}

/* ─── Stats grid ──────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}
.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.stat-card--admin { border-color: rgba(201,168,76,0.2); }
.stat-card-value { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.03em; word-break: break-all; margin-bottom: 0.25rem; }
.stat-card-label { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.stat-card-link { display: inline-block; margin-top: 0.75rem; font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 700; }
.stat-card-link:hover { color: var(--text); }

/* ─── Section ─────────────────────────────────────────────────────────────── */
.section { margin-bottom: 2.5rem; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.section-title { font-size: 0.68rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.09em; }
.section-link { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 700; }
.section-link:hover { color: var(--text); }

/* ─── File grid ───────────────────────────────────────────────────────────── */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}
.file-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.12s;
}
.file-card:hover { border-color: var(--border-2); }

.file-card-preview { display: block; }
.file-thumb { width: 100%; height: 120px; object-fit: cover; display: block; }
.file-thumb--video, .file-thumb--file {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-3);
  color: var(--text-dim);
  font-size: 1.5rem;
}
.file-card-meta { padding: 0.5rem 0.75rem; display: flex; justify-content: space-between; align-items: center; }
.file-name { font-size: 0.75rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100px; }
.file-stat { font-size: 0.68rem; color: var(--text-muted); }
.file-card-actions { display: flex; gap: 0.25rem; padding: 0 0.5rem 0.5rem; }

/* ─── Files table ─────────────────────────────────────────────────────────── */
.files-table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.files-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.files-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.files-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.files-table tr:last-child td { border-bottom: none; }
.files-table tbody tr { background: var(--bg); transition: background 0.1s; }
.files-table tbody tr:hover { background: var(--bg-2); }
.files-table tbody tr.row--banned { opacity: 0.45; }

.td-thumb { width: 56px; }
.td-name  { max-width: 220px; overflow: hidden; }
.td-actions { white-space: nowrap; }
.td-actions > * + * { margin-left: 0.25rem; }
.td-shortid { max-width: 160px; overflow: hidden; }
.td-owner { max-width: 120px; overflow: hidden; }
.file-link { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.short-id { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.inline-display { display: flex; align-items: center; gap: 0; min-width: 0; }
.inline-display .file-link { flex: 1; min-width: 0; }
.btn-edit-icon {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; -webkit-appearance: none; appearance: none;
  cursor: pointer; color: var(--text-dim); padding: 0.15rem; border-radius: 6px;
  transition: color 0.12s, background 0.12s;
  flex-shrink: 0;
}
.btn-edit-icon:hover { color: var(--text-muted); background: var(--bg-3); }
.inline-edit-form {
  display: flex; align-items: stretch; min-width: 0;
  border: 1px solid var(--border-2); border-radius: var(--radius);
  background: var(--bg-3); overflow: hidden;
}
.inline-edit-form:focus-within { border-color: #444; }
.inline-edit-input {
  font-size: 0.78rem; padding: 0.3rem 0.6rem;
  background: var(--bg-3); border: none; color: var(--text);
  flex: 1; min-width: 60px; font-family: inherit; outline: none;
  -webkit-appearance: none; appearance: none;
}
.inline-edit-input.mono { font-family: var(--mono); }
.inline-edit-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-3); border: none; border-left: 1px solid var(--border);
  -webkit-appearance: none; appearance: none;
  cursor: pointer; color: var(--text-muted);
  font-family: var(--font); font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0 0.65rem; white-space: nowrap;
  transition: background 0.1s, color 0.1s;
}
.inline-edit-btn:hover { background: var(--bg-2); color: var(--text); }
.inline-edit-btn--cancel { color: var(--text-dim); }
.inline-edit-btn--cancel:hover { color: var(--text-muted); background: var(--bg-2); }

.table-thumb { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; display: block; }
.table-thumb--video-el { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; display: block; background: var(--bg-3); }
.gallery-thumb--video-el { width: 100%; height: 100%; object-fit: cover; display: block; background: var(--bg-3); }
.file-card-thumb--video-el { width: 100%; height: 100%; object-fit: cover; display: block; background: var(--bg-3); }
.table-thumb--video, .table-thumb--file {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-3); color: var(--text-dim); font-size: 0.9rem; border-radius: 6px;
}

.file-link { color: var(--text); font-size: 0.88rem; }
.file-link:hover { color: var(--text-muted); }
.short-id { display: block; font-family: var(--mono); font-size: 0.68rem; color: var(--text-dim); margin-top: 1px; }

/* ─── Badges ──────────────────────────────────────────────────────────────── */
.mime-badge {
  display: inline-block; background: var(--bg-3); padding: 0.15rem 0.5rem;
  border-radius: 4px; font-family: var(--mono); font-size: 0.68rem; color: var(--text-muted);
}
.role-badge {
  display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
}
.role-badge--admin { background: rgba(201,168,76,0.1); color: #c9a84c; }
.role-badge--user  { background: var(--bg-3); color: var(--text-muted); }
.badge {
  display: inline-block; padding: 0.15rem 0.5rem; border-radius: 9999px;
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
}
.badge--red   { background: var(--danger-bg); color: var(--danger); }
.badge--green { background: var(--success-bg); color: var(--success); }
.self-badge   { display: inline-block; font-size: 0.66rem; color: var(--text-dim); margin-left: 0.25rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }

/* ─── Admin ───────────────────────────────────────────────────────────────── */
.admin-badge {
  display: inline-block; font-size: 0.6rem; letter-spacing: 0.14em; font-weight: 700;
  color: #c9a84c; background: rgba(201,168,76,0.08); border: 1px solid rgba(201,168,76,0.2);
  padding: 0.2rem 0.6rem; border-radius: 4px; margin-bottom: 0.75rem;
}

.quick-links { margin-top: 2rem; }
.quick-links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 1rem; margin-top: 1rem; }
.quick-link-card {
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  padding: 1.5rem 1rem; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); color: var(--text-muted);
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.quick-link-card:hover { border-color: var(--border-2); color: var(--text); background: var(--bg-3); }
.ql-icon  { font-size: 1.4rem; }
.ql-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; }

/* ─── Pagination ──────────────────────────────────────────────────────────── */
.pagination { display: flex; gap: 0.4rem; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }
.page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius);
  font-size: 0.78rem; font-weight: 700;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text-muted);
  transition: all 0.12s;
}
.page-btn:hover { color: var(--text); border-color: var(--border-2); }
.page-btn--active { background: var(--bg-3); border-color: var(--border-2); color: var(--text); }

/* ─── Search form ─────────────────────────────────────────────────────────── */
.search-form { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.search-input { flex: 1; min-width: 200px; }

/* ─── Error pages ─────────────────────────────────────────────────────────── */
.error-page {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; min-height: calc(100vh - 58px - 80px); padding: 2rem; gap: 1rem;
}
.error-code { font-size: clamp(5rem, 15vw, 8rem); font-weight: 700; letter-spacing: -0.05em; line-height: 1; color: var(--bg-3); }
.error-title { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.03em; }
.error-desc { color: var(--text-muted); font-size: 0.9rem; }
.error-debug {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; font-family: var(--mono); font-size: 0.8rem; color: var(--danger);
  text-align: left; max-width: 600px; overflow-x: auto; white-space: pre-wrap; word-break: break-all;
}

.empty-state {
  text-align: center; padding: 3rem; background: var(--bg-2);
  border: 1px dashed var(--border); border-radius: var(--radius-lg); color: var(--text-muted);
}
.empty-state a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border-2); }

/* ─── Chatterino / docs page ─────────────────────────────────────────────── */
.docs-page {
  max-width: 740px;
  margin: 0 auto;
  padding: 3rem 0 5rem;
}
.docs-page h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: 0.4rem;
}
.docs-page .docs-sub {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 3rem;
}
.docs-section { margin-bottom: 2.5rem; }
.docs-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.docs-section p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 0.75rem;
}
.docs-section p:last-child { margin-bottom: 0; }
.docs-section strong { color: var(--text); font-weight: 600; }

.docs-settings {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.docs-settings-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  border-bottom: 1px solid var(--border);
}
.docs-settings-row:last-child { border-bottom: none; }
.docs-settings-key {
  padding: 0.9rem 1.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: var(--bg-3);
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
}
.docs-settings-val {
  padding: 0.9rem 1.25rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text);
  word-break: break-all;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.docs-settings-val .docs-note {
  font-family: var(--font);
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
}

.docs-steps { list-style: none; counter-reset: steps; display: flex; flex-direction: column; gap: 0.9rem; }
.docs-steps li {
  counter-increment: steps;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 1rem;
  align-items: start;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.65;
}
.docs-steps li::before {
  content: counter(steps);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.docs-steps strong { color: var(--text); }

.code-block {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  overflow-x: auto;
  white-space: pre;
  line-height: 1.7;
  margin-top: 0.5rem;
}
.code-block .hl { color: var(--text); }

@media (max-width: 640px) {
  .docs-settings-row { grid-template-columns: 1fr; }
  .docs-settings-key { border-right: none; border-bottom: 1px solid var(--border); }
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .topbar { padding: 0 1rem; }
  .main-content { padding: 0 1rem; }
  .hero { padding: 3rem 0 2rem; }
  .upload-section { margin-bottom: 2rem; }
  .dropzone { padding: 2rem 1rem; }
  .viewer-meta-bar { flex-direction: column; align-items: flex-start; }
  .viewer-actions { width: 100%; }
  .viewer-actions .btn { flex: 1; justify-content: center; }
  .auth-card { padding: 1.75rem; }
  .dash-sidebar { position: static; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .admin-gallery-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ─── Admin Gallery ────────────────────────────────────────────────────────── */
.admin-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.gallery-item {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.gallery-thumb-wrap {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg-3);
}
.gallery-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.15s;
}
.gallery-thumb-wrap:hover .gallery-thumb { opacity: 0.75; }
.gallery-thumb--video {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.gallery-meta {
  padding: 0.45rem 0.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  border-top: 1px solid var(--border);
}
.gallery-owner {
  font-size: 0.7rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.gallery-delete {
  display: block;
  width: 100%;
  border-radius: 0;
  border-top: 1px solid var(--border);
}
