/* =========================================================================
   Debut — exhibition site styles
   Gallery-modern, mobile-first. Palette anchored on a deep navy plus a warm
   "smile" accent. Swap the tokens in :root to retune the whole site.
   ========================================================================= */

:root {
  /* Brand palette (anchored on board navy + warm accent; tweak freely) */
  --ink:        #13294b;   /* deep navy — structure & headings */
  --ink-soft:   #29456e;
  --paper:      #f5efe3;   /* warm plaster wall */
  --paper-2:    #fbf7ee;
  --card:       #ffffff;
  --accent:     #e2552b;   /* warm coral / "smile" */
  --accent-2:   #efa83a;   /* warm gold highlight */
  --line:       #e5ddcc;
  --line-strong:#d6cbb3;
  --muted:      #6c6452;
  --text:       #1c1b18;

  /* Type */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-sans: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Spacing / shape */
  --maxw: 1180px;
  --radius: 4px;
  --shadow-soft: 0 1px 2px rgba(19, 41, 75, .06), 0 12px 30px rgba(19, 41, 75, .08);
  --shadow-art: 0 2px 6px rgba(19, 41, 75, .10), 0 30px 60px rgba(19, 41, 75, .16);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background-color: var(--paper);
  /* Ambient glows derived from the palette so they retune with the theme. */
  background-image:
    radial-gradient(1200px 600px at 85% -10%, color-mix(in srgb, var(--accent-2) 10%, transparent), transparent 60%),
    radial-gradient(900px 500px at -5% 0%, color-mix(in srgb, var(--ink) 6%, transparent), transparent 55%);
  background-attachment: fixed;
  line-height: 1.6;
  font-size: 17px;
  letter-spacing: .005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* Subtle paper grain overlay (no images required) */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  opacity: .035;
  z-index: 0;
  background-image:
    repeating-linear-gradient(0deg, #000 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, #000 0 1px, transparent 1px 3px);
  background-size: 3px 3px;
}
.page { position: relative; z-index: 1; }

/* ---------- Site header / masthead ---------- */

.masthead {
  border-bottom: 1px solid var(--line);
  background: rgba(251, 247, 238, .8);
  backdrop-filter: saturate(140%) blur(6px);
  -webkit-backdrop-filter: saturate(140%) blur(6px);
}
.masthead .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding-top: 16px; padding-bottom: 16px;
}
.mark {
  display: inline-flex; align-items: baseline; gap: .55rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.18rem;
  color: var(--ink);
  letter-spacing: -.01em;
}
.mark .dot { color: var(--accent); }
.masthead nav a {
  color: var(--ink-soft);
  font-size: .82rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 600;
}

/* Masthead nav + social icons (top-right) */
.site-nav { display: inline-flex; align-items: center; gap: 16px; }
.social-row { display: inline-flex; align-items: center; gap: 12px; }
.social-row[hidden] { display: none; }
.social-icon { display: inline-flex; color: var(--ink-soft); transition: color .15s ease, transform .15s ease; }
.social-icon:hover { color: var(--accent); transform: translateY(-1px); }

/* Per-item link button on the artwork page */
.art-link { margin-top: 1.5rem; }

/* "Load sample content" control under the template picker */
.sample-load { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.sample-load .hint { margin: 0; }

/* ---------- Hero (landing) ---------- */

.hero {
  padding: clamp(56px, 11vw, 130px) 0 clamp(40px, 7vw, 80px);
  position: relative;
}
.kicker {
  font-size: .8rem; font-weight: 700;
  letter-spacing: .26em; text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1.1rem;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-optical-sizing: auto;
  font-size: clamp(2.7rem, 9.5vw, 6.6rem);
  line-height: .96;
  letter-spacing: -.02em;
  color: var(--ink);
  margin: 0;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
  font-weight: 500;
}
.hero .sub {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.2rem, 3.4vw, 2rem);
  color: var(--ink-soft);
  margin: .6rem 0 0;
  font-weight: 400;
}
.venue {
  margin-top: 1.6rem;
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .5rem .95rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink);
  font-size: .92rem; font-weight: 600;
}
.venue::before {
  content: ""; width: .55rem; height: .55rem; border-radius: 50%;
  background: var(--accent-2); display: inline-block;
}
.lede {
  max-width: 56ch; margin-top: 1.7rem;
  color: var(--muted); font-size: 1.06rem;
}

