/* Admin styles. Brand colours from the site's tokens.css; system fonts (no third-party requests). */
:root {
  --bg: #f5ead8;
  --surface: #fffaf2;
  --line: #dcd3c4;
  --text: #201e1d;
  --muted: #645c50;
  --accent: #c67139;
  --accent-dark: #8c491a;
  --olive: #7a8a5e;
  --petrol: #1d6b70;
  --danger: #a3341f;
  --radius: 14px;
  color-scheme: only light;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent-dark); }
h1 { font-size: 1.75rem; margin: 0 0 1rem; font-weight: 600; }
h2 { font-size: 1.25rem; margin: 0 0 .75rem; font-weight: 600; }
h3 { font-size: 1rem; margin: 1.5rem 0 .5rem; }

.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2rem;
  padding: .9rem clamp(1rem, 4vw, 2.5rem); background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; text-decoration: none; color: var(--petrol); }
.brand span { font-weight: 400; color: var(--muted); margin-left: .35rem; }
.main-nav { display: flex; gap: 1.25rem; flex: 1; }
.main-nav a { color: var(--text); text-decoration: none; }
.main-nav a:hover { text-decoration: underline; }
.logout { display: flex; align-items: center; gap: .75rem; margin: 0; }
.who { color: var(--muted); }

.page { max-width: 960px; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 2.5rem) 4rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; }
.card.narrow { max-width: 440px; margin: 3rem auto; }
.muted { color: var(--muted); }

.field { display: block; margin-bottom: 1rem; font-weight: 600; font-size: .95rem; }
.field small { font-weight: 400; color: var(--muted); }
.field input, .field textarea, .field select {
  display: block; width: 100%; margin-top: .3rem; padding: .6rem .75rem;
  font: inherit; font-weight: 400; color: inherit; background: #fff;
  border: 1px solid var(--line); border-radius: 10px;
}
.field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible { outline: 2px solid var(--petrol); outline-offset: 1px; }
.field-error { display: block; color: var(--danger); font-weight: 400; font-size: .9rem; margin-top: .25rem; }

.btn {
  display: inline-block; padding: .6rem 1.2rem; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--text); }
.btn-link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-dark); text-decoration: underline; cursor: pointer; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1rem 0; }
.actions form { margin: 0; }
.links { display: flex; gap: 1.5rem; }

