/* ═══════════════════════════════════════════════════════════════════════════
   WATERTOWN ANTIQUES Admin — colour system

   The content of this tool is PHOTOGRAPHS of antiques: browns, gilt, patina,
   old varnish. So the chrome is a neutral paper-grey and stays out of the way —
   a warm beige interface tints everything sitting on it and makes a photo's real
   colour impossible to judge. Brass appears sparingly, as the one brand accent.

   Three rules:
     1. Neutral greys for all surfaces, borders and fills. No warm tints behind
        or beside imagery.
     2. Brass (--gold) is an accent, never a text colour on white and never a
        background under white text — it fails contrast both ways. On brass, text
        is --ink.
     3. Status colour is muted and paired: a tinted background, a matching border,
        and a dark text tone that passes AA.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    /* Surfaces — cool-neutral so photographed wood reads true */
    --paper:       #f1f2f4;   /* app background */
    --surface:     #ffffff;   /* cards, grids, inputs */
    --subtle:      #f6f7f9;   /* zebra rows, inset panels, hovers */
    --sunken:      #eceef1;   /* table headers, chip counts, empty thumbs */

    /* Lines */
    --line:        #e2e5ea;
    --line-strong: #ced3da;

    /* Type */
    --text:        #1a1d21;
    --muted:       #5f6672;
    --faint:       #9aa1ab;

    /* Brand — warm espresso chrome + brass accent */
    --ink:         #23201c;
    --ink-soft:    #cbc3b8;   /* muted text on --ink */
    --gold:        #a98936;   /* accent only: focus rings, featured star, primary badge */
    --gold-hover:  #906c24;
    --gold-bg:     #f6efdf;
    --gold-line:   #dcc79a;

    /* Primary action — deep antique green. Solid = something happens when you click it. */
    --brand:       #1f4a3a;
    --brand-hover: #17392c;

    /* Status — tinted bg / border / AA-passing text, used as a set */
    --ok:      #186b3f;  --ok-bg:   #e9f4ed;  --ok-line:   #b6d9c3;
    --warn:    #8a5a12;  --warn-bg: #fbf1de;  --warn-line: #e6cf9e;
    --bad:     #9c2f26;  --bad-bg:  #f8eae8;  --bad-line:  #e3bcb6;

    /* One content width for the whole admin: fills the window, stops at a readable cap.
       Every page — grids, forms, photo manager — shares it. Change this single value
       to re-width the entire admin. */
    --maxw: 1600px;
    --gutter: 24px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    color: var(--text);
    background: var(--paper);
    font-size: 15px;
    line-height: 1.5;
}

/* Keyboard focus is visible everywhere. This is a tool someone will spend hundreds
   of hours in; losing your place while tabbing a long form is a real cost. */
:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Header / nav — full-bleed bar, contents pinned left. Deliberately NOT constrained to
   --maxw: the nav reads better anchored to the window edge than floating inward on a
   wide monitor. */
