@font-face {
  font-family: Archivo;
  src: url("/assets/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  /* Regalia palette, with separate roles for admin surfaces and controls. */
  --court: #07040d;
  --vitrine: #0d0518;
  --velvet: #1a0a33;
  --regalia: #2a1152;
  --sovereign: #3c1a75;
  --royal: #4f23a0;
  --lilac: #b192f4;
  --coronation: #cbb4f8;
  --mist: #e6dcfb;
  --frost: #f5f1fe;
  --silver: #c6cbd6;
  --specular: #f4f6fa;
  --ground: var(--velvet);
  --surface: var(--regalia);
  --field: var(--frost);
  --ink: #fff;
  --ink-on-light: var(--court);
  --muted: var(--silver);
  --muted-on-light: var(--sovereign);
  --line: rgba(198, 203, 214, 0.22);
  --success: #57e0a5;
  --danger: #ff8e9b;
  --focus: #fff;
  --shadow: 0 16px 40px rgba(7, 4, 13, 0.35);
  --r: 8px;
  --control-height: 48px;
  --control-padding: 12px 16px;
  --control-gap: 12px;
  --side: 256px;
  --header: 76px;
  --space: clamp(24px, 4vw, 56px);
  --font-admin: Archivo, "Helvetica Neue", Arial, sans-serif;
  font-family: var(--font-admin);
  color-scheme: dark;
  color: var(--ink);
  background: var(--ground);
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  min-width: 320px;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  font-size: 16px;
  line-height: 1.5;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a {
  touch-action: manipulation;
}
a {
  color: var(--lilac);
  text-underline-offset: 3px;
}
img {
  max-width: 100%;
  display: block;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.skip {
  position: fixed;
  z-index: 99;
  left: 16px;
  top: -80px;
  background: var(--surface);
  padding: 12px 16px;
  border-radius:var(--r);
}
.skip:focus {
  top: 12px;
}
.boot {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 16px;
  justify-items: center;
  color: var(--muted);
}
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--lilac);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}
.sr {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.loading-inline {
  min-height: 50vh;
}
.error.notice-top {
  margin-top: 24px;
}
.section-title.section-title--flush {
  margin-top: 0;
}
.thumb-table {
  width: 96px;
  height: 64px;
  object-fit: contain;
  background: var(--vitrine);
  border-radius:var(--r);
}
.thumb-card {
  width: 100%;
  height: 180px;
  object-fit: contain;
  background: var(--vitrine);
  border-radius:var(--r);
  margin-bottom: 16px;
}
.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}
.login {
  min-height: 100vh;
  min-height: 100svh;
  padding: max(28px, calc((100svh - 550px) / 2)) 24px
    max(28px, env(safe-area-inset-bottom));
  background: var(--ground);
}
.login__panel {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}
.login__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.login__brand img {
  width: 68px;
  height: 68px;
  object-fit: contain;
}
.wordmark {
  font-family: var(--font-admin);
  font-weight: 600;
  letter-spacing: -0.025em;
  font-size: 24px;
  line-height: 1.25;
}
.login__form {
  background: var(--regalia);
  color: #fff;
  border: 0;
  border-radius:var(--r);
  padding: 32px;
  box-shadow: var(--shadow);
}
.login .actions {
  display: grid;
  gap: var(--control-gap);
}
.login .actions .btn {
  width: 100%;
  background: var(--coronation);
  color: var(--velvet);
}
.login .actions .btn:hover {
  background: var(--frost);
}
.login .field label,
.login .field small,
.login .lede {
  color: var(--silver);
}
.login .field label {
  font-size: 13px;
}
.login :focus-visible {
  outline-color: var(--lilac);
}
.login .actions .btn--login-secondary {
  background: var(--frost);
  border-color: var(--frost);
  color: var(--regalia);
  box-shadow: none;
}
.login .actions .btn--login-secondary:hover {
  background: #fff;
  border-color: #fff;
  color: var(--velvet);
}
.login #login-message:not(:empty) {
  margin-top: 18px;
}
.login #login-message > * {
  margin-bottom: 0;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--lilac);
  font-weight: 700;
  font-size: 12px;
}
.login h1 {
  font:
    600 14px/1.5 var(--font-admin);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  margin: 0 0 28px;
}
.lede {
  color: var(--muted);
  margin: 0 0 32px;
}
.field {
  display: grid;
  gap: 8px;
  margin: 0 0 22px;
}
.field label {
  font-weight: 600;
}
.field small {
  color: var(--muted);
}
input,
textarea,
select {
  width: 100%;
  min-height: 48px;
  border: 2px solid transparent;
  border-radius: var(--r);
  background: var(--field);
  padding: 10px 12px;
  color: var(--ink-on-light);
  color-scheme: light;
}
textarea {
  min-height: 180px;
  resize: vertical;
}
input:hover,
textarea:hover,
select:hover {
  background-color: #fff;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--royal);
  background-color: #fff;
  box-shadow: 0 0 0 3px var(--coronation);
  outline: 0;
}
.error {
  padding: 13px 15px;
  border-left: 4px solid var(--danger);
  background: var(--danger);
  color: var(--court);
  margin: 0 0 20px;
}
.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.btn {
  min-height: var(--control-height);
  border: 1px solid transparent;
  border-radius: var(--r);
  padding: var(--control-padding);
  background: var(--coronation);
  color: var(--velvet);
  font-family: var(--font-admin);
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
  letter-spacing: 0.005em;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: none;
  transition:
    background-color 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease;
}
.btn:hover {
  background: var(--frost);
  color: var(--velvet);
}
.btn:active {
  box-shadow: none;
}
.btn:disabled {
  background: var(--sovereign);
  color: var(--silver);
  opacity: 1;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.btn--quiet {
  background: var(--specular);
  color: var(--regalia);
  border-color: rgba(42, 17, 82, 0.08);
}
.btn--quiet:hover {
  background: var(--silver);
  color: var(--regalia);
}
.btn--danger {
  background: var(--danger);
  color: var(--court);
}
.btn--danger:hover {
  background: #ffc2c9;
  color: var(--court);
}
.btn--back {
  background: rgba(203, 180, 248, 0.08);
  border-color: rgba(203, 180, 248, 0.34);
  color: var(--frost);
  box-shadow: none;
}
.btn--back:hover {
  background: var(--coronation);
  border-color: var(--coronation);
  color: var(--velvet);
}
.btn--topbar {
  background: var(--coronation);
  color: var(--velvet);
  box-shadow: none;
}
.btn--sidebar {
  width: 100%;
  margin-top: 16px;
  justify-content: flex-start;
  background: var(--mist);
  border-color: var(--mist);
  color: var(--regalia);
  box-shadow: none;
}
.btn--sidebar:hover {
  background: var(--coronation);
  border-color: var(--coronation);
  color: var(--velvet);
}
.btn--icon {
  padding: 0;
  width: var(--control-height);
}
.btn .icon {
  width: 18px;
  height: 18px;
}
.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.link-button {
  border: 1px solid rgba(203, 180, 248, 0.34);
  border-radius: var(--r);
  background: rgba(203, 180, 248, 0.08);
  padding: var(--control-padding);
  color: var(--frost);
  font-family: var(--font-admin);
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
  text-decoration: none;
  cursor: pointer;
  min-height: var(--control-height);
}
.shell {
  min-height: 100vh;
  padding-left: var(--side);
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--side);
  background: var(--court);
  color: #fff;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.sidebar .wordmark {
  font-size: 17px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px 30px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}
