:root {
  --bg: #f6f6f4; --fg: #1d1d1b; --muted: #85857f; --card: #fff;
  --line: #e2e2dd; --accent: #2f5bea; --danger: #c93a2f;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #151514; --fg: #ececea; --muted: #8a8a84; --card: #1f1f1d; --line: #33332f; --accent: #6d8dff; --danger: #ff6b5e; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.4 system-ui, sans-serif; background: var(--bg); color: var(--fg); }
header { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
header form { display: flex; gap: 12px; align-items: center; }
main { max-width: 1100px; margin: 0 auto; padding: 20px 16px; }
.muted { color: var(--muted); }
button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--fg); border-radius: 6px; padding: 5px 10px; }
button:hover { border-color: var(--accent); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }
button.danger { color: var(--danger); }
input { font: inherit; }

.login { max-width: 320px; margin-top: 15vh; }
.login form { display: flex; flex-direction: column; gap: 10px; }
.login input { padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--fg); }
.login button { padding: 10px; background: var(--accent); color: #fff; border: 0; }
.error { color: var(--danger); white-space: pre-line; }

.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 36px 16px; border: 2px dashed var(--line); border-radius: 10px; cursor: pointer; text-align: center; }
.drop.over, .drop:hover { border-color: var(--accent); }
.drop progress { width: 60%; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 8px; white-space: pre-line; max-width: 90vw; }
#toast.error { background: var(--danger); color: #fff; }
.empty { text-align: center; margin-top: 30px; }

.grid { list-style: none; padding: 0; margin: 24px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.thumb { display: flex; align-items: center; justify-content: center; height: 160px; background: repeating-conic-gradient(var(--line) 0 25%, transparent 0 50%) 0 0 / 16px 16px; }
.thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pdf { font-weight: 700; font-size: 28px; color: var(--danger); background: var(--card); padding: 18px 22px; border-radius: 8px; }
.meta { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px 4px; font-size: 13px; }
.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.url { margin: 4px 10px; padding: 5px 7px; font-size: 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); color: var(--fg); }
.actions { display: flex; gap: 6px; padding: 6px 10px 10px; flex-wrap: wrap; }
.actions button { font-size: 13px; padding: 3px 8px; }
.actions .danger { margin-left: auto; }
