:root {
  --bg: #f4f1ea;
  --ink: #1c1917;
  --muted: #78716c;
  --card: #fffdf8;
  --line: #e7e0d5;
  --accent: #0f766e;
  --danger: #b91c1c;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  background:
    radial-gradient(circle at top left, #efe7d8 0, transparent 40%),
    linear-gradient(180deg, #f7f3eb, var(--bg));
  color: var(--ink);
  min-height: 100vh;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.brand {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--ink);
  font-size: 1.2rem;
}
nav a { color: var(--accent); margin-left: 1rem; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}
.auth { max-width: 420px; margin: 3rem auto; }
label { display: block; margin-bottom: 1rem; }
input, select, button {
  font: inherit;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}
button {
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 600;
}
.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.check { display: flex; align-items: center; gap: 0.4rem; font-size: 0.95rem; }
.check input { width: auto; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.75rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
a { color: var(--accent); }
.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--danger); }
.pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  background: #e7e5e4;
}
.pill.ready { background: #d1fae5; }
.pill.queued, .pill.ocr { background: #fef3c7; }
.pill.error, .pill.purged { background: #fee2e2; }
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; }
.md, pre { white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }
details summary { cursor: pointer; font-weight: 600; }
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
}
.gallery-item {
  display: block;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  aspect-ratio: 4 / 3;
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
@media (max-width: 640px) {
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