.flash { padding: .75rem 1rem; border-radius: 10px; margin: 0 0 1rem; }
.flash-success { background: #e4ecd6; }
.flash-error { background: #f6d9cf; color: #5c1d0f; }
.flash-info { background: #e1eeee; }
.badge { display: inline-block; padding: .3rem .8rem; border-radius: 999px; font-weight: 600; font-size: .95rem; }
.badge-warn { background: #ffe1d0; color: #643312; }
.badge-ok { background: #e4ecd6; color: #3b4a2a; }

.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { text-align: left; padding: .5rem .5rem .5rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-weight: 600; color: var(--muted); }
.status { font-weight: 600; }
.status-success { color: #3b5a2a; }
.status-failed, .status-unknown { color: var(--danger); }
.status-running, .status-queued { color: var(--petrol); }
.counts { margin: 0 0 .5rem; padding-left: 1.2rem; }

/* ---- Phase 2: lists and edit forms ---- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1.5rem; margin-bottom: .25rem; }
.page-head h1 { margin-bottom: .5rem; }
.crumbs { margin: 0 0 .5rem; }
.crumbs a { text-decoration: none; }

.tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin: 1rem 0; border-bottom: 1px solid var(--line); }
.tabs a { padding: .5rem .9rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs .count { font-size: .8rem; background: var(--line); color: var(--text); border-radius: 999px; padding: 0 .45rem; margin-left: .2rem; }

.card-table { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); border-collapse: separate; border-spacing: 0; overflow: hidden; }
.card-table th, .card-table td { padding: .75rem 1rem; }
.card-table tbody tr:last-child td { border-bottom: 0; }
.row-actions { white-space: nowrap; }
.row-actions form { display: inline; margin-left: .75rem; }
.pill { display: inline-block; font-size: .8rem; font-weight: 600; border-radius: 999px; padding: .1rem .6rem; margin: 0 .25rem .2rem 0; }
.pill-published { background: #e4ecd6; color: #3b4a2a; }
.pill-draft { background: #eee7db; color: #474238; }
.pill-trashed { background: #f6d9cf; color: #5c1d0f; }
.pill-next { background: #e1eeee; color: var(--petrol); }
.pill-past { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.danger { color: var(--danger) !important; }
.btn-secondary.danger { border-color: var(--danger); }

.meta-grid { display: grid; grid-template-columns: minmax(200px, 1fr) 2fr; gap: 0 1.5rem; }
@media (max-width: 700px) { .meta-grid { grid-template-columns: 1fr; } }
.slug-input { display: flex; align-items: center; margin-top: .3rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding-left: .75rem; }
.slug-input span { color: var(--muted); white-space: nowrap; }
.slug-input span:last-child { padding-right: .75rem; }
.field .slug-input input { border: 0; margin: 0; padding-left: .1rem; padding-right: .1rem; min-width: 0; }
.has-error .slug-input, .has-error > input, .has-error > textarea, .has-error > select { border-color: var(--danger); }

.field label { display: block; font-weight: 600; font-size: .95rem; }
.req { color: var(--accent-dark); }
.hint { margin: .3rem 0 0; font-size: .85rem; color: var(--muted); font-weight: 400; }
.field textarea { resize: vertical; line-height: 1.5; }
.field-check { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.field-check input { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--petrol); }
.field-check label { font-weight: 600; }
.field-check .hint { flex-basis: 100%; }
.image-ref { margin: .3rem 0 0; padding: .6rem .75rem; background: #fff; border: 1px dashed var(--line); border-radius: 10px; }
.counter { display: block; font-size: .8rem; color: var(--muted); text-align: right; margin-top: .2rem; }
.counter.over { color: #9a5b00; font-weight: 600; }
.counter.too-long { color: var(--danger); font-weight: 600; }

fieldset { border: 0; padding: 0; margin: 0 0 1.25rem; min-width: 0; }
legend { font-size: 1.1rem; font-weight: 600; padding: 0; margin-bottom: .6rem; }
.group { border-top: 1px solid var(--line); padding-top: 1rem; }
.list { border-top: 1px solid var(--line); padding-top: 1rem; }
.list.has-error > legend { color: var(--danger); }
.list-item { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: .75rem 1rem .25rem; margin-bottom: .75rem; }
.list .list .list-item { background: var(--surface); }
.list-item-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .5rem; }
.list-item-title { font-weight: 600; color: var(--petrol); }
.list-item-tools { display: flex; gap: .35rem; }
.btn-op { font: inherit; font-size: .85rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .15rem .55rem; cursor: pointer; color: var(--text); }
.btn-op:hover { border-color: var(--text); }
.btn-op.danger { color: var(--danger); }
.btn-add { background: transparent; border: 1px dashed var(--muted); color: var(--text); font-weight: 600; padding: .45rem 1rem; }
.btn-add:hover { border-style: solid; }
.group-body[hidden] { display: none; }

.savebar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 1.25rem; padding: .9rem 1.5rem; margin: 0 0 1.5rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 -6px 18px rgb(32 30 29 / 8%); }
.danger-zone h2 { font-size: 1rem; }
:focus-visible { outline: 2px solid var(--petrol); outline-offset: 2px; }

/* ---- Phase 3: page editor ---- */
.toc { display: flex; flex-wrap: wrap; gap: .4rem .5rem; margin: 0 0 1rem; }
.toc a { font-size: .9rem; padding: .25rem .7rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); text-decoration: none; color: var(--text); }
.toc a:hover { border-color: var(--text); }
.fields > .group:first-child, .fields > .list:first-child { border-top: 0; padding-top: 0; }
.group { scroll-margin-top: 1rem; }
.group-hint { margin: -.3rem 0 .8rem; }

/* ---- Phase 4: photos ---- */
.upload { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 1.5rem; }
.upload .field { flex: 1 1 320px; margin-bottom: .5rem; }
.upload input[type=file] { padding: .5rem; background: #fff; }
.media-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; }
.media-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.media-card a { display: block; color: var(--text); text-decoration: none; }
.media-card img { display: block; width: 100%; height: 150px; object-fit: cover; background: var(--line); }
.media-name { display: block; padding: .5rem .75rem 0; font-weight: 600; font-size: .9rem; overflow-wrap: anywhere; }
.media-meta { display: block; padding: .15rem .75rem .6rem; font-size: .8rem; color: var(--muted); }
.focus-wrap { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.25rem; align-items: start; margin: 1rem 0; }
@media (max-width: 760px) { .focus-wrap { grid-template-columns: 1fr; } }
.focus-picker { position: relative; display: inline-block; justify-self: start; align-self: start; max-width: 100%; cursor: crosshair; line-height: 0; border-radius: 10px; overflow: hidden; }
/* Portrait photos must not need scrolling: cap the height, keep the picker the size of the image. */
.focus-picker img { display: block; max-width: 100%; max-height: 65vh; width: auto; height: auto; }
.focus-dot { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--petrol), 0 2px 8px rgb(0 0 0 / 40%); pointer-events: none; display: none; }
.js .focus-dot { display: block; }
.crops { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; align-items: end; }
.crops figure { margin: 0; }
.crops figcaption { font-size: .8rem; color: var(--muted); text-align: center; margin-top: .25rem; }
.crop { overflow: hidden; border-radius: 8px; background: var(--line); }
.crop img { width: 100%; height: 100%; object-fit: cover; display: block; }
.crop-square { aspect-ratio: 1 / 1; }
.crop-wide { aspect-ratio: 16 / 9; }
.crop-portrait { aspect-ratio: 4 / 5; }
.focus-inputs { display: flex; gap: 1rem; }
.focus-inputs .field { max-width: 180px; }
.image-field { display: grid; grid-template-columns: 160px 1fr; gap: 1rem; align-items: start; margin-top: .3rem; }
.image-field .preview { width: 160px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: var(--line); display: block; }
.image-field .preview-empty { display: grid; place-items: center; width: 160px; aspect-ratio: 4 / 3; border-radius: 8px; border: 1px dashed var(--muted); color: var(--muted); font-size: .85rem; }
.image-field select { margin-top: 0; }
.image-field .hint a { white-space: nowrap; }

/* ---- Phase 5: accounts, users, history, help ---- */
.who { color: var(--muted); text-decoration: none; }
.who:hover { text-decoration: underline; }
.login-help { margin: 1rem 0 0; font-size: .95rem; }
.narrow-left { max-width: 520px; }
.users-table select, .inline-input { font: inherit; padding: .3rem .5rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.inline-input { width: 100%; max-width: 260px; }
.users-table tr.inactive td { opacity: .55; }
.users-table input[type=checkbox] { width: 1.1rem; height: 1.1rem; accent-color: var(--petrol); }
.invite-grid { display: grid; grid-template-columns: 1fr 1fr 180px; gap: 0 1rem; }
@media (max-width: 760px) { .invite-grid { grid-template-columns: 1fr; } }
.recent { margin: 0; padding-left: 1.2rem; }
.recent li { margin: .2rem 0; }
.diff th[scope=row] { color: var(--text); width: 26%; }
.diff td { white-space: pre-wrap; overflow-wrap: anywhere; }
.diff td.old { background: #fbeee8; }
.diff td.now { background: #eef4e4; }
.diff + form { margin-top: 1rem; }
.help { max-width: 760px; }
.help .lead { font-size: 1.1rem; }
.help .card h2 { font-size: 1.15rem; }
.help li { margin: .35rem 0; }
.help code { background: var(--bg); padding: .05rem .3rem; border-radius: 4px; font-size: .9em; }
.help section { scroll-margin-top: 1rem; }

/* Dashboard: changes since the last Vorschau / Veröffentlichung */
.pending { margin: 1rem 0; }
.pending-line { margin: .4rem 0; }
.pending-details { margin: .4rem 0; border: 1px solid var(--line); border-radius: 10px; padding: .5rem .9rem; background: var(--bg); }
.pending-details summary { cursor: pointer; }
.pending-details[open] summary { margin-bottom: .5rem; }
.pending-group { margin: .9rem 0; }
.pending-group h4 { margin: 0 0 .3rem; font-size: 1rem; }
.pending-group .diff { background: var(--surface); }
.kind { display: inline-block; margin-left: .4rem; padding: .05rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 600; vertical-align: middle; }
.kind-changed { background: #e1eeee; color: #164f53; }
.kind-added { background: #e4ecd6; color: #3b4a2a; }
.kind-removed { background: #f6d9cf; color: #5c1d0f; }
.kind-order { background: #efe6d6; color: var(--muted); }
.pending-diff { table-layout: fixed; }
.pending-diff th[scope=row] { width: 26%; }
@media (max-width: 640px) {
  .pending-diff thead { display: none; }
  .pending-diff, .pending-diff tbody, .pending-diff tr, .pending-diff th, .pending-diff td { display: block; width: auto !important; }
  .pending-diff tr { border-bottom: 1px solid var(--line); padding: .3rem 0; }
  .pending-diff th, .pending-diff td { border: 0; padding: .3rem .5rem; }
  .pending-diff td::before { content: attr(data-label); display: block; font-size: .8rem; font-weight: 600; color: var(--muted); }
}