.nav {
  display: grid;
  gap: 6px;
  padding: 26px 0;
}
.nav a {
  min-height: 48px;
  border-radius:var(--r);
  padding: 12px;
  color: var(--silver);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 13px;
  font-weight: 600;
}
.nav a:hover {
  background: var(--frost);
  color: var(--velvet);
}
.nav a[aria-current="page"] {
  background: var(--coronation);
  color: var(--velvet);
}
.sidebar__account {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding: 22px 12px 0;
}
.sidebar__account small {
  display: block;
  color: var(--silver);
  overflow-wrap: anywhere;
}
.mobile-header {
  display: none;
}
.main {
  min-height: 100vh;
}
.topbar {
  height: var(--header);
  background: var(--court);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 var(--space);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
}
.content {
  padding: clamp(28px, 4vw, 48px) var(--space) 64px;
  max-width: 1480px;
  margin: 0 auto;
}
.content:focus {
  outline: none;
}
.page-head {
  display: flex;
  gap: 28px;
  align-items: flex-end;
  justify-content: space-between;
  margin: 0 0 30px;
}
.page-head h1 {
  font:
    600 clamp(26px, 3vw, 32px) / 1.2 var(--font-admin);
  letter-spacing: -0.02em;
  margin: 0;
}
.page-head p {
  max-width: 700px;
  color: var(--muted);
  margin: 13px 0 0;
}
.page-head__actions {
  flex: none;
}
.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  text-decoration: none;
}
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 200px));
  gap: 20px;
}
.card {
  background: var(--coronation);
  border: 0;
  border-radius: var(--r);
  padding: 26px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  color: var(--velvet);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}
