:root {
  --accent: #888;
  --ink: #1a1a1a;
  --muted: #666;
  --line: #e3e3e3;
  --bg: #f7f6f4;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .6rem 1.2rem; background: #fff; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; text-decoration: none; color: var(--ink); }
.brand-logo { height: 44px; width: auto; }
.brand-name { font-weight: 700; font-size: 1.15rem; }
.topnav { display: flex; gap: 1rem; align-items: center; }
.topnav a { color: var(--muted); text-decoration: none; }
.topnav a:hover { color: var(--ink); }
.inline-form { display: inline; margin: 0; }
.linklike { background: none; border: none; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
.linklike:hover { color: var(--ink); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.narrow { max-width: 620px; margin: 0 auto; }
.center { text-align: center; }

.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1.4rem 1.5rem; }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; }
h2 { font-size: 1.1rem; margin: 1.2rem 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.mono { font-family: ui-monospace, Consolas, monospace; word-break: break-all; }

.brand-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.brand-card { display: flex; flex-direction: column; align-items: center; gap: .8rem; padding: 2rem; text-decoration: none; color: var(--ink); border-top: 4px solid var(--accent); }
.brand-card:hover { box-shadow: 0 4px 18px rgba(0,0,0,.08); }
.brand-card img { height: 60px; width: auto; }
.brand-card span { font-weight: 600; }

.upload-form label, .edit-form label { display: block; margin: .9rem 0 .3rem; font-weight: 600; }
input[type="text"], input[type="email"], input[type="search"], input[type="password"], select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff;
}
.file-field input[type="file"] { padding: .8rem; border: 2px dashed var(--line); border-radius: 10px; width: 100%; background: #fafafa; }
.hint { display: block; color: var(--muted); font-size: .82rem; margin-top: .25rem; font-weight: 400; }
.file-list { display: block; margin-top: .4rem; font-size: .85rem; color: var(--muted); font-weight: 400; }
.consent { display: flex; gap: .6rem; align-items: flex-start; font-weight: 500; }
.consent input { margin-top: .3rem; }
.release-summary { font-size: .85rem; color: var(--muted); background: #faf8f2; border: 1px solid var(--line); border-radius: 8px; padding: .7rem .9rem; }
.release-body { line-height: 1.55; white-space: pre-line; }

.btn {
  display: inline-block; background: var(--accent, #333); color: var(--accent-ink, #fff); border: none; border-radius: 8px;
  padding: .55rem 1.1rem; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn.big { width: 100%; padding: .8rem; font-size: 1.05rem; margin-top: 1rem; }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.errors { color: #a10000; background: #fff0f0; border: 1px solid #f0c0c0; border-radius: 8px; padding: .6rem .9rem; margin: .6rem 0; }
.errors ul { margin: 0; padding-left: 1.1rem; }

.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin: .8rem 0 1rem; }
.filters select, .filters input[type="search"] { width: auto; min-width: 140px; }
.filters input[type="search"] { flex: 1; min-width: 200px; }
.filters .check { display: flex; align-items: center; gap: .3rem; margin: 0; font-weight: 400; }

.gallery-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: .8rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .8rem; }
.cell { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.cell img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.selbox { position: absolute; top: .4rem; left: .4rem; width: 1.1rem; height: 1.1rem; z-index: 2; }
.cell-meta { display: flex; justify-content: space-between; align-items: center; padding: .35rem .5rem 0; }
.cell-cap { padding: 0 .5rem .5rem; font-size: .8rem; color: var(--muted); }
.badge { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; border-radius: 4px; padding: .12rem .4rem; color: #fff; }
.badge-abbey { background: #b8860b; }
.badge-mack { background: #1f3a5f; }

.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin-top: 1.4rem; }

.detail { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 1.4rem; }
.detail-img img { width: 100%; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.detail-side .meta { display: grid; grid-template-columns: 90px 1fr; gap: .35rem .8rem; font-size: .9rem; }
.detail-side .meta dt { font-weight: 600; color: var(--muted); }
.detail-side .meta dd { margin: 0; }
.actions { display: flex; gap: .6rem; margin: 1rem 0; }

.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 2rem 1rem; border-top: 1px solid var(--line); background: #fff; }
.foot a { color: var(--muted); }

@media (max-width: 720px) {
  .detail { grid-template-columns: 1fr; }
}
