:root {
  --accent: #2F5D4A;
  --ground: #F6F4EF;
  --ink: #1F2A24;
  --muted: #4A544E;
  --line: #DDD8CC;
  --line-2: #ECE8DE;
  --chip: #F1EEE6;
  --danger: #A3321C;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 16px/1.5 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif; }
a { color: var(--accent); }
h1, h2 { font-family: 'Lora', Georgia, serif; font-weight: 600; line-height: 1.2; }
h1 { font-size: 30px; margin: 0; }
h2 { font-size: 20px; margin: 0 0 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
code { background: var(--chip); padding: 1px 6px; border-radius: 4px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1100px; margin: 0 auto; padding: 12px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; }
.topbar .brand { font-family: 'Lora', Georgia, serif; font-weight: 700; font-size: 20px; color: var(--ink); text-decoration: none; margin-right: auto; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.topbar nav a { text-decoration: none; color: var(--muted); padding: 10px 0; }
.topbar nav a.on { color: var(--ink); font-weight: 600; }
.topbar .who { font-size: 13px; color: var(--muted); background: var(--chip); padding: 4px 10px; border-radius: 99px; white-space: nowrap; }
.tag.role-admin { background: #E3EEE8; color: #1E3F31; }
.tag.role-editor { background: #F6EBD7; color: #6B4510; }
.tag.role-viewer { background: #E9E6EF; color: #3E3550; }
table.list td.when { white-space: nowrap; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form select, .inline-form input:not([type=checkbox]) { width: auto; min-width: 150px; }
.inline-form label.check { min-height: 44px; }
details.reset summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; min-height: 36px; display: flex; align-items: center; }

.page { max-width: 1100px; margin: 0 auto; padding: 28px 20px 64px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.box { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 20px; }

.btn { min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid #CFC9BB; background: #fff; color: var(--ink); font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--danger); border-color: #E3B9AE; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.flash { padding: 12px 16px; border-radius: 8px; }
.flash.ok { background: #E3EEE8; color: #1E3F31; }
.flash.err { background: #F8E3DD; color: #7A2412; }

form.stack, .stack { display: flex; flex-direction: column; gap: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; color: var(--ink); min-height: 44px; }
label.check input { width: 20px; height: 20px; }
input:not([type=checkbox]):not([type=file]), select, textarea { font: inherit; font-weight: 400; color: var(--ink); border: 1px solid #CFC9BB; border-radius: 8px; padding: 9px 12px; min-height: 44px; background: #FBFAF7; width: 100%; }
textarea { min-height: 140px; resize: vertical; }
.hint { font-size: 13px; color: var(--muted); font-weight: 400; }

table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 13px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.list td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table-box { overflow-x: auto; }
.tag { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--chip); color: var(--muted); white-space: nowrap; }

.rows { display: flex; flex-direction: column; }
.row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line-2); }
.row:first-child { border-top: 0; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photo { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #FBFAF7; display: flex; flex-direction: column; }
.photo img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.photo .meta { padding: 8px; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.photo.main { outline: 3px solid var(--accent); }

.auth { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.auth-box { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.auth-box p { margin: 0; }
