:root {
  --bg: #f6f7f9; --surface: #ffffff; --text: #1d2330; --muted: #667085;
  --border: #dde1e7; --accent: #4f6bed; --accent-text: #fff; --danger: #d64545;
  --ok: #1f9d55;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161b; --surface: #1d2027; --text: #e6e8ec; --muted: #9aa1ad;
    --border: #2e323b; --accent: #7088ff; --danger: #ff6b6b; --ok: #4ade80;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column; min-height: 100vh;
}
a { color: var(--accent); }
main { flex: 1; width: 100%; max-width: 1000px; margin: 0 auto; padding: 24px 16px; }
h1 { margin-top: 0; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.success { color: var(--ok); }
.notice { border-color: var(--accent); }
.notice p { margin: 0 0 6px; }
.error-image { display: block; max-width: 100%; max-height: 50vh; margin: 0 auto 12px; }

.topbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 1.2rem; text-decoration: none; color: var(--text); }
.topbar nav { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.topbar nav a { text-decoration: none; }
footer { text-align: center; padding: 16px; color: var(--muted); font-size: 0.9rem; }

button, .button {
  display: inline-block; font: inherit; cursor: pointer; text-decoration: none;
  padding: 8px 16px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-text);
}
button.secondary, .button.secondary { background: transparent; color: var(--accent); }
button.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
button.small, .button.small { padding: 3px 10px; font-size: 0.85rem; }
button.link { background: none; border: none; color: var(--accent); padding: 0; }
form.inline { display: inline; }
form.row { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }

input, select, textarea {
  font: inherit; padding: 8px 10px; border-radius: 8px; color: var(--text);
  border: 1px solid var(--border); background: var(--bg); max-width: 100%;
}
label { display: block; margin-bottom: 12px; }
.card label input, .card label textarea { display: block; width: 100%; margin-top: 4px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.narrow { max-width: 420px; margin: 24px auto; }
.prose { max-width: 720px; margin: 0 auto; }
.hero { text-align: center; padding: 48px 0 16px; }
.center { text-align: center; }
/* Home page: the logo fills whatever space is left below the upload section, so the page never scrolls */
main.fill { display: flex; flex-direction: column; }
.logo { display: block; flex: 1 1 0; min-height: 80px; width: 100%; object-fit: contain; margin-top: 16px; }

.dropzone {
  border: 2px dashed var(--border); border-radius: 16px; padding: 48px 16px;
  text-align: center; background: var(--surface); cursor: pointer;
}
.dropzone.over, .dropzone:focus { border-color: var(--accent); outline: none; }
.expiry { margin: 16px 0; }
.uploads { list-style: none; padding: 0; }
.uploads li { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 8px; }
.uploads li .name { font-weight: 600; overflow-wrap: anywhere; }
.uploads progress { width: 100%; }
.uploads li.ok progress { accent-color: var(--ok); }
.uploads li.failed .status { color: var(--danger); }
.uploads .status a { overflow-wrap: anywhere; }

table.files { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 10px; overflow: hidden; display: block; overflow-x: auto; }
table.files th, table.files td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
table.files th { font-size: 0.85rem; color: var(--muted); }
table.files td:has(.thumb) { padding: 4px 6px; }
.thumb { display: block; width: 48px; height: 48px; object-fit: cover; border-radius: 6px; background: var(--bg); }
.clip { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions { display: flex; gap: 6px; }
.pager { display: flex; gap: 16px; }
.badge { font-size: 0.75rem; background: var(--accent); color: var(--accent-text); border-radius: 6px; padding: 1px 6px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.tile img, .tile video { width: 100%; height: 180px; object-fit: cover; border-radius: 6px; background: var(--bg); }
.tile audio { width: 100%; }
.tile figcaption { font-size: 0.85rem; }
.fileicon { height: 180px; display: grid; place-items: center; font-size: 1.6rem; font-weight: 700; color: var(--muted); background: var(--bg); border-radius: 6px; }
.pick .tile { cursor: pointer; }
.pick .tile:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