.admin-header {
    display: flex;
    align-items: center;
    gap: 36px;
    background: var(--ink);
    color: #fff;
    padding: 0 28px;
    height: 60px;
}
.admin-brand a { color: #fff; text-decoration: none; font-weight: 700; letter-spacing: 1px; }
.admin-brand span { color: var(--gold-line); font-weight: 400; }
.admin-nav { display: flex; gap: 22px; }
.admin-nav a {
    color: var(--ink-soft);
    text-decoration: none;
    font-weight: 600;
    padding: 6px 2px;
    border-bottom: 2px solid transparent;
}
.admin-nav a:hover { color: #fff; border-bottom-color: var(--gold-line); }

/* Logout */
.admin-logout { margin-left: auto; }
.admin-logout button { background: none; border: 1px solid rgba(255,255,255,0.25); color: var(--ink-soft); border-radius: 999px; padding: 5px 14px; font-size: 0.8rem; cursor: pointer; }
.admin-logout button:hover { color: #fff; border-color: var(--gold-line); }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--paper); padding: 24px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 36px; width: 100%; max-width: 360px; box-shadow: 0 6px 24px rgba(20,24,31,0.07); }
.login-brand { font-weight: 700; letter-spacing: 1px; color: var(--ink); margin-bottom: 22px; font-size: 1.1rem; }
.login-brand span { color: var(--gold); font-weight: 400; }
.login-error { margin-bottom: 16px; }
.login-card input[type="password"] {
    width: 100%;
    padding: 13px 15px;
    font-size: 1rem;
    border: 1px solid var(--line);
    border-radius: 4px;
    font-family: inherit;
    box-sizing: border-box;
}
.login-card input[type="password"]:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-bg); }
.login-btn { width: 100%; margin-top: 14px; padding: 13px 18px; box-sizing: border-box; }

/* Layout */
.admin-main { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 32px var(--gutter); }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-head h1 { font-size: 1.6rem; margin: 0; color: var(--ink); }
.muted { color: var(--muted); }

/* Buttons */
.btn {
    display: inline-block;
    padding: 9px 18px;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
}
.btn:hover { border-color: var(--brand); background: var(--subtle); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 700; }
.btn-danger:hover { background: #86281f; border-color: #86281f; }
.btn-xs { padding: 1px 8px; font-size: 0.72rem; }
.email-preview { width: 100%; height: 620px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
/* Token help key (kept out of <label> so tokens render in their real, case-sensitive form) */
.token-help { background: var(--subtle); border: 1px solid var(--line); border-radius: 6px; padding: 12px 16px; margin: 0 0 18px; font-size: 0.85rem; text-transform: none; letter-spacing: 0; color: var(--text); line-height: 1.5; }
.token-help ul { margin: 8px 0 0; padding-left: 18px; }
.token-help li { margin: 3px 0; }
.token-help code { background: var(--surface); border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; font-family: Consolas, "Courier New", monospace; color: var(--gold-hover); }

/* Grid table */
.grid { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; font-size: 12.5px; }
.grid th, .grid td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.grid thead th { background: var(--sunken); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.grid tbody tr:nth-child(even) { background: var(--subtle); }   /* zebra: scanning aid at 200 rows/page */
.grid tbody tr:last-child td { border-bottom: none; }
.grid tbody tr:hover { background: var(--gold-bg); }

/* Sortable column headers */
.sort-link { color: inherit; text-decoration: none; cursor: pointer; white-space: nowrap; }
.sort-link:hover { color: var(--ink); }

/* Count-by-x summary chips (used as a quick filter) */
.source-summary { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.src-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 0.82rem; text-decoration: none; color: var(--text); background: var(--surface); }
.src-chip:hover { border-color: var(--gold); background: var(--gold-bg); }
.src-chip span { background: var(--sunken); border-radius: 999px; padding: 0 7px; font-size: 0.74rem; color: var(--muted); }
.src-chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.src-chip.active span { background: rgba(255,255,255,0.22); color: #fff; }

/* Confirm modal */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(26,29,33,0.55);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 20px;
    /* Blur the page behind it so the dialog reads as a stop, not an overlay you can
       keep working around. Harmless where unsupported. */
    backdrop-filter: blur(2px);
    animation: modalFade .12s ease-out;
}
.modal-box {
    background: var(--surface); border-radius: 10px; padding: 26px 28px;
    max-width: 460px; width: 100%;
    box-shadow: 0 18px 50px rgba(20,24,31,0.34);
    border-top: 3px solid var(--gold);
    animation: modalRise .14s cubic-bezier(.2,.8,.3,1);
}
.modal-box h3 { margin: 0 0 10px; color: var(--ink); font-size: 1.18rem; }
.modal-box p { margin: 0 0 22px; color: var(--text); line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
/* The dialog is reached by keyboard as often as by mouse — the focus ring has to be
   obvious, because Cancel is focused on open and Enter acts on whatever holds it. */
.modal-actions .btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalRise { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
    .modal-overlay, .modal-box { animation: none; }
}
/* Grid links stay in the neutral palette — a saturated blue would be the loudest
   colour on a page whose subject is photographs. The underline carries the affordance. */
.grid a { color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-color: var(--gold-line); text-underline-offset: 3px; }
.grid a:hover { color: var(--gold-hover); text-decoration-color: var(--gold); }
.col-narrow { width: 120px; }
.col-tiny { width: 90px; }
.col-center { text-align: center; }

/* Grid status toggles */
.grid td form { margin: 0; }
.toggle {
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--muted);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    min-width: 56px;
}
.toggle:hover { border-color: var(--brand); }
/* State pills are TINTED; solid fills are reserved for actions (see .btn-primary), so a
   "Live" badge can't be mistaken for a button now that the primary action is also green. */
.toggle.on { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.toggle.off { background: var(--surface); color: var(--faint); }
.toggle.feat-on { background: var(--gold); border-color: var(--gold); color: var(--ink); }

/* Entry form — no width cap of its own; it fills the shared content container. */
.entryform { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 26px; }
.entryformrow { margin-bottom: 18px; }
.entryformrow label { display: block; font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 6px; }
.entryformrow input[type="text"],
.entryformrow input:not([type]),
.entryformrow input[type="date"],
.entryformrow input[type="email"],
.entryformrow input[type="tel"],
.entryformrow input[type="url"],
.entryformrow input[type="number"],
.entryformrow select,
.entryformrow textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95rem;
    background: var(--surface);
    color: var(--text);
}
.entryformrow input:focus, .entryformrow select:focus, .entryformrow textarea:focus {
    outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-bg);
}

/* Placeholders read as prompts, not as content.
   --faint against --surface is about 2.6:1, well under the 4.5:1 a placeholder would need
   if it were carrying information. That is the point: these say what a field is FOR, and
   the label above says the same thing at full contrast, so nothing is lost by anyone who
   can't read them. Deliberately kept above the ~1.5:1 where text stops being legible at
   all — this is "clearly not filled in", not "invisible".
   Italic does the work that colour alone can't, for anyone who can't discriminate the
   tone: a filled field is never italic, so the two states differ in shape as well. */
.entryformrow input::placeholder,
.entryformrow textarea::placeholder,
.photo-caption::placeholder,
.photo-alt::placeholder,
.filter-search::placeholder {
    color: var(--faint);
    font-style: italic;
    opacity: 1;   /* Firefox dims placeholders again by default; this stops double-fading. */
}
/* A heading inside a fieldset, for a second group of fields under one legend. */
.subhead {
    margin: 26px 0 0;
    font-size: 0.78rem; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}

/* Opening hours: seven rows of day / closed / opens / closes.
   A grid rather than a table so the four columns stay aligned down the week — the point
   of the layout is that you can run an eye down "Opens" and see the odd one out. */
.hours-grid {
    display: grid;
    grid-template-columns: minmax(90px, 1fr) auto minmax(110px, 1fr) minmax(110px, 1fr);
    gap: 8px 14px;
    align-items: center;
    margin-top: 12px;
    max-width: 560px;
}
.hours-head {
    font-size: 0.7rem; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--muted);
    padding-bottom: 2px; border-bottom: 1px solid var(--line);
}
.hours-day { font-size: 0.92rem; color: var(--text); }
.hours-closed { display: flex; justify-content: center; }
.hours-closed input { accent-color: var(--gold); width: auto; margin: 0; }
.hours-grid input[type="time"] {
    width: 100%;
    padding: 7px 9px;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    font-family: inherit; font-size: 0.92rem;
    background: var(--surface); color: var(--text);
}
.hours-grid input[type="time"]:focus {
    outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-bg);
}
@media (max-width: 560px) {
    .hours-grid { grid-template-columns: minmax(70px, 1fr) auto 1fr 1fr; gap: 6px 8px; }
}

.bodyarea { font-family: ui-monospace, Consolas, monospace; }
.checkrow { display: flex; gap: 28px; }
.checklabel { display: flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-size: 0.95rem; color: var(--text); }
.checklabel input { width: auto; accent-color: var(--gold); }
.form-actions { display: flex; gap: 12px; margin-top: 8px; }

/* Image upload row */
.upload-row { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.upload-row input[type="file"] { font-size: 0.85rem; }
#image-upload-status { font-size: 0.8rem; }

/* Notice banner */
.notice { background: var(--gold-bg); border: 1px solid var(--gold-line); color: #5f4712; padding: 12px 16px; border-radius: 4px; margin-bottom: 20px; }
/* "Something here is incomplete", as opposed to the plain notice's "that worked". Uses
   the --warn set rather than --bad: an unrecorded sale is a gap to fill in, not a fault. */
.notice-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }

/* Test-send box */
.test-send { margin-top: 22px; }
.test-head { font-size: 1.1rem; margin: 0 0 6px; color: var(--ink); }
.test-row { display: flex; gap: 12px; margin-top: 12px; max-width: 480px; }
.test-row input { flex: 1; }

/* ── Catalogue grid ─────────────────────────────────────────────────────── */
.count-total { font-size: 0.9rem; font-weight: 400; margin-left: 10px; }
.head-actions { display: flex; align-items: center; gap: 12px; }
.pill { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; border-radius: 999px; padding: 3px 10px; }
.pill-live { background: var(--ok-bg); border: 1px solid var(--ok-line); color: var(--ok); }
.pill-draft { background: var(--sunken); border: 1px solid var(--line-strong); color: var(--muted); }

.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 16px; }
.filter-bar select, .filter-bar input[type="search"] {
    padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 4px;
    font-family: inherit; font-size: 0.88rem; background: var(--surface); color: var(--text);
}
.filter-bar select:focus, .filter-bar input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-bg); }
.filter-search { flex: 1; min-width: 220px; }