/* Optional hero image beside the title (set in the curator Appearance tab). */
.hero-layout { display: grid; grid-template-columns: 1fr; gap: clamp(24px, 5vw, 56px); align-items: center; }
@media (min-width: 880px) {
  .hero-layout.has-media { grid-template-columns: minmax(0, 1.2fr) minmax(240px, .9fr); }
}
.hero-content { min-width: 0; }
.hero-media { min-width: 0; }
.hero-media[hidden] { display: none; }
.hero-media img { width: 100%; display: block; border-radius: var(--radius); }
.hero-media.fit-contain img { object-fit: contain; max-height: 440px; }
.hero-media.fit-cover img { aspect-ratio: 4 / 3; object-fit: cover; box-shadow: var(--shadow-art); }

/* ---------- Section heads ---------- */

.section { padding: clamp(34px, 6vw, 64px) 0; }
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 1.8rem;
  border-bottom: 2px solid var(--ink);
  padding-bottom: .8rem;
}
.section-head h2 {
  font-family: var(--font-display);
  font-weight: 600; font-size: clamp(1.5rem, 3.6vw, 2.3rem);
  color: var(--ink); margin: 0; letter-spacing: -.01em;
}
.section-head .count {
  font-size: .82rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; white-space: nowrap;
}

/* ---------- School cards (landing) ---------- */

.schools {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.school-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 24px 22px;
  box-shadow: var(--shadow-soft);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
  color: var(--ink);
  position: relative; overflow: hidden;
}
.school-card::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: linear-gradient(var(--accent), var(--accent-2));
  transform: scaleY(0); transform-origin: top; transition: transform .26s ease;
}
.school-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-art);
  border-color: var(--line-strong);
  text-decoration: none;
}
.school-card:hover::after { transform: scaleY(1); }
.school-card .name {
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.4rem; line-height: 1.15; margin: 0 0 .35rem;
}
.school-card .meta { color: var(--muted); font-size: .92rem; }
.school-card .go {
  margin-top: 1.1rem; display: inline-flex; align-items: center; gap: .4rem;
  color: var(--accent); font-weight: 700; font-size: .92rem;
}
.school-card .go::after { content: "\2192"; transition: transform .2s ease; }
.school-card:hover .go::after { transform: translateX(4px); }

/* ---------- Student gallery grid ---------- */

.gallery {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.tile {
  display: block; color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: transform .22s ease, box-shadow .22s ease;
}
.tile:hover { transform: translateY(-5px); box-shadow: var(--shadow-art); text-decoration: none; }
.tile .frame {
  aspect-ratio: 1 / 1;
  background: var(--paper-2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; border-bottom: 1px solid var(--line);
}
.tile .frame img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.tile:hover .frame img { transform: scale(1.04); }
.tile .cap { padding: 14px 16px 16px; }
.tile .cap .student { font-family: var(--font-display); font-weight: 600; font-size: 1.12rem; line-height: 1.2; }
.tile .cap .title { color: var(--muted); font-size: .88rem; margin-top: .15rem; font-style: italic; }

/* ---------- Artwork page (the QR destination) ---------- */

.art-page { padding: clamp(20px, 4vw, 40px) 0 64px; }
.crumbs {
  font-size: .82rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 1.4rem; font-weight: 600;
}
.crumbs a { color: var(--ink-soft); }
.crumbs span { color: var(--line-strong); margin: 0 .4rem; }

.art-layout {
  display: grid; gap: clamp(26px, 5vw, 56px);
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 880px) {
  .art-layout { grid-template-columns: minmax(0, 1.45fr) minmax(300px, .9fr); }
}

.art-stage {
  background:
    linear-gradient(160deg, #ffffff, var(--paper-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(18px, 4vw, 40px);
  box-shadow: var(--shadow-art);
  display: flex; align-items: center; justify-content: center;
  animation: rise .7s cubic-bezier(.2, .7, .2, 1) both;
}
.art-stage img {
  max-height: 74vh; width: auto; max-width: 100%;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 18px 40px rgba(19,41,75,.22);
}

.label {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 5px solid var(--ink);
  border-radius: var(--radius);
  padding: clamp(22px, 4vw, 34px);
  box-shadow: var(--shadow-soft);
  animation: rise .7s .08s cubic-bezier(.2, .7, .2, 1) both;
  position: sticky; top: 18px;
}
@media (max-width: 879px) { .label { position: static; } }

.label .show-tag {
  font-size: .72rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin: 0 0 1rem;
}
.label h1 {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.7rem, 4.5vw, 2.5rem); line-height: 1.05;
  letter-spacing: -.015em; color: var(--ink); margin: 0;
}
.label .work-title { font-style: italic; color: var(--ink-soft); margin: .35rem 0 0; font-size: 1.1rem; }
.label .school {
  margin: .9rem 0 0; color: var(--muted); font-weight: 600;
  font-size: .95rem; display: inline-flex; align-items: center; gap: .5rem;
}
.label .school::before { content: ""; width: .5rem; height: .5rem; background: var(--accent-2); border-radius: 50%; }

.label .rule { height: 1px; background: var(--line); margin: 1.4rem 0; }
.statement-head {
  font-size: .74rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin: 0 0 .6rem;
}
.statement {
  font-family: var(--font-display);
  font-size: 1.12rem; line-height: 1.7; color: var(--text);
  font-weight: 400;
}
.statement p { margin: 0 0 1rem; }
.statement p:last-child { margin-bottom: 0; }
.statement p:first-child::first-letter {
  font-size: 2.9rem; line-height: .8; float: left;
  padding: .12em .12em 0 0; color: var(--accent); font-weight: 600;
}

/* ---------- buttons / generic ---------- */

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-sans); font-weight: 700; font-size: .92rem;
  padding: .7rem 1.2rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--ink); background: var(--ink); color: #fff;
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
  text-decoration: none;
}
.btn:hover { transform: translateY(-2px); text-decoration: none; box-shadow: var(--shadow-soft); }
.btn.alt { background: transparent; color: var(--ink); }
.btn.accent { background: var(--accent); border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

.empty {
  text-align: center; padding: 60px 20px; color: var(--muted);
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--paper-2);
}

