:root {
  color-scheme: light;
  --ink: #222035;
  --muted: #605d71;
  --line: #dbd8e4;
  --paper: #f8f7f3;
  --surface: #fff;
  --accent: #5530ae;
  --accent-hover: #492794;
  --rail: #272039;
  --focus: #7751db;
  --shadow: 0 12px 36px rgb(35 26 58 / .09);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
}
*, *::before, *::after { box-sizing: border-box; }
html { overscroll-behavior: none; scroll-padding-bottom: 8rem; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .75; }
:where(a, button, input, select, textarea, summary):focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
a { color: var(--accent); text-underline-offset: .18em; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 4.5vw, 3.05rem); letter-spacing: -.04em; line-height: 1.12; overflow-wrap: anywhere; }
h2 { font-size: 1.2rem; letter-spacing: -.015em; line-height: 1.3; }
p { line-height: 1.56; }
.sr-only { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }
.skip { position: fixed; top: .7rem; left: .7rem; z-index: 5; padding: .7rem 1rem; background: white; border-radius: .4rem; transform: translateY(-180%); }
.skip:focus { transform: translateY(0); }
[hidden] { display: none !important; }

.app { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--rail); color: #fff; padding: 2.15rem 1.1rem 1.5rem; }
.rail-menu:has(> summary[hidden]), .rail-menu:has(> summary[hidden])::details-content { display: contents; }
.rail-panel { min-height: 0; flex: 1; display: flex; flex-direction: column; overflow-y: auto; }
[data-compact-menu] > summary { display: flex; align-items: center; gap: .55rem; width: fit-content; min-height: 44px; padding: .4rem .6rem; border-radius: .4rem; font-weight: 660; cursor: pointer; list-style: none; }
[data-compact-menu] > summary::-webkit-details-marker { display: none; }
.menu-bars { display: inline-flex; align-items: center; flex: none; width: 1.05em; height: .8em; border-block: 2px solid currentColor; }
.menu-bars::before { content: ''; width: 100%; border-top: 2px solid currentColor; }
.app-brand { align-self: flex-start; display: inline-flex; align-items: center; gap: .75rem; color: white; text-decoration: none; font-size: 1.23rem; font-weight: 760; line-height: 1.12; letter-spacing: -.035em; margin: 0 .6rem 2.5rem; }
.brand-mark { display: inline-block; flex: 0 0 auto; width: 40px; height: 40px; border-radius: 13px; background: #eac9fc; position: relative; }
.brand-mark::before, .brand-mark::after { position: absolute; content: ''; background: #45217c; width: 12px; height: 20px; border-radius: 2px 8px 2px 3px; top: 10px; left: 8px; }
.brand-mark::after { left: 21px; border-radius: 8px 2px 3px 2px; background: #8457ac; }
.rail nav ul { padding: 0; list-style: none; margin: .8rem 0 0; display: grid; gap: .24rem; }
.rail nav a { display: flex; align-items: center; min-height: 44px; gap: .6rem; border-radius: .58rem; padding: .6rem .65rem; color: #f9f5ff; text-decoration: none; font-size: .93rem; font-weight: 610; }
.rail nav a:hover { background: #3c314c; }
.rail nav a[aria-current="page"] { background: #463558; color: #fff; }
.site-dot, .local-mode span { width: .65rem; height: .65rem; border-radius: 50%; flex: 0 0 auto; }
.site-dot.theatre { background: #eb91b7; }
.site-dot.journal { background: #acd4b0; }
.local-mode { margin: auto .6rem 0; display: flex; align-items: center; gap: .56rem; color: #d6ccdf; font-size: .86rem; }
.local-mode span { width: .48rem; height: .48rem; background: #a9ceb7; }

.admin-main { max-width: 1240px; width: 100%; margin: 0 auto; padding: clamp(1rem, 4.6vw, 4.5rem) clamp(1rem, 4.8vw, 4.4rem) 3rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 1.3rem; margin: .5rem 0 2rem; }
.page-head p:not(.context) { color: var(--muted); margin-top: .55rem; font-size: 1.02rem; }
.back { display: inline-block; margin: 0 0 1.35rem; font-weight: 650; }
.context { color: #5e427e; font-weight: 700; font-size: .95rem; margin: 0 0 .55rem; }
.context span { color: #897996; padding-inline: .25rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; min-height: 46px; padding: .58rem .95rem; border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: .55rem; font-weight: 700; text-decoration: none; font-size: .93rem; line-height: 1.3; text-align: center; }
.button:hover { background: var(--accent-hover); }
.button.secondary { color: var(--accent); border-color: #c7b8e0; background: #fff; }
.button.secondary:hover { background: #f2ebfd; }
.button.compact { min-height: 40px; font-size: .88rem; padding-inline: .72rem; }
.text-button { border: none; color: var(--accent); background: none; padding: .52rem .25rem; min-height: 40px; font-size: .91rem; font-weight: 650; text-align: left; text-underline-offset: .18em; text-decoration: underline; }
.text-button:hover { color: #351386; }
.site-cards { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1.4rem; }
.site-card { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 1.05rem; box-shadow: var(--shadow); }
.tile-image { height: clamp(145px, 18vw, 260px); display: block; overflow: hidden; }
.tile-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-image.theatre { background: #222036; }
.tile-image.journal { background: #47665c; }
.tile-copy { padding: clamp(1.05rem, 2.8vw, 1.65rem); }
.tile-copy h2 { font-size: clamp(1.25rem, 2.15vw, 1.65rem); }
.tile-copy h2 a { color: inherit; text-decoration: none; }
.tile-copy h2 a:hover { color: var(--accent); }
.tile-copy p { margin: .45rem 0 1.1rem; color: var(--muted); }
.tile-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; padding-top: .85rem; border-top: 1px solid var(--line); }
.tile-foot > span { font-size: .9rem; color: var(--muted); }

.page-list, .model-card, .field, .review-panel, .confirm-card { background: var(--surface); border: 1px solid var(--line); border-radius: .95rem; }
.list-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; padding: 1.15rem 1.3rem; gap: .75rem; }
.count { font-size: .9rem; color: var(--muted); padding-left: .44rem; }
.search { width: min(100%, 17rem); }
.search label { font-size: .85rem; margin-bottom: .3rem; }
.search input { min-height: 42px; }
.page-rows { margin: 0; padding: 0; list-style: none; }
.page-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: .8rem; color: var(--ink); text-decoration: none; padding: .8rem 1.3rem; min-height: 64px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.page-row:focus-visible { outline-offset: -4px; }
.page-row small { display: block; color: var(--muted); padding: .2rem 0 0; line-height: 1.4; }
.row-arrow { color: var(--accent); padding-inline: .15rem; font-weight: 750; }
.status { display: inline-block; white-space: nowrap; font-size: .81rem; font-weight: 725; line-height: 1.35; padding: .27rem .56rem; border-radius: .42rem; }
.status.draft { color: #58437d; background: #eee7fc; }
.status.changed { color: #623b07; background: #faebcc; }
.status.published { color: #204c3b; background: #def0e6; }
.empty { padding: 1.4rem; }
.muted { color: var(--muted); }

.model-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: .9rem; }
.model-card { display: flex; flex-direction: column; align-items: flex-start; gap: .75rem; padding: 1.35rem; }
.model-card p { color: var(--muted); flex: 1; }
.model-card button { margin-top: .35rem; }
.editor-head { margin-bottom: 1.45rem; }
.editor-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .85rem; margin-top: .65rem; }
.editor-meta a { font-weight: 650; }
.notice { padding: .85rem 1rem; border-radius: .6rem; background: #fff0d4; color: #66400b; margin-bottom: 1rem; }
.notice.success { color: #234735; background: #def1e4; }
.notice a { color: inherit; font-weight: 740; }

.editor { max-width: 850px; display: grid; gap: .9rem; }
.field, .review-panel { padding: clamp(.85rem, 2.8vw, 1.35rem); }
label { display: block; font-weight: 665; }
.field > label, .field > h2 { font-weight: 735; font-size: 1.08rem; display: block; margin-bottom: .45rem; line-height: 1.4; }
.field h2 small, .field label small { font-size: .81rem; font-weight: 580; color: var(--muted); display: inline-block; padding-left: .5rem; }
.hint { color: var(--muted); margin: 0 0 .55rem; font-size: .94rem; }
input:not([type="checkbox"]), textarea, select { min-width: 0; max-width: 100%; width: 100%; min-height: 44px; background: #fff; color: var(--ink); border: 1px solid #a8a2b5; border-radius: .42rem; padding: .52rem .64rem; }
textarea { resize: vertical; line-height: 1.6; min-height: 5rem; }
input::placeholder { color: #6a6677; }
input[type="date"] { width: min(100%, 12rem); }
.blocks { display: grid; gap: .7rem; margin-bottom: .7rem; }
.content-block { padding: .7rem; border: 1px solid var(--line); background: #faf9fc; border-radius: .58rem; }
.content-block > label + label { margin-top: .65rem; }
.content-block input:not([type="checkbox"]) { margin-top: .18rem; }
.block-bar { display: flex; align-items: center; justify-content: space-between; gap: .55rem; margin-bottom: .36rem; }
.block-bar > span { font-size: .9rem; color: #545067; font-weight: 695; }
.block-tools { display: flex; gap: .25rem; }
.block-tools button { border: 1px solid #dcd5e8; border-radius: .32rem; background: #fff; color: #493366; min-width: 34px; min-height: 35px; font-size: 1.13rem; line-height: 1; }
.block-tools button:hover { background: #f0eafa; }
.check { display: flex; gap: .44rem; align-items: center; font-size: .93rem; }
.add-block { display: flex; flex-wrap: wrap; align-items: center; gap: .54rem; }
.add-block select { min-height: 40px; width: min(68vw, 12rem); }
.review-start { display: flex; gap: 1rem; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.review-start p, [data-spelling-feedback], [data-library-status] { color: var(--muted); margin-top: .25rem; }
[data-spelling-feedback]:not(:empty) { margin-top: .8rem; }
.suggestions { display: grid; gap: .65rem; padding: 0; margin: .55rem 0 0; list-style: none; }
.suggestions li { padding: .55rem .65rem; background: #f6f1fc; border-radius: .5rem; }
.suggestions .review-label { color: var(--muted); font-size: .9rem; font-weight: 650; margin-bottom: .25rem; }
.suggestions .review-sentence { max-width: 65ch; line-height: 1.55; margin: 0 0 .55rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-sentence mark { background: #e2d2f3; color: #302142; border-radius: .15rem; font-weight: 700; }
.editor-bar { position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; margin-top: .35rem; padding: .8rem .95rem; background: #f3edf8; border: 1px solid #dcd0e6; border-radius: .7rem .7rem 0 0; box-shadow: 0 -4px 15px rgb(35 26 58 / .07); }
.save-status { color: #504063; font-size: .93rem; flex: 1 1 11rem; }
.save-status.error { color: #9d283a; font-weight: 680; }
.source-note { margin-top: 1.5rem; max-width: 850px; color: var(--muted); overflow-wrap: anywhere; }
.source-note summary { cursor: pointer; font-weight: 650; }

.media-items { display: grid; gap: .6rem; }
.media-items:not(:empty) { margin-bottom: .65rem; }
.media-entry { display: flex; flex-wrap: wrap; gap: .7rem; align-items: flex-start; border-radius: .55rem; background: #f2eff6; padding: .65rem; }
.media-entry img { width: 97px; height: 86px; object-fit: cover; border-radius: .4rem; }
.media-copy { flex: 1 1 13rem; min-width: 0; }
.media-copy label { font-size: .88rem; margin-bottom: .32rem; }
.media-copy input { margin-top: .16rem; }
.media-message { margin-top: .35rem; color: #514561; }
dialog { max-width: min(720px, calc(100vw - 1.5rem)); width: 100%; max-height: min(78vh, 38rem); padding: 1rem; border: 1px solid var(--line); border-radius: .8rem; box-shadow: var(--shadow); color: var(--ink); overscroll-behavior: contain; }
dialog::backdrop { background: rgb(30 23 44 / .62); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.image-library { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,9rem),1fr)); gap: .62rem; margin-top: .65rem; }
.library-image { text-align: left; padding: .38rem; border: 1px solid var(--line); border-radius: .45rem; min-width: 0; color: var(--ink); background: #fff; }
.library-image:hover { background: #f2ebfa; }
.library-image img { aspect-ratio: 4/3; object-fit: cover; width: 100%; display: block; border-radius: .3rem; margin-bottom: .22rem; }
.library-image span { display: block; overflow-wrap: anywhere; font-size: .82rem; }

.confirm-card { max-width: 650px; padding: clamp(1.1rem,4vw,2.1rem); }
.confirm-card h1 { font-size: clamp(1.75rem,4vw,2.6rem); }
.confirm-card > p:not(.context) { color: var(--muted); margin: .8rem 0 1.35rem; }
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }

@media (max-width: 920px) {
  .app { grid-template-columns: 180px minmax(0,1fr); }
  .rail { padding-inline: .8rem; }
  .site-cards { gap: .95rem; }
  .tile-copy { padding: 1.05rem; }
}
@media (max-width: 670px) {
  .app { display: block; }
  .rail { position: relative; height: auto; padding: .5rem 1rem; }
  .app-brand { margin: 0; font-size: 1.1rem; }
  .rail .app-brand { max-width: calc(100% - 5.4rem); min-height: 44px; }
  .app-brand br { display: none; }
  .app-brand .brand-mark { width: 32px; height: 32px; transform-origin: left center; transform: scale(.8); margin-right: -.25rem; }
  .app-brand .brand-mark::before { top: 6px; left: 4px; }
  .app-brand .brand-mark::after { top: 6px; left: 17px; }
  .rail-menu > summary { position: absolute; right: .75rem; top: .5rem; }
  .rail-menu > summary:hover, .rail-menu[open] > summary { background: #3c314c; }
  .rail-panel { border-top: 1px solid #655b72; margin-top: .35rem; padding: .4rem 0; }
  .rail nav, .rail nav ul { display: grid; gap: .15rem; margin: 0; }
  .rail nav a { font-size: .95rem; padding: .4rem .55rem; }
  .local-mode { margin: .5rem .55rem 0; }
  .site-cards { grid-template-columns: 1fr; }
  .page-head { margin-bottom: 1.1rem; }
  .back { margin-bottom: .8rem; }
  .page-row { padding-inline: .76rem; gap: .48rem; }
  .list-head { padding-inline: .76rem; }
}
@media (max-width: 360px) {
  .page-row { grid-template-columns: minmax(0,1fr) auto; }
  .row-arrow { display: none; }
}
