/* ============================================================
 * Elgin Marble - Hub styles
 * Self-contained, no build step. Component-class names line up with the estate's
 * Tailwind-v4 sites (admin-table-wrap, btn-secondary, ...) so this can later swap
 * to the compiled pipeline with little churn.
 *
 * Brand: the logo's royal navy on white and warm marble, Oswald for headings (as the
 * original CRM had), the logo's swoosh under page titles. Gold only on navy - it
 * washes out on a light background - and no full dark bands.
 * ============================================================ */

/* Oswald (SIL Open Font License 1.1), self-hosted: the CSP allows fonts from 'self' only. */
@font-face {
    font-family: "Oswald";
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url("../fonts/oswald-latin.woff2") format("woff2");
}

:root {
    --navy:        #354485;   /* the logo's navy */
    --navy-dark:   #27336a;
    --navy-ink:    #1f2a5c;   /* headings */
    --navy-50:     #eef0f8;
    --navy-100:    #dde2f1;
    --stone:       #f1eee8;   /* the marble band behind page titles */
    --page:        #faf9f6;
    --surface:     #ffffff;
    --line:        #e4e0d7;
    --line-soft:   #eeebe4;
    --line-input:  #cdd2df;
    --zebra:       #f7f5f0;
    --ink:         #22262e;
    --muted:       #666e7c;
    --gold:        #e0bd62;   /* on navy only */
    --amber-bg:    #fbf1d8;
    --amber-ink:   #7a5b12;
    --ok:          #2e7a4d;
    --ok-bg:       #e3f1e8;
    --danger:      #b23a3a;
    --danger-bg:   #f8e5e5;
    --display:     "Oswald", "Bahnschrift SemiCondensed", "Arial Narrow", sans-serif;
    --body:        "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --radius:      6px;
    --shadow:      0 1px 2px rgba(31, 42, 92, 0.05), 0 1px 1px rgba(31, 42, 92, 0.03);
    --shadow-lift: 0 10px 28px rgba(31, 42, 92, 0.12);
    --width:       1240px;
}

* { box-sizing: border-box; }

/* Always keep room for the scrollbar, so the centred page doesn't jump sideways between short and long pages. */
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--body);
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--page);
}

a { color: var(--navy); }
a:hover { color: var(--navy-dark); }
h1, h2, h3 { font-family: var(--display); font-weight: 500; color: var(--navy-ink); }
::selection { background: var(--navy-100); }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

/* ---- The menu, down the left ----------------------------------------------------------------------
   White, because the logo is navy/grey on transparent; a navy rule along its edge carries the brand colour. The
   open section is filled navy with a gold edge (gold only ever on navy). On a phone it becomes a drawer. */