/* ---------- footer ---------- */

.site-foot {
  border-top: 1px solid var(--line);
  margin-top: 40px; padding: 30px 0;
  color: var(--muted); font-size: .85rem;
}
.site-foot .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- motion ---------- */

@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.stagger > * { opacity: 0; animation: rise .55s cubic-bezier(.2,.7,.2,1) both; }
.stagger > *:nth-child(1){animation-delay:.02s}
.stagger > *:nth-child(2){animation-delay:.06s}
.stagger > *:nth-child(3){animation-delay:.10s}
.stagger > *:nth-child(4){animation-delay:.14s}
.stagger > *:nth-child(5){animation-delay:.18s}
.stagger > *:nth-child(6){animation-delay:.22s}
.stagger > *:nth-child(7){animation-delay:.26s}
.stagger > *:nth-child(8){animation-delay:.30s}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* =========================================================================
   Admin / configuration tool
   ========================================================================= */

.admin-shell { max-width: 980px; margin: 0 auto; padding: 0 22px; }
.gate {
  max-width: 420px; margin: 12vh auto 0; text-align: center;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 38px 32px; box-shadow: var(--shadow-soft);
}
.gate h1 { font-family: var(--font-display); color: var(--ink); margin: 0 0 .3rem; }
.gate p { color: var(--muted); margin: 0 0 1.4rem; font-size: .94rem; }
.gate input { width: 100%; margin-bottom: 12px; }
.gate .err { color: var(--accent); font-size: .85rem; min-height: 1.1em; margin-top: .4rem; }

.field { margin-bottom: 20px; }
.field label { display: block; font-weight: 700; color: var(--ink); margin-bottom: .4rem; font-size: .92rem; }
.field .hint { color: var(--muted); font-size: .82rem; margin-top: .35rem; }

input[type="text"], input[type="password"], textarea, select {
  width: 100%; font-family: var(--font-sans); font-size: 1rem;
  padding: .7rem .8rem; border: 1px solid var(--line-strong);
  border-radius: var(--radius); background: var(--paper-2); color: var(--text);
}
textarea { resize: vertical; min-height: 150px; line-height: 1.55; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}
input[type="file"] {
  width: 100%; padding: .6rem; border: 1px dashed var(--line-strong);
  border-radius: var(--radius); background: var(--paper-2); font-size: .92rem;
}

.admin-head { padding: 26px 0 8px; }
.admin-head h1 { font-family: var(--font-display); color: var(--ink); margin: 0; font-size: 1.9rem; }
.admin-head p { color: var(--muted); margin: .4rem 0 0; }