.grid-items td { vertical-align: middle; }
.col-thumb { width: 56px; }
.col-right { text-align: right; }
.mono { font-family: Consolas, "Courier New", monospace; font-size: 0.92em; color: var(--muted); }
.circa { font-size: 0.85em; margin-left: 6px; }
/* Neutral mat around every thumbnail — a tinted one would shift the photo's colour. */
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 3px; border: 1px solid var(--line); display: block; background: var(--sunken); }
.thumb-empty { display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 1.1rem; }
.photo-count { color: var(--muted); }
.photo-none { color: var(--bad); font-weight: 700; }

.status-select { border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px 8px; font-size: 0.74rem; font-weight: 600; background: var(--surface); cursor: pointer; font-family: inherit; color: var(--text); }
.status-select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-bg); }
.status-available  { background: var(--ok-bg);   border-color: var(--ok-line);   color: var(--ok); }
.status-onhold     { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.status-sold       { background: var(--bad-bg);  border-color: var(--bad-line);  color: var(--bad); }
.status-notforsale { background: var(--sunken);  border-color: var(--line-strong); color: var(--muted); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; flex-wrap: wrap; }
.pager-links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

/* Category tree */
.cat-top td { background: var(--sunken); font-weight: 600; }
.cat-indent { color: var(--faint); margin-right: 6px; }

/* ── Item editor ────────────────────────────────────────────────────────── */
.form-cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
@media (max-width: 1100px) { .form-cols { grid-template-columns: minmax(0, 1fr); } }
.form-group { border: 1px solid var(--line); border-radius: 6px; padding: 18px 20px 4px; margin: 0 0 20px; min-width: 0; }
.form-group legend { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 0 8px; }
/* Private block is tinted so it's obvious at a glance that none of it is public. */
.form-private { background: var(--subtle); border-color: var(--line-strong); }
.form-private legend { color: var(--gold-hover); }
.hint { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); font-size: 0.78rem; margin-left: 6px; }
.row-2, .row-3, .row-4, .row-5 { display: grid; gap: 0 16px; }
.row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 900px) {
    .row-3, .row-4, .row-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.checkrow-stack { flex-direction: column; gap: 10px; align-items: flex-start; }
.side-meta { font-size: 0.82rem; line-height: 1.7; padding: 0 4px; }
.form-actions-sticky {
    position: sticky; bottom: 0; background: var(--surface);
    padding: 14px 0; margin-top: 0; border-top: 1px solid var(--line); z-index: 10;
}

/* ── Photo manager ──────────────────────────────────────────────────────── */
.photos { margin-top: 22px; }
.photos-locked { margin-top: 22px; }
.upload-drop {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    border: 2px dashed var(--line-strong); border-radius: 8px;
    padding: 18px 20px; margin: 14px 0 18px; background: var(--subtle);
}
.upload-drop.drag { border-color: var(--gold); background: var(--gold-bg); }
.upload-status { font-size: 0.85rem; color: var(--muted); margin-left: auto; }
.upload-error { color: var(--bad); font-weight: 600; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.photo-card { margin: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; cursor: grab; }
.photo-card.dragging { opacity: 0.45; }
.photo-card:first-child { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(168,128,47,0.2); }
.photo-card:first-child .photo-thumb::after {
    content: "Primary"; position: absolute; top: 8px; left: 8px;
    background: var(--gold); color: var(--ink); font-size: 0.66rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em; border-radius: 3px; padding: 2px 7px;
}
/* Neutral mat behind every photo, for the same reason as .thumb. */
.photo-thumb { position: relative; aspect-ratio: 1; background: var(--sunken); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-card figcaption { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.photo-card figcaption input {
    width: 100%; padding: 5px 7px; border: 1px solid var(--line); border-radius: 3px;
    font-family: inherit; font-size: 0.8rem; background: var(--surface); color: var(--text);
}
.photo-card figcaption input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-bg); }
.photo-actions { display: flex; gap: 6px; }
.photo-actions .btn { flex: 1; text-align: center; }
.photo-empty { margin-top: 4px; }

/* Danger zone */
.danger-zone { margin-top: 22px; border-color: var(--bad-line); }

/* ── Media picker ─────────────────────────────────────────────────────────
   Used by the Site page for the logo and hero image. The preview is sized by
   aspect-ratio rather than a fixed height so a portrait mark and a landscape
   photograph both sit sensibly without the panel jumping around. */
.btn-sm { padding: 4px 12px; font-size: 0.78rem; }

.field-note {
    margin: 0 0 16px; font-size: 0.86rem; line-height: 1.5; color: var(--muted); max-width: 62ch;
}

.media-field { margin-bottom: 18px; }

.media-preview {
    display: flex; align-items: center; justify-content: center;
    background: var(--sunken); border: 1px dashed var(--line-strong); border-radius: 5px;
    overflow: hidden; padding: 10px;
}
.media-preview.drag { border-color: var(--gold); background: var(--gold-bg); }
.media-preview img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; }

.media-wide .media-preview { aspect-ratio: 3 / 2; }
.media-tall .media-preview { aspect-ratio: 3 / 4; }

/* A media field in the MAIN column has no 300px sidebar holding it in, so an
   aspect-ratio preview grows to the full column width. Cap it: a picker is a control,
   not a display, and it only has to be big enough to recognise the photograph. */
.media-compact { max-width: 340px; }

/* Lets a transparent mark read against something other than flat grey. */
.media-preview-checker {
    background-color: var(--surface);
    background-image:
        linear-gradient(45deg, var(--sunken) 25%, transparent 25%, transparent 75%, var(--sunken) 75%),
        linear-gradient(45deg, var(--sunken) 25%, transparent 25%, transparent 75%, var(--sunken) 75%);
    background-size: 16px 16px;
    background-position: 0 0, 8px 8px;
}

.media-empty {
    font-size: 0.82rem; color: var(--faint); text-align: center; padding: 0 12px;
}

.media-actions {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px;
}
.media-status { font-size: 0.8rem; color: var(--muted); }
.media-error { color: var(--bad); }

/* ── Contacts ─────────────────────────────────────────────────────────────
   Search + filter bar above the contacts grid. */
.contact-bar {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 18px;
}
.contact-bar input[type="text"], .contact-bar select {
    padding: 7px 10px; font: inherit; font-size: 0.9rem;
    border: 1px solid var(--line-strong); border-radius: 4px;
    background: var(--surface); color: var(--text);
}
.contact-bar input[type="text"] { min-width: 260px; }
.contact-bar input[type="text"]:focus, .contact-bar select:focus {
    outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(169,137,54,0.14);
}

/* Worked examples in the importer — shows the accepted shapes at a glance. */
.import-sample {
    margin: 0 0 18px; padding: 12px 14px;
    background: var(--sunken); border: 1px solid var(--line); border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.82rem; line-height: 1.7; color: var(--muted);
    white-space: pre; overflow-x: auto;
}

/* ── Bulk selection ───────────────────────────────────────────────────────
   Checkbox column and the action bar that appears once anything is ticked. */
.col-check { width: 34px; text-align: center; }
.col-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.col-check input[type="checkbox"]:disabled { cursor: not-allowed; opacity: 0.35; }

/* Hidden until something is selected, so it never takes space it hasn't earned. */
.bulk-bar {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 14px; padding: 10px 14px;
    background: var(--gold-bg); border: 1px solid var(--gold-line); border-radius: 4px;
    font-size: 0.9rem; color: #5f4712;
}
.bulk-bar[hidden] { display: none; }

/* Sending is the consequential action on this page — it gets the brand colour. */
.btn-send { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.btn-send:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }

.recipient-list {
    margin: 0 0 4px; padding: 0 0 0 18px;
    columns: 2; column-gap: 28px;
    font-size: 0.88rem; line-height: 1.9; color: var(--text);
}
@media (max-width: 700px) { .recipient-list { columns: 1; } }

/* ── Read-only record ─────────────────────────────────────────────────────
   The campaign detail view: facts as a definition list, then the message body
   rendered as it was sent. */
.record { display: grid; gap: 4px 20px; margin: 0 0 18px; }
@media (min-width: 560px) { .record { grid-template-columns: max-content 1fr; } }
.record dt {
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--muted); padding-top: 3px;
}
.record dd { margin: 0 0 8px; color: var(--text); }

/* The sent message. Bounded and scrollable so a long mailing doesn't push the
   resend controls off the bottom of the page. */
.record-body {
    margin-top: 16px; padding: 20px 22px;
    background: var(--subtle); border: 1px solid var(--line); border-radius: 5px;
    max-height: 460px; overflow-y: auto;
    font-size: 0.94rem; line-height: 1.65;
}
.record-body img { max-width: 100%; height: auto; }

/* Simulated reservation flag — see .sim-banner on the public site. */
.sim-notice { background: #fff4d6; border-color: #b8860b; color: #4a3a08; }