.card:hover {
  background: var(--frost);
  box-shadow: var(--shadow);
}
.card__icon {
  color: var(--royal);
  margin-bottom: 18px;
}
.card__icon .icon {
  width: 36px;
  height: 36px;
  stroke-width: 1.5;
}
.card h2 {
  color: var(--velvet);
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px;
}
.card .metric {
  margin: auto 0 0;
  padding: 3px 12px;
  border-radius: 20px;
  background: var(--regalia);
  color: #fff;
  font:
    600 13px/1.5 var(--font-admin);
}
.pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--mist);
  color: var(--regalia);
  font-size: 13px;
  font-weight: 700;
}
.pill--new {
  background: var(--coronation);
  color: var(--regalia);
}
.pill--in_progress {
  background: var(--silver);
  color: var(--court);
}
.pill--replied {
  background: var(--success);
  color: var(--court);
}
.pill--closed {
  background: var(--sovereign);
  color: var(--silver);
}
.toolbar {
  display: flex;
  align-items: end;
  gap: 14px;
  margin-bottom: 22px;
}
.toolbar .field {
  margin: 0;
  min-width: 190px;
}
.toolbar .search {
  flex: 1;
  max-width: 460px;
}
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.text-table {
  table-layout: fixed;
}
.text-table th:first-child {
  width: 48%;
}
.text-table th:nth-child(3) {
  width: 88px;
}
.text-table th:last-child {
  width: 128px;
}
.table .row-link {
  overflow-wrap: anywhere;
}
.table th,
.table td {
  text-align: left;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: var(--court);
}
.table tr:last-child td {
  border-bottom: 0;
}
.table tbody tr:hover {
  background: var(--sovereign);
}
.table a.row-link {
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}
.table a.row-link:hover {
  color: var(--lilac);
}
.table .preview {
  max-width: 560px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mobile-list {
  display: none;
}
.record-card {
  display: block;
  background: var(--frost);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px;
  text-decoration: none;
  color: var(--ink-on-light);
}
.record-card h2 {
  color: var(--ink-on-light);
  overflow-wrap: anywhere;
  min-width: 0;
  font-size: 18px;
  margin: 0;
}
.record-card p {
  margin: 8px 0 0;
  color: var(--muted-on-light);
  overflow-wrap: anywhere;
}
.record-card__top {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: start;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  color: var(--muted);
}
.empty {
  background: var(--surface);
  border: 1px dashed #bcb2c8;
  border-radius: var(--r);
  padding: 52px 24px;
  text-align: center;
  color: var(--muted);
}
.form-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: clamp(22px, 4vw, 42px);
  max-width: 920px;
}
.form-card--wide {
  max-width: 1100px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}