.notice {
  border-radius: var(--radius); padding: 12px 14px; font-size: .88rem;
  margin: 14px 0; border: 1px solid;
}
.notice.info  { background: #eef3fb; border-color: #cfe0f5; color: #1d3a63; }
.notice.warn  { background: #fdf2e7; border-color: #f3d4ac; color: #8a4a12; }
.notice.ok    { background: #ecf6ee; border-color: #c5e6cc; color: #245c33; }
.notice.bad   { background: #fdecec; border-color: #f5c8c8; color: #8a2222; }

.card-block {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow-soft); margin: 18px 0;
}
.card-block h2 { font-family: var(--font-display); color: var(--ink); margin: 0 0 1rem; font-size: 1.35rem; }

.result-grid { display: grid; gap: 22px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .result-grid { grid-template-columns: 220px 1fr; } }

.qr-box { text-align: center; }
.qr-box .qr-canvas {
  display: inline-block; padding: 14px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius);
}
.qr-box .qr-canvas img, .qr-box .qr-canvas canvas { display: block; margin: 0 auto; }

.url-pill {
  display: block; word-break: break-all; font-size: .86rem;
  background: var(--paper-2); border: 1px solid var(--line);
  padding: .6rem .7rem; border-radius: var(--radius); color: var(--ink-soft);
  margin-top: .6rem; font-family: var(--font-sans);
}

.preview-tile {
  display: flex; gap: 16px; align-items: center;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; background: var(--paper-2);
}
.preview-tile img { width: 92px; height: 92px; object-fit: cover; border-radius: 3px; border: 1px solid var(--line); }
.preview-tile .pi-name { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; color: var(--ink); }
.preview-tile .pi-school { color: var(--muted); font-size: .9rem; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }

.session-list { margin-top: 8px; }
.session-list table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.session-list th, .session-list td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.session-list th { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; }

.spinner {
  display: inline-block; width: 1em; height: 1em; border: 2px solid currentColor;
  border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Sponsor band (landing) ---------- */

/* Sponsor band — sits at the top of the site footer. */
.sponsor-band {
  padding: 4px 0 clamp(20px, 3vw, 30px);
  margin-bottom: clamp(20px, 3vw, 28px);
  border-bottom: 1px solid var(--line);
}
.sponsor-kicker {
  text-align: center; margin: 0 0 1rem;
  font-size: .72rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
}
.sponsor-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: clamp(20px, 5vw, 56px);
}
.sponsor { display: inline-flex; align-items: center; }
.sponsor-logo {
  max-height: 64px; width: auto; max-width: 200px;
  object-fit: contain;
  /* Show sponsor logos in full colour — brands expect their real colours. */
  transition: transform .2s ease;
}
a.sponsor:hover .sponsor-logo { transform: translateY(-2px); }

/* ---------- Admin: management lists (schools / artworks / sponsors) ---------- */

.manage-list { display: flex; flex-direction: column; gap: 10px; }
.manage-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper-2); padding: 10px 12px;
}
.manage-row.is-hidden { opacity: .6; }
.manage-row .mr-thumb {
  width: 46px; height: 46px; object-fit: cover; border-radius: 3px;
  border: 1px solid var(--line); background: #fff; flex: none;
}
.manage-row .mr-main { flex: 1 1 auto; min-width: 0; }
.manage-row .mr-name {
  font-family: var(--font-display); font-weight: 600; color: var(--ink);
  font-size: 1.02rem; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.manage-row .mr-sub { color: var(--muted); font-size: .82rem; }
.manage-row .mr-actions { display: flex; gap: 8px; flex: none; }
.badge-hidden {
  display: inline-block; margin-left: .5rem; vertical-align: middle;
  font-size: .64rem; letter-spacing: .1em; text-transform: uppercase;
  font-weight: 700; color: var(--muted);
  border: 1px solid var(--line-strong); border-radius: 999px;
  padding: .12rem .5rem; background: #fff;
}
.btn.tiny { padding: .4rem .75rem; font-size: .8rem; }
.btn.danger { background: #b3261e; border-color: #b3261e; color: #fff; }
.btn.danger.alt { background: transparent; color: #b3261e; }
.manage-group-title {
  font-family: var(--font-sans); font-weight: 700; color: var(--ink-soft);
  font-size: .82rem; letter-spacing: .08em; text-transform: uppercase;
  margin: 18px 0 8px;
}
.manage-group-title:first-child { margin-top: 0; }

/* =========================================================================
   Admin: tab bar + Appearance (Content / Look) editor with live preview
   ========================================================================= */

.admin-tabs {
  display: flex; flex-wrap: wrap; gap: 4px;
  border-bottom: 1px solid var(--line);
  margin: 18px 0 22px;
}
.admin-tab {
  appearance: none; background: none; border: none; cursor: pointer;
  font-family: var(--font-sans); font-weight: 700; font-size: .9rem;
  color: var(--muted); padding: 10px 16px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .15s ease, border-color .15s ease;
}
.admin-tab:hover { color: var(--ink-soft); }
.admin-tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }

.tab-panel[hidden] { display: none; }

/* ---- Appearance layout ---- */
.appearance-sub {
  display: inline-flex; gap: 4px; padding: 4px;
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: 999px; margin-bottom: 18px;
}
.appearance-sub button {
  appearance: none; border: none; cursor: pointer;
  background: transparent; color: var(--muted);
  font-family: var(--font-sans); font-weight: 700; font-size: .85rem;
  padding: .45rem 1.1rem; border-radius: 999px;
  transition: background .15s ease, color .15s ease;
}
.appearance-sub button.is-active { background: var(--ink); color: #fff; }

.appearance-body { display: grid; gap: 24px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 980px) {
  .appearance-body { grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); }
}
.appearance-controls { min-width: 0; }
.subpanel[hidden] { display: none; }

/* ---- Control groups / fields ---- */
.ctl-group { margin-bottom: 26px; }
.ctl-group > h3 {
  font-family: var(--font-sans); font-weight: 700; color: var(--ink-soft);
  font-size: .78rem; letter-spacing: .1em; text-transform: uppercase;
  margin: 0 0 .8rem; padding-bottom: .4rem; border-bottom: 1px solid var(--line);
}
.ctl-field { margin-bottom: 14px; }
.ctl-field label { display: block; font-weight: 600; color: var(--ink); margin-bottom: .3rem; font-size: .86rem; }
.ctl-field textarea { min-height: 80px; }
.ctl-grid-2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .ctl-grid-2 { grid-template-columns: 1fr; } }

/* Hero-image control (Appearance → Content) */
.hero-img-control { display: grid; gap: 16px; grid-template-columns: 120px 1fr; align-items: start; }
@media (max-width: 520px) { .hero-img-control { grid-template-columns: 1fr; } }
.hero-img-preview {
  width: 120px; height: 96px; flex: none;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-2);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  color: var(--muted); font-size: .72rem; text-align: center; padding: 4px;
}
.hero-img-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.hero-img-fields { min-width: 0; }