body.admin-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.admin-side {
    position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40;
    display: flex; flex-direction: column;
    background: var(--surface); border-right: 1px solid var(--line); box-shadow: inset -3px 0 0 var(--navy);
}
.side-brand {
    display: flex; flex-direction: column; align-items: flex-start; gap: 0.55rem; padding: 1.4rem 1.5rem 1.2rem;
    text-decoration: none; border-bottom: 1px solid var(--line-soft);
}
.side-brand .brand-logo { display: block; width: 100%; max-width: 186px; height: auto; }
.side-brand .tag, .admin-brand .tag {
    font-family: var(--display); font-size: 0.78rem; font-weight: 500; letter-spacing: 0.3em; text-transform: uppercase;
    color: var(--muted); line-height: 1.6;
}
.side-nav { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.9rem 0.85rem 1rem 0.75rem; }
.side-nav a {
    display: flex; align-items: center; gap: 0.75rem; padding: 0.62rem 0.85rem;
    font-family: var(--display); font-size: 0.95rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--navy-ink); text-decoration: none; border-radius: 4px;
    transition: background-color 0.15s, color 0.15s;
}
.side-nav a:hover { background: var(--navy-50); color: var(--navy); }
.side-nav a.active { background: var(--navy); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.side-icon { width: 19px; height: 19px; flex-shrink: 0; opacity: 0.85; }
.side-nav a.active .side-icon { opacity: 1; }
.side-group {
    margin: 1rem 0 0.3rem; padding: 0 0.85rem;
    font-size: 0.66rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
}
.side-foot {
    margin-top: auto; padding: 1rem 1.5rem 1.3rem; border-top: 1px solid var(--line-soft);
    display: flex; flex-direction: column; align-items: flex-start; gap: 0.6rem;
}
.side-user { color: var(--muted); font-size: 0.8rem; overflow-wrap: anywhere; }
.side-scrim { display: none; }

/* The phone bar (and the bare bar on a page without the menu). */
.admin-mobilebar {
    display: none; position: sticky; top: 0; z-index: 30; height: 62px; padding: 0 1rem;
    align-items: center; justify-content: space-between; gap: 1rem;
    background: var(--surface); border-bottom: 3px solid var(--navy);
}
.admin-mobilebar.bare { display: flex; }
.admin-brand { display: flex; align-items: center; gap: 0.8rem; text-decoration: none; flex-shrink: 0; }
.admin-brand .brand-logo { display: block; height: 38px; width: auto; }
.admin-brand .tag { padding-left: 0.8rem; border-left: 1px solid var(--line); }
.admin-hamburger {
    display: inline-flex; align-items: center; background: none; border: none; color: var(--navy);
    cursor: pointer; padding: 0.4rem; border-radius: 4px;
}
.admin-hamburger:hover { background: var(--navy-50); }

/* ---- Page frame ----------------------------------------------------------- */
/* The content column clips the page head's full-width band to itself, so it never runs under the menu. */
.admin-content { min-width: 0; min-height: 100vh; display: flex; flex-direction: column; overflow-x: clip; }
.admin-main {
    flex: 1;
    width: 100%;
    max-width: var(--width);
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
    display: flex;
    flex-direction: column;   /* lets the page head sit above any flash message (order, below) */
}
.admin-main > * { margin-top: 0; }

.admin-footer {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem;
    max-width: var(--width); width: 100%; margin: 0 auto; padding: 1.1rem 1.5rem 1.6rem;
    border-top: 1px solid var(--line); color: var(--muted); font-size: 0.78rem;
}
.footer-tagline { font-family: var(--display); letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.72rem; }

/* ---- Page head: the title on a marble band, full width ----------------------- */
.admin-page-head {
    order: -1;
    position: relative;
    display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem; flex-wrap: wrap;
    padding: 1.9rem 0 1.5rem;
    margin-bottom: 1.75rem;
    background: var(--stone);
    /* Shadows paint the band and its bottom rule edge to edge without widening the page (no sideways scroll). */
    box-shadow: 0 0 0 100vmax var(--stone), 0 1px 0 100vmax var(--line);
    clip-path: inset(0 -100vmax -1px);
}
.admin-page-head h1 { font-size: 2.15rem; line-height: 1.15; margin: 0; letter-spacing: 0.01em; }
/* The logo's swoosh, under every page title. */
.admin-page-head .rule {
    display: block; width: 118px; height: 9px; margin: 0.35rem 0 0.55rem;
    background: url("../images/swoosh.svg") no-repeat left center / contain;
}
.admin-page-head .sub { color: var(--muted); font-size: 0.92rem; }
.admin-page-head .sub a { font-weight: 600; text-decoration: none; }
.admin-page-head .sub a:hover { text-decoration: underline; }
.admin-page-head > .chip-row, .admin-page-head > a, .admin-page-head > .btn-primary { margin-bottom: 0.2rem; }

/* ---- Cards ------------------------------------------------------------------ */
.admin-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.5rem 1.6rem; box-shadow: var(--shadow);
}
.subcard + .subcard { margin-top: 1rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); }
.stat-card .n { font-family: var(--display); font-size: 2rem; font-weight: 500; color: var(--navy); line-height: 1.1; }
.stat-card .l { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-top: 0.25rem; }

/* ---- Section headings -------------------------------------------------------- */
.section-h {
    font-family: var(--display); font-weight: 500; font-size: 1.12rem; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--navy-ink); margin: 2.1rem 0 0.8rem;
}
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 2.1rem 0 0.8rem; }
.section-head .section-h { margin: 0; }