.form-grid .wide {
  grid-column: 1/-1;
}
.meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 28px;
}
.meta > div {
  background: var(--surface);
  padding: 18px;
}
.meta dt {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.meta dd {
  margin: 6px 0 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.image-preview {
  background: var(--vitrine);
  border-radius: var(--r);
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
  margin-bottom: 28px;
}
.image-preview img {
  width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: contain;
}
.submission-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 30px;
}
.submission-fields > div {
  background: var(--surface);
  padding: 18px;
}
.submission-fields dt {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.submission-fields dd {
  margin: 7px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.submission-fields .long {
  grid-column: 1/-1;
}
.section-title {
  font:
    600 20px/1.3 var(--font-admin);
  margin: 44px 0 18px;
}
.reply {
  border-top: 1px solid var(--line);
  margin-top: 32px;
  padding-top: 28px;
}
.reply-item {
  border-left: 3px solid var(--lilac);
  padding: 4px 0 4px 18px;
  margin: 22px 0;
}
.reply-item p {
  white-space: pre-wrap;
}
.hint {
  font-size: 14px;
  color: var(--muted);
}
.success {
  padding: 13px 15px;
  border-left: 4px solid var(--success);
  background: var(--success);
  color: var(--court);
  margin: 0 0 20px;
}
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 420px;
  background: var(--coronation);
  color: var(--velvet);
  padding: 14px 18px;
  border-radius:var(--r);
  box-shadow: var(--shadow);
  z-index: 80;
}
.confirm-dialog {
  width: min(430px, calc(100vw - 32px));
  margin: auto;
  padding: 0;
  border: 1px solid rgba(203, 180, 248, 0.42);
  border-radius:var(--r);
  background: var(--regalia);
  color: #fff;
  box-shadow: 0 28px 80px rgba(7, 4, 13, 0.68);
}
.confirm-dialog::backdrop {
  background: rgba(7, 4, 13, 0.78);
  backdrop-filter: blur(3px);
}
.confirm-dialog form {
  display: grid;
  gap: 14px;
  padding: 28px;
}
.confirm-dialog h2 {
  margin: 0;
  font: 600 23px/1.25 var(--font-admin);
  letter-spacing: -0.015em;
}
.confirm-dialog p {
  margin: 0;
  color: var(--silver);
}
.confirm-dialog__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--control-gap);
  margin-top: 16px;
}
.confirm-dialog__actions .btn {
  width: 100%;
}
.menu-backdrop {
  display: none;
}
@media (max-width: 1050px) {
  :root {
    --side: 224px;
  }

  .table th:nth-child(3),
  .table td:nth-child(3) {
    display: none;
  }
}
@media (max-width: 900px) {
  .login {
    padding-left: 20px;
    padding-right: 20px;
  }
  .login__form {
    padding: 28px 24px;
  }
  .main {
    min-height: calc(100svh - 64px);
  }
  .shell {
    padding-left: 0;
    padding-top: 64px;
  }
  .sidebar {
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    width: min(84vw, 300px);
  }
  .shell.menu-open .sidebar {
    transform: none;
  }
  .menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 8, 24, 0.44);
    z-index: 19;
  }
  .shell.menu-open .menu-backdrop {
    display: block;
  }
  .mobile-header {
    display: flex;
    position: fixed;
    inset: 0 0 auto;
    height: 64px;
    background: var(--court);
    color: #fff;
    z-index: 18;
    align-items: center;
    gap: 16px;
    padding: 8px 14px;
  }
  .mobile-header .wordmark {
    font-size: 16px;
  }
  .topbar {
    display: none;
  }
  .content {
    padding: 28px 20px 48px;
  }
  .page-head {
    display: block;
    margin-bottom: 30px;
  }
  .page-head__actions {
    margin-top: 20px;
  }
  .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }
  .card {
    padding: 22px 8px;
  }
  .card h2 {
    font-size: 13px;
  }
  .card__icon {
    margin-bottom: 14px;
  }
  .toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .toolbar .field {
    min-width: 0;
  }
  .toolbar .search {
    grid-column: 1/-1;
    max-width: none;
  }
  .desktop-table {
    display: none;
  }
  .mobile-list {
    display: grid;
    gap: 12px;
  }
  .form-grid {
    display: block;
  }
  .meta,
  .submission-fields {
    grid-template-columns: 1fr;
  }
  .submission-fields .long {
    grid-column: auto;
  }
  .page-head h1 {
    font-size: 28px;
  }
  .form-card {
    padding: 22px 18px;
  }
  .pagination {
    align-items: stretch;
  }
  .toast {
    left: 18px;
    right: 18px;
    bottom: 18px;
  }
  .confirm-dialog form {
    padding: 24px 20px;
  }
  .image-preview {
    padding: 12px;
  }
}
@media (max-width: 380px) {
  .toolbar {
    grid-template-columns: 1fr;
  }
  .login__form {
    padding: 24px 20px;
  }
  .toolbar .search {
    grid-column: auto;
  }
  .actions > .btn {
    width: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.sidebar__brand img { width: 32px; height: 40px; object-fit: contain; }
.password-input { position: relative; }
.password-input input { padding-right: 86px; min-height: 56px; }
.password-toggle {
  position: absolute; right: 4px; top: 4px; bottom: 4px;
  min-width: 58px; min-height: var(--control-height); padding: 0 16px;
  border: 0; border-radius: var(--r); background: var(--royal);
  color: #fff; font: 700 14px/20px var(--font-admin); cursor: pointer;
}
.password-toggle:hover { background: var(--sovereign); }
.login .password-toggle:focus-visible { outline-color: #fff; outline-offset: -4px; }

/* Keep surface and text colours paired, including visited links and touch states. */
.card:visited, .card:active { color: var(--velvet); }
.record-card:visited, .record-card:active { color: var(--ink-on-light); }
.form-card, .table-wrap { color: var(--ink); }
.page-head--text { align-items: flex-start; }
.page-head--text > div:first-child { min-width: 0; }
.page-head--text h1 { font-size: clamp(20px, 2vw, 26px); line-height: 1.4; overflow-wrap: anywhere; }
.text-page { overflow-wrap: anywhere; }
.text-page small { display: block; margin-top: 4px; color: var(--muted); }
.current-text { margin: 10px 0 0; color: var(--muted); overflow-wrap: anywhere; font-size: 14px; }
.current-text span { font-weight: 600; }
.record-card__top .pill { flex-shrink: 0; }

.image-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-bottom: 28px; }
.image-comparison--original { grid-template-columns: minmax(0, 1fr); max-width: 440px; }
.image-reference { margin: 0; min-width: 0; }
.image-reference figcaption { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; margin-bottom: 10px; color: var(--ink); font-weight: 600; }
.image-reference .image-preview { height: 240px; margin-bottom: 12px; }
.image-reference .image-preview img { width: 100%; height: 100%; object-fit: contain; }
@media (max-width: 600px) { .image-comparison { grid-template-columns: minmax(0, 1fr); } .image-reference .image-preview { height: 210px; } }

.image-thumbnail-caption { display: block; margin: -4px 0 12px; color: var(--muted-on-light); font-size: 13px; }

/* Native controls must keep their filled shape and touch size in WebKit too. */
input::placeholder, textarea::placeholder { color: #565e70; opacity: 1; }
select { appearance: none; -webkit-appearance: none; height: 48px; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%232a1152' stroke-width='2'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
input[type=file]::file-selector-button { border: 0; border-radius: var(--r); min-height:var(--control-height); padding:var(--control-padding); margin-right:var(--control-gap); background: var(--royal); color: #fff; font:700 14px/20px var(--font-admin); cursor: pointer; }
input[type=file] { padding: 6px; }
.btn:disabled, .btn:disabled:hover { background: var(--sovereign); color: var(--silver); }
.record-card:hover { background: var(--mist); }
.record-card .current-text, .record-card .hint { color: var(--muted-on-light); }

/* Keep both image versions and their page location visible in every list row. */
.image-list-table { table-layout: fixed; }
.image-list-table th:nth-child(1), .image-list-table th:nth-child(2) { width: 22%; }
.image-list-table th:last-child { width: 112px; }
.image-list-table td { padding: 16px 12px; }
.image-list-preview { margin: 0; min-width: 0; }
.image-list-preview figcaption { margin-bottom: 8px; font-size: 13px; font-weight: 600; }
.image-list-table figcaption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.image-list-preview img { width: 100%; height: 138px; object-fit: contain; background: var(--vitrine); border-radius:var(--r); }
.image-location { display: grid; overflow-wrap: anywhere; }
.image-location-label { margin-top: 10px; font-size: 12px; font-weight: 500; color: var(--muted); }
.image-location-label:first-child { margin-top: 0; }
.image-heading { font-weight: 700; }
.image-page { font-size: 14px; font-weight: 500; }
.image-description { display: block; margin: 12px 0; color: var(--muted); overflow-wrap: anywhere; }
.image-list-card .image-location-label { color: var(--muted-on-light); }
.image-list-card .image-heading { font-size: 18px; }
.image-list-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.image-list-state { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; }
.image-edit { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
@media (max-width: 380px) { .image-list-preview img { height: 108px; } }

.image-list-table th:nth-child(3), .image-list-table td:nth-child(3) { display: table-cell; }

/* Page editing follows the public reading order, with one save for the form. */
.page-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.page-search { max-width: 640px; }
.page-card { min-width: 0; }
.page-editor { max-width: 1050px; padding-bottom: 30px; }
.page-field { padding: 24px; margin: 0 0 20px; background: var(--surface); border-radius: var(--r); scroll-margin-top: 100px; min-width: 0; }
.page-field > h2 { font-size: 18px; margin: 0 0 8px; }
.page-field .field > label { display: block; font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
.page-field input, .page-field textarea { width: 100%; min-width: 0; }
.page-field textarea { line-height: 1.6; resize: vertical; }
.page-field .image-comparison { gap: 20px; }
.page-field .image-reference .image-preview { height: 210px; }
.page-field .image-reference figcaption { color: var(--ink); }
.pending-image { color: var(--coronation); font-size: 12px; }
.tag-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.original-reference { margin-top: 12px; color: var(--muted); }
.original-reference summary { cursor: pointer; min-height: 44px; padding: 10px 0; }
.original-reference pre { white-space: pre-wrap; font: inherit; font-size: 14px; overflow-wrap: anywhere; max-height: 280px; overflow: auto; }
.field-feedback { margin: 6px 0 0; color: var(--danger); font-size: 14px; }
.field-feedback:empty { display: none; }
.prose-preview { margin-top: 16px; padding: 20px; background: var(--court); border-radius:var(--r); color: #fff; overflow-wrap: anywhere; }
.prose-preview p { margin: 0 0 12px; }
.prose-preview h2,.prose-preview h3 { font-size: 19px; line-height: 1.4; margin: 16px 0 12px; }
.prose-preview ul,.prose-preview ol { padding-left: 24px; }
.prose-preview a { color: var(--lilac); }
.page-savebar { position: sticky; bottom: 0; z-index: 15; padding: 16px; border-radius: 8px 8px 0 0; background: var(--court); color: #fff; box-shadow: 0 -6px 24px #07040d66; display: flex; gap: 16px; align-items: center; justify-content: space-between; }
.page-savebar .actions { margin: 0; }
.page-review { width: min(900px,calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 28px; border: 0; border-radius:var(--r); background: var(--velvet); color: var(--ink); }
.page-review::backdrop { background: #07040dcc; }
.page-review section { margin: 24px 0; }
.page-review img { max-height: 320px; object-fit: contain; }
.page-review h3 { overflow-wrap: anywhere; }
@media(max-width: 900px) {
 .page-grid { grid-template-columns: minmax(0,1fr); }
 .page-field { padding: 18px; }
 .page-savebar { flex-direction: column; align-items: stretch; gap: 8px; }
 .page-savebar .actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
 .page-savebar .btn { width: 100%; }
 .page-savebar > span { font-size: 13px; }
 .page-picture .image-comparison { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
 .page-picture .image-reference .image-preview { height: 130px; }
}

/* FilePond uses the same Regalia surfaces and generous touch targets. */
.filepond--root { font-family: Archivo,sans-serif; font-size: 16px; margin: 12px 0; color: var(--ink-on-light); }
.filepond--panel-root { background: var(--frost); border-radius:var(--r); }
.filepond--drop-label { color: var(--sovereign); min-height: 112px; }
.filepond--drop-label label { font-weight: 500; line-height: 1.7; padding: 20px 16px; }
.filepond--label-action { text-decoration: none; display: inline-flex; align-items:center; min-height:var(--control-height); background: var(--royal); color: #fff; padding:var(--control-padding); border-radius:var(--r); border-bottom:0; font:700 14px/20px var(--font-admin); }
.filepond--item-panel { background: var(--sovereign); }
.filepond--file { color: #fff; }
.filepond--file-action-button { width: 44px; height: 44px; cursor: pointer; }
.filepond--file-info { margin-left: 8px; }
.filepond--file-status { margin-right: 8px; }
.picture-info { color: var(--coronation); font-size: 14px; }
.page-picture .filepond--root { margin-bottom: 12px; }
@media(max-width:900px) {
 .page-savebar .actions { grid-template-columns: 1fr 1.3fr; }
 .page-savebar .icon { display:none; }
}
.filepond--drop-label > label { color: var(--sovereign); }
.filepond--drop-label .filepond--label-action { color: #fff; }
[data-filepond-item-state='processing-complete'] .filepond--item-panel { background: var(--sovereign); }
[data-filepond-item-state*='error'] .filepond--item-panel { background: #782d45; }
.filepond--file-info-main,.filepond--file-status-main { font-size:14px; }
.filepond--file-info-sub,.filepond--file-status-sub { opacity:1; color:var(--silver); font-size:12px; }
.filepond--file-info .filepond--file-info-sub,
.filepond--file-status .filepond--file-status-sub { opacity:1; font-size:12px; color:var(--silver); }
.filepond--file-info .filepond--file-info-main,
.filepond--file-status .filepond--file-status-main { font-size:14px; }
.filepond--file-info .filepond--file-info-sub { opacity:1 !important; }

/* A page reads as a page: sections, headings, writing and pictures. */
.page-editor { max-width: 860px; }
.page-section { background: var(--surface); border-radius:var(--r); margin: 0 0 24px; padding: 24px; min-width: 0; }
.page-section .page-field { background: transparent; padding: 0; margin: 0 0 24px; border-radius: 0; }
.page-section .page-field:last-child { margin-bottom: 0; }
.field-type { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 4px; }
.page-field .field > label { font-size: 16px; font-weight: 500; margin-bottom: 10px; }
.page-field--heading input { font-size: 18px; font-weight: 600; }
.tag-toolbar { display: flex; flex-wrap: nowrap; align-items: center; gap: 4px; overflow-x: auto; padding: 6px; margin: 0; background: var(--court); border-radius: 8px 8px 0 0; }
.tag-toolbar__label { color: var(--lilac); font-size: 12px; padding: 0 6px; }
.tag-button { flex: 0 0 auto; border: 0; border-radius:var(--r); min-height: 44px; padding: 8px 10px; font: inherit; font-size: 14px; color: #fff; background: #382951; cursor: pointer; }
.tag-button:hover, .tag-button:focus-visible { background: var(--royal); outline: 2px solid var(--lilac); outline-offset: -2px; }
.tag-toolbar + textarea { border-radius: 0 0 8px 8px; }
.original-reference { margin-top: 0; display: inline-block; vertical-align: top; max-width: 100%; font-size: 13px; }
.original-reference summary { min-height: 44px; padding: 12px 0; }
.text-preview-button { float: right; min-height: 44px; font-size: 13px; }
.page-labels { margin: 16px 0 20px; color: var(--muted); }
.page-labels > summary { padding: 12px 0; min-height: 44px; cursor: pointer; font-weight: 500; }
.page-labels[open] > summary { margin-bottom: 12px; }
.page-labels .page-field { margin-bottom: 14px; }
.page-labels .original-reference, .page-labels .field-type { display: none; }
.page-labels label { color: var(--ink); }
.page-savebar { padding: 12px 16px; }
@media(max-width: 600px) {
 .page-section { padding: 16px; margin-bottom: 16px; }
 .page-editor { padding-bottom: 12px; }
 .page-field .field > label { font-size: 15px; }
 .page-field input, .page-field textarea { font-size: 16px; }
 .page-savebar { gap: 6px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
 .page-savebar .actions { grid-template-columns: 1fr 1fr; }
 .page-savebar > span { font-size: 12px; }
 .tag-toolbar { flex-wrap: wrap; gap: 4px; }
 .tag-toolbar__label { flex-basis: 100%; }
 .tag-button { min-height: 44px; padding: 8px; }
 .page-picture .image-reference .image-preview { height: 115px; }
}
.page-field .heading-input { font-size: 18px; font-weight: 600; line-height: 1.5; min-height: 86px; resize: vertical; }
@media(max-width:600px) { .page-field .heading-input { font-size: 16px; } }
.page-review--site { width: min(1200px, calc(100vw - 24px)); max-width: none; }
.site-preview { width: 100%; height: 65vh; display: block; border: 0; background: #18141f; margin-bottom: 16px; }
.page-review--site .actions { flex-wrap: wrap; }
.page-savebar--cms .actions { display: grid; grid-template-columns: auto auto auto; gap: 8px; }
.page-savebar--cms .actions .btn { min-width: 0; white-space: nowrap; }
@media(max-width:600px) {
 .page-savebar--cms .actions { grid-template-columns: 1fr 1.15fr 1fr; }
 .page-review--site { width:100vw; max-width:100vw; height:100dvh; max-height:100dvh; margin:0; padding:16px 0; border:0; border-radius:0; }
 .page-review--site > h2, .page-review--site #page-review-body > p, .page-review--site .actions, .page-review--site #publish-message { margin-left:16px; margin-right:16px; }
 .page-review--site > #close-review,.page-review--site > #close-entity-preview,.page-review--site > h2 { margin-left:16px; margin-right:16px; }
}
/* Text tags stay visible and tappable while their wording remains editable. */
.token-editor{border:2px solid var(--coronation);border-radius:var(--r);background:var(--field);color:var(--court);min-width:0;overflow:hidden}
.token-editor:focus-within{outline:2px solid var(--coronation);outline-offset:2px}
.tag-toolbar[hidden],.plaintext-hint[hidden],.mobile-tag-controls[hidden],.mobile-tag-controls select[hidden]{display:none}
.mobile-tag-controls{display:flex;gap:8px;align-items:center;margin-bottom:8px}
.mobile-tag-controls select{min-width:0;flex:1;width:auto;margin:0;min-height:44px;font-size:16px}
.mobile-tag-controls .tag-button{flex:none;min-height:44px}
.tag-toolbar + textarea.plaintext-editor{border-radius:8px}
textarea.plaintext-editor{min-height:240px;font-size:16px;line-height:1.6;white-space:pre-wrap;overflow-wrap:anywhere;resize:vertical}
.plaintext-hint{font-size:13px;color:var(--muted);margin:8px 0 12px}
.token-editor .cm-editor{font:inherit;min-height:150px;max-width:100%}
.token-editor .cm-scroller{font:inherit;overflow:auto}
.token-editor .cm-content{padding:12px;caret-color:var(--court);overflow-wrap:anywhere}
.token-editor .cm-line{padding:0;line-height:1.7}
.token-editor .cm-cursor{border-left-color:var(--court)}
.token-editor .cm-selectionBackground,.token-editor .cm-focused .cm-selectionBackground{background:#cbb4f880!important}
.text-token{font:600 12px/1.25 Archivo,sans-serif;display:inline-flex;align-items:center;vertical-align:middle;min-height:44px;padding:6px 10px;margin:2px 4px 2px 0;background:var(--sovereign);color:#fff;border:0;border-radius:var(--r);cursor:pointer;white-space:normal;max-width:100%}
.text-token--end{background:var(--mist);color:var(--sovereign)}
.text-token__compact{display:none}
.text-token:focus-visible{outline:2px solid #fff;outline-offset:2px}
.tag-dialog{background:var(--surface);color:#fff;border:2px solid var(--coronation);border-radius:var(--r);padding:24px;width:min(460px,calc(100vw - 24px));max-height:90dvh;overflow:auto}
.tag-dialog::backdrop{background:#000b}.tag-dialog form{display:grid;gap:20px}.tag-dialog label{display:grid;gap:8px}.tag-dialog label[hidden]{display:none}.tag-dialog .actions{flex-wrap:wrap}
@media(max-width:600px){
 .text-token__full{display:none}.text-token__compact{display:inline}
 .text-token{min-width:44px;min-height:44px;padding:6px 8px;margin:2px 3px 2px 0;font-size:11px;white-space:nowrap}
 .token-editor .cm-content{padding:10px;font-size:16px}
 .token-editor .cm-line{line-height:1.7}
 .token-editor .cm-editor{min-height:240px}
 .tag-dialog{position:fixed;inset:auto 0 0;margin:0;width:100%;max-width:none;max-height:85dvh;border-radius:18px 18px 0 0;padding:20px 20px calc(20px + env(safe-area-inset-bottom));}
 .tag-dialog h2{font-size:21px}.tag-dialog input,.tag-dialog select{font-size:16px;min-height:44px}
 .tag-dialog .actions{display:grid;grid-template-columns:1fr 1fr;gap:10px}.tag-dialog .actions .btn:first-child{grid-column:1/-1}
}
.editorial-list{display:grid;gap:14px}.editorial-card{display:grid;gap:8px;background:var(--surface);color:#fff;padding:22px;border-radius:var(--r);text-decoration:none;border-left:4px solid var(--coronation)}.editorial-card span{color:var(--silver)}.editorial-links{margin-bottom:24px;flex-wrap:wrap}#entity-form .field{margin-bottom:24px}
.sample-notice{background:var(--mist);color:var(--court);padding:16px 20px;border-radius:var(--r);margin:20px 0}