/* Per-row QR in the Manage list */
.mr-qr { flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.mr-qr .mr-qr-img { width: 64px; height: 64px; border: 1px solid var(--line); border-radius: 3px; background: #fff; padding: 3px; }
.mr-qr .mr-qr-img img, .mr-qr .mr-qr-img canvas { width: 100%; height: 100%; display: block; }
.mr-qr .mr-qr-acts { display: flex; gap: 4px; }
.mr-qr .mr-qr-acts button { font-size: .68rem; padding: .2rem .4rem; }

/* ---- Colour pickers ---- */
.color-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.color-cell { display: flex; flex-direction: column; gap: .35rem; }
.color-cell .cc-label { font-size: .8rem; font-weight: 600; color: var(--ink); }
.color-cell .cc-row { display: flex; gap: 8px; align-items: center; }
.color-cell input[type="color"] {
  width: 40px; height: 34px; padding: 2px; flex: none; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff;
}
.color-cell input[type="text"] {
  width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .82rem; padding: .45rem .5rem; text-transform: lowercase;
}

/* ---- Fonts + presets ---- */
.font-selects { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .font-selects { grid-template-columns: 1fr; } }
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 4px; }
.preset-chip {
  appearance: none; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--paper-2); color: var(--ink);
  font-family: var(--font-sans); font-weight: 600; font-size: .82rem;
  padding: .4rem .85rem; border-radius: 999px;
  transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.preset-chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.preset-swatches { display: inline-flex; gap: 3px; margin-right: .5rem; vertical-align: -2px; }
.preset-swatches i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; border: 1px solid rgba(0,0,0,.12); }

/* ---- Live preview pane ---- */
.appearance-preview { position: sticky; top: 16px; }
@media (max-width: 979px) { .appearance-preview { position: static; } }
.preview-switch { display: flex; gap: 6px; margin-bottom: 10px; }
.preview-switch button {
  appearance: none; cursor: pointer;
  border: 1px solid var(--line); background: var(--paper-2); color: var(--muted);
  font-family: var(--font-sans); font-weight: 700; font-size: .76rem;
  letter-spacing: .04em; padding: .4rem .8rem; border-radius: var(--radius);
}
.preview-switch button.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.preview-frame {
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  overflow: hidden; background: #fff; box-shadow: var(--shadow-soft);
}
.preview-frame iframe { display: block; width: 100%; height: 560px; border: 0; background: #fff; }
.preview-note { color: var(--muted); font-size: .78rem; margin: .6rem 0 0; }

/* ---- Shared action bar (Publish / Undo / Discard / Reset) ---- */
.action-bar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-top: 24px; padding: 14px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 -4px 18px rgba(19, 41, 75, .07);
}
.action-bar .spacer { flex: 1 1 auto; }
.draft-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .76rem; font-weight: 700; letter-spacing: .04em;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  padding: .3rem .7rem; border-radius: 999px;
}
.draft-badge::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--accent); }
.undo-depth { color: var(--muted); font-size: .8rem; }