/* ---- Facts (label over value) --------------------------------------------------- */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 1.25rem 1.5rem; }
.detail-grid > div { font-weight: 500; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.detail-grid .dl {
    display: block; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase;
    color: var(--muted); margin-bottom: 0.2rem;
}
.pre-text { white-space: pre-line; color: var(--ink); margin: 0 0 1.1rem; line-height: 1.65; }
/* An inscription reads as lettering on a stone. */
.inscription-text {
    max-width: 620px; margin: 0 auto 1.4rem; padding: 1.6rem 1.25rem;
    text-align: center; font-family: Georgia, "Times New Roman", serif; font-size: 1.05rem; line-height: 1.85;
    letter-spacing: 0.05em; color: #2c3140;
    background: linear-gradient(160deg, #f4f2ee 0%, #e9e6df 100%);
    border: 1px solid #dcd7cc; border-radius: 4px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), inset 0 -1px 0 rgba(0, 0, 0, 0.03);
}
.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
.card-actions { display: flex; justify-content: flex-end; gap: 0.45rem; margin-top: 1rem; padding-top: 0.9rem; border-top: 1px solid var(--line-soft); }

/* ---- Tables ------------------------------------------------------------------ */
.admin-table-wrap {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    overflow-x: auto; box-shadow: var(--shadow);
}
.admin-table-wrap table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table-wrap thead { background: var(--navy); }
.admin-table-wrap th {
    text-align: left; padding: 0.8rem 1rem; color: #fff; white-space: nowrap;
    font-family: var(--display); font-weight: 500; font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase;
}
.admin-table-wrap th a { color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 0.3rem; }
.admin-table-wrap th a:hover { color: var(--gold); }
.sort-arrow { font-size: 0.7rem; line-height: 1; color: var(--gold); }
.admin-table-wrap td { padding: 0.7rem 1rem; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.admin-table-wrap tbody tr:nth-child(even) { background: var(--zebra); }
.admin-table-wrap tbody tr { transition: background-color 0.1s; }
.admin-table-wrap tbody tr:hover { background: var(--navy-50); }
.admin-table-wrap td.num, .admin-table-wrap th.num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table-wrap td.actions { text-align: right; white-space: nowrap; }
.admin-table-wrap td a, .td-link { color: var(--navy); font-weight: 600; text-decoration: none; }
.admin-table-wrap td a:hover { text-decoration: underline; }
.td-muted { color: var(--muted); }

/* ---- Badges ------------------------------------------------------------------ */
.badge {
    display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em;
    padding: 0.18rem 0.6rem; border-radius: 999px; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.75; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-gold { background: var(--amber-bg); color: var(--amber-ink); }
.badge-muted { background: #ecebe6; color: var(--muted); }
.badge-err { background: var(--danger-bg); color: var(--danger); }

/* ---- Buttons ------------------------------------------------------------------ */
.btn, .btn-primary, .btn-secondary {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    font-family: inherit; font-size: 0.9rem; font-weight: 600; line-height: 1.2; cursor: pointer; text-decoration: none;
    padding: 0.6rem 1.15rem; border-radius: 4px; border: 1px solid var(--navy); white-space: nowrap;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn-primary { background: var(--navy); color: #fff; box-shadow: 0 1px 2px rgba(31, 42, 92, 0.2); }
.btn-primary:hover { background: var(--navy-dark); border-color: var(--navy-dark); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--navy); border-color: var(--line-input); }
.btn-secondary:hover { border-color: var(--navy); background: var(--navy-50); color: var(--navy); }
.btn-secondary.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-sm { font-size: 0.8rem; padding: 0.42rem 0.85rem; }
/* Removing or deleting a record - outlined, so it never reads as the main action on a page. */
.btn-danger { background: var(--surface); color: var(--danger); border-color: #e2b9b9; }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
/* Live / All - one joined control. */
.seg { display: inline-flex; flex-shrink: 0; border: 1px solid var(--line-input); border-radius: 4px; overflow: hidden; background: var(--surface); }
.seg .btn-secondary { border: none; border-radius: 0; box-shadow: none; }
.seg .btn-secondary + .btn-secondary { border-left: 1px solid var(--line-input); }

/* ---- Search bar ------------------------------------------------------------------ */
.admin-search { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.search-grow { display: flex; gap: 0.5rem; flex: 1 1 320px; min-width: 0; }
.admin-search input[type="search"] {
    max-width: 420px; padding-left: 2.35rem;
    background: var(--surface) url("../images/icon-search.svg") no-repeat 0.75rem center / 17px;
}

/* ---- Forms ------------------------------------------------------------------ */
.form-input {
    display: block; width: 100%; max-width: 340px; font: inherit; font-size: 0.93rem; color: var(--ink);
    padding: 0.56rem 0.75rem; border: 1px solid var(--line-input); border-radius: 4px; background: var(--surface);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:hover { border-color: #b9c0d3; }
.form-input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px var(--navy-100); }
textarea.form-input { resize: vertical; min-height: 5.5rem; line-height: 1.55; }
select.form-input { cursor: pointer; }
.field { margin-bottom: 1.1rem; }
.field label, .field .field-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--navy-ink); margin-bottom: 0.35rem; }
/* A radio set under one field label (the client's marketing answer). */
.field .checkbox-row { display: inline-flex; font-size: 0.9rem; font-weight: 400; color: var(--ink); margin: 0.35rem 1.5rem 0 0; }
.field .form-input { max-width: none; }
.maxw-form { max-width: 860px; width: 100%; }
.maxw-form textarea.form-input, .maxw-form select.form-input, .maxw-form input.form-input { max-width: none; }
/* Save sits on its own line under the fields, never beside the last checkbox. */
.maxw-form > button[type="submit"] { display: flex; margin-top: 0.9rem; min-width: 9rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }
.form-row-name { grid-template-columns: 0.55fr 1fr 1fr; }
.checkbox-row {
    display: inline-flex; align-items: center; gap: 0.5rem; margin: 0.25rem 1.75rem 1rem 0;
    font-size: 0.9rem; color: var(--ink); cursor: pointer;
}
.checkbox-row input { width: 17px; height: 17px; accent-color: var(--navy); margin: 0; cursor: pointer; }
.checkbox-row label { cursor: pointer; }
input[type="checkbox"] { accent-color: var(--navy); }
/* The quote form: one card, in sections - the quote, the stone, the lettering. */
.quote-form { max-width: 980px; width: 100%; padding: 0; }
.quote-form > .flash { margin: 1.25rem 1.6rem 0; }
.form-section { padding: 1.4rem 1.6rem 0.5rem; }
.form-section + .form-section { border-top: 1px solid var(--line-soft); }
.form-section-h {
    font-family: var(--display); font-weight: 500; font-size: 1.02rem; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--navy-ink); margin: 0 0 1rem;
}
.form-hint { color: var(--muted); font-size: 0.88rem; margin: -0.4rem 0 1rem; }
.quote-form .form-row { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.quote-form .form-input { max-width: none; }
.check-group { display: flex; flex-wrap: wrap; gap: 0 0.25rem; padding: 0.2rem 0 0.4rem; }
.checkbox-strong { font-weight: 600; color: var(--navy-ink); }
.lettering-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 0 1.5rem; }
/* The wording is typed as it will be cut: centred, in a serif, like the stone panel that shows it. */
.inscription-input { font-family: Georgia, "Times New Roman", serif; text-align: center; letter-spacing: 0.04em; line-height: 1.7; }
.form-actions {
    display: flex; gap: 0.6rem; align-items: center; padding: 1.1rem 1.6rem; margin-top: 0.6rem;
    background: var(--zebra); border-top: 1px solid var(--line-soft); border-radius: 0 0 var(--radius) var(--radius);
}
.form-actions .btn-primary { min-width: 10rem; }
/* The lettering inside the memorial card on a quote. */
.lettering-block { margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid var(--line-soft); }
.sub-h {
    font-family: var(--display); font-weight: 500; font-size: 0.92rem; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--navy-ink); margin: 0 0 0.9rem;
}
.lead-text { font-size: 1rem; }
@media (max-width: 700px) {
    .lettering-grid { grid-template-columns: 1fr; }
    .form-section { padding: 1.2rem 1.2rem 0.4rem; }
    .form-actions { padding: 1rem 1.2rem; }
}

/* The remove/delete form under an edit form, kept apart from Save. */
.danger-zone {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    margin-top: 1.1rem; padding: 1rem 1.6rem; border-color: #ecd3d3; background: #fffcfc;
}
.danger-zone p { margin: 0; color: var(--muted); font-size: 0.88rem; }

.empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.result-note { color: var(--muted); font-size: 0.82rem; margin-bottom: 0.75rem; }

/* ---- Flash messages ------------------------------------------------------------------ */
.flash { border-radius: var(--radius); padding: 0.8rem 1.1rem; margin-bottom: 1.25rem; font-size: 0.9rem; border: 1px solid; }
.flash-ok { background: var(--ok-bg); color: var(--ok); border-color: #bfdfcb; }
.flash-err { background: var(--danger-bg); color: var(--danger); border-color: #e7bcbc; }
.flash-note { background: var(--amber-bg); color: var(--amber-ink); border-color: #ecd9a8; }
.inline-form { display: inline; }

/* ---- Documents (quote / layout / job sheet) ------------------------------------------- */
.doc-list { padding: 0.35rem 1.6rem; }
.doc-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem 1rem; flex-wrap: wrap; padding: 0.95rem 0; }
.doc-row + .doc-row { border-top: 1px solid var(--line-soft); }
.doc-row strong { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--navy-ink); margin-right: 0.6rem; font-weight: 600; }
.doc-row strong::before {
    content: ""; width: 22px; height: 22px; flex-shrink: 0;
    background: url("../images/icon-doc.svg") no-repeat center / contain;
}
.doc-row strong.no-icon::before { content: none; }
.upload-form { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.file-input { font: inherit; font-size: 0.8rem; max-width: 240px; color: var(--muted); }
.file-input::file-selector-button {
    font: inherit; font-weight: 600; color: var(--navy); background: var(--surface); cursor: pointer;
    border: 1px solid var(--line-input); border-radius: 4px; padding: 0.35rem 0.7rem; margin-right: 0.6rem;
}
.file-input::file-selector-button:hover { border-color: var(--navy); background: var(--navy-50); }

/* ---- Hub home: the three area cards ------------------------------------------------------ */
.hub-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.4rem; }
.hub-card {
    display: block; position: relative; background: var(--surface); border: 1px solid var(--line);
    border-top: 3px solid var(--navy); border-radius: var(--radius); padding: 1.6rem; text-decoration: none; color: var(--ink);
    box-shadow: var(--shadow); transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
}
a.hub-card:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); color: var(--ink); }
.hub-card .hc-icon {
    width: 46px; height: 46px; border-radius: 50%; background: var(--navy-50); color: var(--navy);
    display: flex; align-items: center; justify-content: center; margin-bottom: 1rem;
}
.hub-card h2 { margin: 0 0 0.3rem; font-size: 1.45rem; letter-spacing: 0.02em; }
.hub-card p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.55; }
.hub-card--disabled { cursor: default; border-top-color: var(--line); box-shadow: none; background: #fcfbf9; }
.hub-card--disabled .hc-icon { background: #efede8; color: #9aa0ab; }
.hub-card--disabled h2 { color: #8a909c; }
.hub-card .coming {
    position: absolute; top: 1.1rem; right: 1.1rem; font-size: 0.64rem; font-weight: 700;
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); background: #efede8;
    padding: 0.2rem 0.6rem; border-radius: 999px;
}
.hub-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line-soft); }
.hub-stats div { font-size: 0.68rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.hub-stats b { display: block; font-family: var(--display); font-size: 1.45rem; font-weight: 500; color: var(--navy); line-height: 1.15; letter-spacing: 0; }
.hub-open { display: inline-flex; margin-top: 1.1rem; font-size: 0.82rem; font-weight: 600; color: var(--navy); }
a.hub-card:hover .hub-open { text-decoration: underline; }

/* ---- Sign-in ------------------------------------------------------------------------- */
/* Light, like the rest of the Hub: a full navy page is off-brand, and the logo needs white behind it. */
.auth-wrap {
    min-height: 100vh; width: 100%; display: flex; align-items: center; justify-content: center; padding: 1.5rem;
    background: radial-gradient(ellipse at 30% 20%, #ffffff 0%, var(--stone) 55%, #e8e4dc 100%);
}
.auth-card {
    background: var(--surface); border-radius: 8px; border: 1px solid var(--line); border-top: 4px solid var(--navy);
    padding: 2.25rem 2.1rem 2rem; width: 100%; max-width: 390px; box-shadow: 0 18px 48px rgba(31, 42, 92, 0.14);
}
.auth-card .auth-logo { margin: 0 0 0.4rem; text-align: center; }
.auth-card .auth-logo img { display: inline-block; height: 68px; width: auto; }
.auth-card .auth-logo + .sub {
    text-align: center; font-family: var(--display); font-size: 0.82rem; letter-spacing: 0.24em; text-transform: uppercase;
    color: var(--muted); margin-bottom: 1.6rem; padding-bottom: 1.2rem;
    background: url("../images/swoosh.svg") no-repeat center bottom / 96px 8px;
}
.auth-card .btn-primary { width: 100%; margin-top: 0.4rem; padding: 0.7rem 1rem; font-size: 0.95rem; }
.auth-card .checkbox-row { margin-right: 0; }
.auth-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #e7bcbc; border-radius: 4px; padding: 0.65rem 0.85rem; font-size: 0.85rem; margin-bottom: 1rem; }

/* ---- Type-ahead combo (font picker) ------------------------------------------------------ */
.combo { position: relative; }
.combo-preview { margin-top: 0.4rem; font-size: 1.35rem; line-height: 1.4; color: var(--ink); min-height: 1.4em; }
.combo-menu {
    position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin-top: 3px;
    max-height: 280px; overflow-y: auto; list-style: none; padding: 0.3rem; margin-bottom: 0;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lift);
}
.combo-option {
    padding: 0.45rem 0.65rem; border-radius: 4px; cursor: pointer; font-size: 1.05rem; line-height: 1.3;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.combo-option:hover { background: var(--navy-50); }
.combo-empty { padding: 0.5rem 0.65rem; color: var(--muted); font-size: 0.85rem; }

/* ---- Pager ------------------------------------------------------------------------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; flex-wrap: wrap; margin-top: 1.1rem; }
.pager-size, .pager-nav { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.pager-right { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; justify-content: flex-end; }
.pager-label { font-size: 0.82rem; color: var(--muted); margin-right: 0.15rem; }
.page-box {
    display: inline-flex; align-items: center; justify-content: center; min-width: 2.1rem; height: 2.1rem; padding: 0 0.55rem;
    border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--navy);
    font-size: 0.82rem; font-weight: 600; text-decoration: none; transition: background-color 0.12s, border-color 0.12s;
}
a.page-box:hover { background: var(--navy-50); border-color: var(--navy); }
.page-box.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.page-ellipsis { color: var(--muted); padding: 0 0.1rem; }

/* ---- CSP-safe helpers (no inline style= anywhere) + Alpine bits ------------------------------ */
[x-cloak] { display: none !important; }
.ml-sm { margin-left: 0.5rem; }
.mt-md { margin-top: 1rem; }
.mb-lg { margin-bottom: 1.5rem; }

/* ---- Lists as cards on a phone ------------------------------------------------------------------
   The same table markup: each row becomes a card, laid out the same on every list. The cell marked c-title (the
   record's number or name) leads, with c-badge (status) on its line, top right. Then each labelled fact
   (data-label) on a line of its own, its label in a column of the same width on every card; then c-wide, a line of
   unlabelled text (a description, a reason); then the actions. c-hide drops out. Where a line breaks no longer
   depends on how long the values are. The title's link covers the whole card; other links and buttons stay on top. */
.sort-picker { display: none; align-items: center; gap: 0.5rem; }
.sort-picker .form-input { max-width: none; width: auto; flex: 1; padding-top: 0.45rem; padding-bottom: 0.45rem; }
@media (max-width: 720px) {
    .sort-picker { display: flex; flex: 1 1 100%; }
    .admin-table-wrap { overflow: visible; }
    .admin-table-wrap table, .admin-table-wrap tbody { display: block; }
    .admin-table-wrap thead { display: none; }
    .admin-table-wrap tbody tr {
        position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.35rem 0.75rem;
        padding: 0.85rem 1rem; border-top: 1px solid var(--line-soft);
    }
    .admin-table-wrap tbody tr:first-child { border-top: 0; }
    .admin-table-wrap tbody tr:active { background: var(--navy-50); }
    .admin-table-wrap td {
        order: 2; grid-column: 1 / -1; display: block; padding: 0; border: 0;
        font-size: 0.86rem; text-align: left !important; overflow-wrap: anywhere;
    }
    .admin-table-wrap td[data-label]:not(.c-title, .c-hide) { display: flex; align-items: baseline; gap: 0.6rem; }
    .admin-table-wrap td[data-label]:not(.c-title, .c-hide)::before {
        content: attr(data-label); flex: 0 0 5.75rem;
        font-size: 0.64rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
    }
    .admin-table-wrap td.c-title { grid-column: 1; grid-row: 1; min-width: 0; margin-bottom: 0.15rem; font-size: 1rem; font-weight: 600; color: var(--navy-ink); }
    .admin-table-wrap td.c-title[data-label]::before { content: attr(data-label) " "; }
    .admin-table-wrap td.c-title a::after { content: ""; position: absolute; inset: 0; }
    .admin-table-wrap td:not(.c-title) a, .admin-table-wrap td button { position: relative; z-index: 1; }
    .admin-table-wrap td.c-badge { grid-column: 2; grid-row: 1; align-self: start; }
    .admin-table-wrap td.c-wide { order: 3; }
    .admin-table-wrap td.c-hide { display: none; }
    .admin-table-wrap td.actions { order: 4; display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.35rem; }
    .admin-table-wrap td.actions .inline-form { display: inline-flex; }
}

/* Edit tables (Councils, Cemeteries, Lettering) reuse the list card, but their cells hold inputs. On a phone each
   field stacks - a small label above a full-width control - so the inputs line up instead of going ragged. */
/* Save sits under the table, with room above it so it never hugs the last field. */
.admin-table-wrap.edit-grid + .form-actions-inline { margin-top: 1.4rem; }
@media (max-width: 720px) {
    .admin-table-wrap.edit-grid tbody tr { grid-template-columns: 1fr; }
    .admin-table-wrap.edit-grid td[data-label]:not(.c-title) { display: block; }
    .admin-table-wrap.edit-grid td[data-label]:not(.c-title)::before {
        content: attr(data-label); display: block; flex: none; margin-bottom: 0.3rem;
    }
    .admin-table-wrap.edit-grid td .form-input,
    .admin-table-wrap.edit-grid td select.form-input { width: 100%; max-width: none; text-align: left; }
    .admin-table-wrap.edit-grid td .pound-input { width: 100%; }
    .admin-table-wrap.edit-grid td .pound-input .form-input { flex: 1; width: auto; text-align: left; }
    /* The £ moves up onto the field's label (LAIR FEE (£)), so the input holds just the amount. */
    .admin-table-wrap.edit-grid td[data-label]:has(.pound-input)::before { content: attr(data-label) " (£)"; }
    .admin-table-wrap.edit-grid td .pound-input span { display: none; }
    .admin-table-wrap.edit-grid td.c-title { margin-bottom: 0.4rem; }
    /* The read-only trip costs on Cemeteries keep the label beside the value. */
    .admin-table-wrap.edit-grid td.td-muted[data-label] { display: flex; }
    .admin-table-wrap.edit-grid td.td-muted[data-label]::before { display: inline; margin-bottom: 0; flex: 0 0 5.75rem; }
}

/* ---- Small screens ------------------------------------------------------------------------- */
/* The menu stays down the left from a small laptop up; below that the content needs the width, so it's a drawer. */
@media (min-width: 1001px) {
    .admin-side { display: flex !important; }   /* always shown, overriding Alpine x-show */
    .admin-shell .admin-mobilebar, .side-scrim { display: none !important; }
}
@media (max-width: 1000px) {
    body.admin-shell { display: block; }
    .admin-shell .admin-mobilebar { display: flex; }
    .admin-side {
        position: fixed; top: 0; bottom: 0; left: 0; width: min(290px, 84vw); height: auto; z-index: 60;
        box-shadow: inset -3px 0 0 var(--navy), var(--shadow-lift);
    }
    .side-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(20, 26, 48, 0.38); }
    .admin-content { min-height: calc(100vh - 62px); }
}
@media (max-width: 860px) {
    .admin-page-head { padding: 1.4rem 0 1.2rem; margin-bottom: 1.4rem; }
    .admin-page-head h1 { font-size: 1.75rem; }
    .admin-card { padding: 1.2rem; }
    .doc-list { padding: 0.25rem 1.2rem; }
}
/* On a phone the page's buttons always sit under the title. Left to wrap, they sat beside a short subtitle and
   under a long one, so they moved between pages, and between Live and All on the same page. */
@media (max-width: 720px) {
    .admin-page-head { flex-direction: column; align-items: flex-start; gap: 0.9rem; }
}
@media (max-width: 540px) {
    body { font-size: 14.5px; }
    .form-row, .form-row-name { grid-template-columns: 1fr; }
    .hub-stats { grid-template-columns: repeat(2, 1fr); }
    .detail-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1rem 1.25rem; }
    .admin-footer { flex-direction: column; }
}

/* ---- "What we hold" (a client's data, for a subject access request) -------------------------------- */
.held .admin-card + .section-h, .held .held-item + .section-h, .held p.td-muted + .section-h { margin-top: 2rem; }
.held-item { margin-bottom: 0.9rem; }
.held-item .sub-h { margin-top: 0; }
.held-list { margin: 0 0 1rem; padding-left: 1.2rem; line-height: 1.7; }
.print-only { display: none; }

@media print {
    body { background: #fff; font-size: 11pt; }
    .admin-side, .admin-mobilebar, .side-scrim, .admin-footer, .flash, .no-print { display: none !important; }
    .print-only { display: block; }
    body.admin-shell { display: block; }
    .admin-main { max-width: none; padding: 0; }
    .admin-page-head { box-shadow: none; clip-path: none; background: none; padding: 0 0 0.8rem; }
    .admin-card { box-shadow: none; break-inside: avoid; }
    .held-intro { font-weight: 600; margin: 0 0 1rem; }
    .inscription-text { background: none; border: 1px solid #ccc; }
    a { color: inherit; text-decoration: none; }
}

/* ---- Settings: each setting beside its guidance ------------------------------------------------- */
.settings-form { max-width: 980px; }
.guidance { color: var(--ink); line-height: 1.65; margin: 0 0 1.4rem; max-width: 72ch; }
.setting {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 0.5rem 2rem;
    padding: 1.2rem 0; border-top: 1px solid var(--line-soft);
}
.setting-field label { display: block; font-weight: 600; color: var(--navy-ink); margin-bottom: 0.55rem; }
.years-input { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; color: var(--ink); font-size: 0.92rem; }
.years-input .form-input { width: 5rem; text-align: center; }
.pound-input { display: flex; align-items: center; gap: 0.35rem; color: var(--ink); }
.pound-input .form-input { width: 6rem; text-align: right; }
.form-input-sm { width: 6rem; }
.setting-help { color: var(--muted); font-size: 0.88rem; line-height: 1.6; }
.setting-help p { margin: 0 0 0.6rem; }
.setting-help strong { color: var(--ink); }
.guidance-box {
    margin: 0.6rem 0 1.2rem; padding: 1rem 1.25rem; border-radius: var(--radius);
    background: var(--zebra); border: 1px solid var(--line-soft); font-size: 0.88rem; line-height: 1.6;
}
.guidance-box .sub-h { margin-top: 0; }
.guidance-box ul { margin: 0; padding-left: 1.15rem; }
.form-actions-inline { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem 1rem; }
.review-note { margin: 0 0 1rem; }
@media (max-width: 720px) {
    .setting { grid-template-columns: 1fr; }
}
