/* Staff, admin and contact pages. --brand is the brand colour, set on <body> by the server. */
@font-face { font-family: CardSans; font-weight: 400; src: url(/fonts/NotoSans-Regular.ttf) format("truetype"); }
@font-face { font-family: CardSans; font-weight: 700; src: url(/fonts/NotoSans-Bold.ttf) format("truetype"); }
:root { --ink: #1b1f24; --muted: #5d6673; --line: #e3e7ec; --bg: #f3f5f7; --bad: #b3261e; --good: #1e7a46; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 460px; }
@media (max-width: 480px) { .wrap { padding: 0 16px; } }

/* Top bar */
.topbar { background: #fff; border-top: 4px solid var(--brand); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.topbar-logo { width: 36px; height: 36px; border-radius: 8px; display: block; flex: none; }
.topbar-name { font-weight: 700; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.topbar-tag { font-size: 0.8rem; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.topbar-end { margin-left: auto; }

/* Headings and text */
.intro { margin: 36px 0 24px; }
h1 { font-size: 1.85rem; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 8px; }
h2 { font-size: 1.05rem; margin: 0 0 4px; letter-spacing: -0.01em; }
h3 { font-size: 0.95rem; margin: 0 0 8px; }
.lead { color: var(--muted); font-size: 1.05rem; margin: 0; max-width: 640px; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.foot { color: var(--muted); font-size: 0.88rem; margin: 32px 0 48px; }

/* Layout: form beside the preview on a wide screen, stacked on a phone */
.layout { display: grid; gap: 24px; align-items: start; }
.layout > * { min-width: 0; }
@media (min-width: 1000px) {
  .layout { grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); }
}
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 24px; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.04); min-width: 0; }
@media (max-width: 480px) { .card { padding: 18px; } }
.card-head { margin-bottom: 14px; }
.card-head p { margin: 0; }

/* Forms */
.fields { display: grid; gap: 14px; margin-top: 16px; }
.group-head { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 22px; }
.field-wrap { display: grid; gap: 4px; }
.pair { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 480px) { .pair { grid-template-columns: 1fr; } }
.field { display: grid; gap: 6px; font-weight: 600; font-size: 0.92rem; min-width: 0; }
.opt { font-weight: 400; color: var(--muted); font-size: 0.82rem; }
input, select { font: inherit; font-size: 1rem; font-weight: 400; color: var(--ink); width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid #cdd4dc; border-radius: 9px; background: #fff; transition: border-color 0.15s, box-shadow 0.15s; }
select { appearance: none; padding-right: 36px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235d6673' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 14px center; cursor: pointer; }
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--bad); }
input[type="file"] { padding: 8px; background: var(--bg); }
.field-error { display: none; color: var(--bad); font-size: 0.86rem; }
.field-error.show { display: block; }
.hint { color: var(--muted); font-size: 0.84rem; margin: 6px 0 0; }
.field-wrap .hint { margin: 0; }
.field-msg { color: var(--bad); font-weight: 600; font-size: 0.88rem; margin: 6px 0 0; }

/* Version and QR choices */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.segmented label, .check { position: relative; display: flex; gap: 10px; align-items: flex-start; border: 1px solid #cdd4dc; border-radius: 10px; padding: 11px 12px; cursor: pointer; font-weight: 400; transition: border-color 0.15s, background 0.15s; }
.segmented input, .check input { width: 18px; height: 18px; flex: none; margin: 2px 0 0; padding: 0; accent-color: var(--brand); }
.segmented label:has(input:checked), .check:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, #fff); }
.segmented label:has(input:focus-visible), .check:has(input:focus-visible) { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.segmented span, .check span { display: grid; gap: 1px; font-size: 0.95rem; min-width: 0; }
.segmented small, .check small { color: var(--muted); font-size: 0.82rem; line-height: 1.35; }
@media (max-width: 400px) { .segmented { grid-template-columns: 1fr; } }
.local { display: grid; gap: 14px; border-left: 3px solid var(--brand); background: color-mix(in srgb, var(--brand) 5%, #fff); border-radius: 0 10px 10px 0; padding: 14px 14px 16px; }
.local[hidden] { display: none; }
.local-intro { margin: 0; font-size: 0.88rem; color: var(--muted); }

/* Buttons */
.btn { font: inherit; font-weight: 600; font-size: 0.95rem; padding: 11px 20px; border: 1px solid var(--brand); border-radius: 9px; background: var(--brand); color: #fff; cursor: pointer; transition: filter 0.15s; }
.btn:hover { filter: brightness(0.9); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); outline-offset: 2px; }
.btn-ghost { font: inherit; font-size: 0.88rem; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); cursor: pointer; }
.btn-ghost:hover { background: var(--bg); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
.status { font-size: 0.9rem; color: var(--good); }
.btn-alt { background: #fff; color: var(--brand); }
.btn-alt:hover { filter: none; background: color-mix(in srgb, var(--brand) 7%, #fff); }
.btn[hidden] { display: none; }
.email-status { margin: 10px 0 0; font-size: 0.92rem; color: var(--good); font-weight: 600; }
.email-status:empty { display: none; }
.email-status.bad { color: var(--bad); }
#email-note { margin-top: 10px; }

/* Card preview: each side on a soft desk, at the card's shape */
.card-preview { display: grid; gap: 22px; justify-items: center; background: linear-gradient(160deg, #eef1f4, #e2e7ec); border-radius: 12px; padding: 30px 26px; }
@media (max-width: 480px) { .card-preview { padding: 16px; } }
.side { margin: 0; min-width: 0; width: 100%; max-width: 500px; }
.paper { width: 100%; border-radius: 3px; overflow: hidden; background: #fff; box-shadow: 0 1px 1px rgba(16, 24, 40, 0.08), 0 8px 22px rgba(16, 24, 40, 0.16); }
.card-svg, .card-canvas { display: block; width: 100%; height: 100%; }
.card-svg text { font-family: CardSans, sans-serif; font-kerning: none; font-variant-ligatures: common-ligatures; }
.side figcaption { margin-top: 10px; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); text-align: center; }
.preview-card .alert { margin: 16px 0 0; }

/* Print steps */
.steps { margin-top: 24px; }
.step-grid { display: grid; gap: 24px; margin-top: 16px; }
@media (min-width: 900px) { .step-grid { grid-template-columns: repeat(3, 1fr); } }
.step-grid > div { border-top: 3px solid var(--brand); padding-top: 14px; }
.step-grid p { margin: 0; font-size: 0.93rem; color: var(--muted); }

/* Admin */
.alert { border-radius: 10px; padding: 12px 16px; margin: 0 0 20px; font-size: 0.95rem; }
.alert-error { background: #fdeceb; border: 1px solid #f3c4bf; color: #7d1a12; }
.alert-ok { background: #e7f5ed; border: 1px solid #bfe3cd; color: #17573a; font-weight: 600; }
.settings .group + .group { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 22px; }
.settings .group h2 { margin-bottom: 14px; }
.settings .field + .hint + .field-msg, .settings .hint + .field { margin-top: 14px; }
.settings .field-msg + .field { margin-top: 14px; }
.slot-row { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.slot-body { flex: 1 1 200px; min-width: 0; }
.current-logo { display: block; width: 96px; height: 96px; object-fit: contain; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); }
.colour-row { display: flex; gap: 10px; align-items: center; }
.colour-row input[type="color"] { flex: none; width: 46px; height: 44px; padding: 3px; cursor: pointer; }
.colour-row input[type="text"] { font-family: ui-monospace, Menlo, Consolas, monospace; max-width: 160px; }
.settings .actions { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 20px; }
.note { margin-top: 18px; background: color-mix(in srgb, var(--brand) 7%, #fff); border-left: 3px solid var(--brand); border-radius: 8px; padding: 12px 16px; font-size: 0.9rem; }
.note p { margin: 0; }
.note p + p { margin-top: 6px; }
.check-inline { display: flex; gap: 8px; align-items: center; font-size: 0.88rem; margin-top: 10px; cursor: pointer; }
.check-inline input { width: 16px; height: 16px; padding: 0; margin: 0; flex: none; accent-color: var(--brand); }
.check-inline:has(input:disabled) { color: var(--muted); cursor: default; }

/* Admin: card templates, one row per card size */
.templates { margin-top: 24px; }
.templates > p { max-width: 900px; margin: 6px 0 0; }
.slot-grid { display: grid; gap: 14px; margin-top: 18px; }
.size-row { display: grid; gap: 12px; border-top: 1px solid var(--line); padding-top: 14px; }
@media (min-width: 800px) { .size-row { grid-template-columns: 200px 1fr 1fr; } }
.size-head { display: grid; align-content: start; gap: 2px; }
.size-head span { color: var(--muted); font-size: 0.84rem; }
.slot { display: grid; gap: 6px; align-content: start; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.slot-bad { border-color: #f3c4bf; background: #fff8f7; }
.slot-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.slot-name { font-weight: 700; font-size: 0.95rem; }
.badge { font-size: 0.75rem; font-weight: 600; border-radius: 999px; padding: 2px 9px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge-up { background: color-mix(in srgb, var(--brand) 10%, #fff); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 30%, #fff); }
.slot-file { margin: 0; font-size: 0.88rem; overflow-wrap: anywhere; }
.small-field { font-size: 0.84rem; gap: 4px; }
.small-field input[type="file"] { font-size: 0.84rem; padding: 6px; }
.slot-sample { font-size: 0.84rem; }
.slot .field-msg { margin: 2px 0 0; }
.save-bar { position: sticky; bottom: 0; z-index: 2; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); border-top: 1px solid var(--line); padding: 14px 0; margin-top: 20px; }
.signin { margin-top: 56px; }
.signin .fields { margin-top: 20px; }
.signin .btn { justify-self: start; }

/* Contact page: a phone-first profile in the brand */
.contact-page { background: var(--bg); min-height: 100vh; }
.contact-hero { background: var(--brand); color: var(--on-brand, #fff); padding: 28px 20px 84px; text-align: center; position: relative; overflow: hidden; }
.contact-hero::after { content: ""; position: absolute; width: 340px; height: 340px; border-radius: 50%; border: 22px solid currentColor; opacity: 0.08; right: -150px; top: -170px; }
.contact-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1rem; position: relative; z-index: 1; }
.contact-brand img { width: 40px; height: 40px; border-radius: 10px; background: #fff; padding: 4px; object-fit: contain; }
.profile { max-width: 520px; margin: -64px auto 0; padding: 0 16px 40px; position: relative; z-index: 1; }
.profile .card { padding: 26px 22px; }
.profile h1 { font-size: 1.7rem; margin: 0; overflow-wrap: anywhere; }
.profile .role { color: var(--brand-text, var(--brand)); font-weight: 600; margin: 4px 0 0; overflow-wrap: anywhere; }
.profile .org { color: var(--muted); margin: 2px 0 0; font-size: 0.95rem; }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; margin: 22px 0 6px; }
.quick a { display: grid; justify-items: center; gap: 6px; padding: 12px 6px; border-radius: 12px; background: color-mix(in srgb, var(--brand) 8%, #fff); color: var(--brand-text, var(--brand)); text-decoration: none; font-weight: 600; font-size: 0.88rem; }
.quick a:hover { background: color-mix(in srgb, var(--brand) 14%, #fff); }
.quick svg, .rows svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rows { list-style: none; margin: 14px 0 0; padding: 0; }
.rows li { display: flex; gap: 14px; align-items: flex-start; padding: 13px 0; border-top: 1px solid var(--line); }
.rows li > svg { flex: none; color: var(--brand-text, var(--brand)); margin-top: 2px; }
.rows .k { display: block; font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.rows .v { display: block; overflow-wrap: anywhere; color: var(--ink); text-decoration: none; }
.rows a.v { color: var(--brand-text, var(--brand)); font-weight: 600; }
.save { display: block; text-align: center; text-decoration: none; margin-top: 20px; }
.source { margin: 14px 0 0; text-align: center; color: var(--muted); font-size: 0.84rem; }
.empty { text-align: center; color: var(--muted); }
