[hidden] { display: none !important; }
:root {
  --bg: #f6f6f4; --panel: #fff; --ink: #1b1d21; --muted: #6b6f76; --line: #e3e3df;
  --brand: #23314a; --brand-ink: #fff; --accent: #c2410c;
  --ok: #15803d; --ok-bg: #ecfdf3; --err: #b91c1c; --err-bg: #fef2f2; --warn: #92400e; --warn-bg: #fffbeb;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--brand); }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
code { background: #f1f1ee; padding: 1px 5px; border-radius: 4px; font-size: .88em; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .85em; font-weight: 400; }
.warn { color: var(--warn); font-weight: 600; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }

/* Shell */
.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar { background: var(--brand); color: var(--brand-ink); padding: 1.25rem 1rem; display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { font-weight: 700; font-size: 1.05rem; letter-spacing: .01em; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a { color: #d6dcea; text-decoration: none; padding: .45rem .6rem; border-radius: 6px; }
.sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar nav a.active { background: rgba(255,255,255,.15); color: #fff; font-weight: 600; }
.nav-label { text-transform: uppercase; font-size: .7rem; letter-spacing: .08em; color: #8f9bb3; margin: 1rem .6rem .25rem; }
.me { border-top: 1px solid rgba(255,255,255,.15); padding-top: .8rem; font-size: .88rem; }
.me a, .me .link { color: #d6dcea; }
.me-name { font-weight: 600; }
.me-role { color: #8f9bb3; margin-bottom: .4rem; }
.main { padding: 1.5rem 2rem 3rem; max-width: 1280px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .main { padding: 1rem; }
}

/* Bare (login) */
body.bare { display: grid; place-items: center; min-height: 100vh; }
.bare-box { background: var(--panel); padding: 2rem; border-radius: var(--radius); width: min(380px, 92vw); box-shadow: 0 4px 24px rgba(0,0,0,.06); }
.bare-box .brand { font-weight: 700; font-size: 1.2rem; margin-bottom: 1.2rem; }

/* Components */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.card.narrow { max-width: 480px; }
fieldset.card { margin: 0; }
legend { font-weight: 700; padding: 0 .3rem; }
.stack { display: flex; flex-direction: column; gap: .9rem; }
.row { display: flex; gap: .9rem; flex-wrap: wrap; }
.row > label { flex: 1 1 160px; }
.row > label.grow { flex: 3 1 240px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.5rem; align-items: start; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }

label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
input, select, textarea { font: inherit; padding: .5rem .6rem; border: 1px solid #cfcfca; border-radius: 6px; background: #fff; color: var(--ink); width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; }
input[type=color] { width: 44px; height: 38px; padding: 2px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #94a3b8; outline-offset: 1px; }
textarea { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .88rem; }
.prefix-input { display: flex; align-items: stretch; }
.prefix-input span { background: #f1f1ee; border: 1px solid #cfcfca; border-right: 0; border-radius: 6px 0 0 6px; padding: .5rem .6rem; color: var(--muted); font-weight: 400; white-space: nowrap; overflow: hidden; max-width: 55%; text-overflow: ellipsis; }
.prefix-input input { border-radius: 0 6px 6px 0; }
.colour-input { display: flex; gap: .4rem; }
.radio-row { display: flex; gap: 1.2rem; flex-wrap: wrap; }

.btn { display: inline-block; font: inherit; font-weight: 600; padding: .55rem 1rem; border-radius: 6px; border: 1px solid #cfcfca; background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { background: #f4f4f1; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #1a2538; }
.btn-small { padding: .3rem .6rem; font-size: .82rem; }
.btn-ghost { background: transparent; }
button.link { background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; cursor: pointer; font: inherit; }
form.inline { display: inline; }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.flash-success { background: var(--ok-bg); color: var(--ok); border-color: #bbf7d0; }
.flash-error { background: var(--err-bg); color: var(--err); border-color: #fecaca; }
.flash-warning { background: var(--warn-bg); color: var(--warn); border-color: #fde68a; }

.table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafaf8; }
.table tr:last-child td { border-bottom: 0; }
.table.compact th, .table.compact td { padding: .4rem .6rem; font-size: .88rem; }
.table .actions { white-space: nowrap; text-align: right; }
.table .actions > * + * { margin-left: .8rem; }
.table td.details { font-family: ui-monospace, Menlo, monospace; font-size: .78rem; color: var(--muted); max-width: 420px; word-break: break-word; }
.table-scroll { overflow-x: auto; }
.logo-cell img { max-height: 32px; max-width: 80px; }

.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.badge-on { background: var(--ok-bg); color: var(--ok); }
.badge-off { background: #f1f1ee; color: var(--muted); }
.badge-sa { background: #ede9fe; color: #5b21b6; }
.swatch { display: inline-block; width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(0,0,0,.12); vertical-align: middle; }

/* Dashboard */
.tiles { display: flex; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; min-width: 200px; }
.tile-num { font-size: 1.8rem; font-weight: 700; }
.tile-label { color: var(--muted); font-size: .85rem; }
.venue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.venue-card { background: var(--panel); border: 1px solid var(--line); border-top: 5px solid var(--vc); border-radius: var(--radius); padding: 1rem 1.1rem; }
.venue-card-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.venue-card-head img { max-height: 28px; max-width: 70px; }
.venue-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: 0; }
.venue-stats dt { font-size: .72rem; color: var(--muted); }
.venue-stats dd { margin: 0; font-size: 1.2rem; font-weight: 700; }

/* Venue form + preview */
.logo-row { display: flex; gap: 1rem; align-items: center; }
.logo-current { width: 140px; height: 80px; border: 1px dashed #cfcfca; border-radius: 8px; display: grid; place-items: center; background: #fafaf8; flex: none; }
.logo-current img { max-width: 120px; max-height: 64px; }
.preview-wrap { position: sticky; top: 1rem; }
.preview { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--s); color: var(--t); margin-top: .4rem; box-shadow: 0 6px 24px rgba(0,0,0,.08); }
.pv-head { background: var(--p); color: #fff; padding: 1rem; display: flex; flex-direction: column; align-items: center; gap: .4rem; font-weight: 700; font-size: 1.05rem; }
.pv-head img { max-height: 56px; max-width: 200px; }
.pv-body { padding: 1rem 1.1rem 1.3rem; display: flex; flex-direction: column; gap: .55rem; }
.pv-title { font-weight: 700; font-size: 1.05rem; text-align: center; margin-bottom: .2rem; }
.pv-field { background: #fff; border: 1px solid rgba(0,0,0,.15); border-radius: 6px; padding: .45rem .6rem; font-size: .85rem; color: #888; }
.pv-check { font-size: .8rem; }
.pv-btn { background: var(--a); color: #fff; text-align: center; font-weight: 700; padding: .6rem; border-radius: 6px; }

/* Users */
.access-tools { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .7rem; }
.access-table tr.row-off td:not(:first-child) { opacity: .35; }
#venue-access.disabled { opacity: .5; pointer-events: none; }

/* Exports */
.venue-checks { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; padding: .4rem 0 .6rem 1.6rem; }
.venue-checks .radio-row { flex-basis: 100%; margin-top: .4rem; }
.venue-checks.disabled { opacity: .45; pointer-events: none; }
.col-checks { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; }
.confirm-unsub { display: none; background: var(--warn-bg); color: var(--warn); padding: .6rem; border-radius: 6px; }
.confirm-unsub.show { display: flex; }

.filter-bar { display: flex; gap: 1rem; align-items: end; margin-bottom: 1rem; }
.filter-bar label { min-width: 240px; }
.pager { display: flex; gap: 1rem; justify-content: center; margin-top: 1rem; }
.access-table td:first-child label { white-space: nowrap; }

.pv-head { background-size: cover; background-position: center; min-height: 90px; justify-content: center; }
.pv-logo-small { max-height: 32px !important; } .pv-logo-medium { max-height: 52px !important; } .pv-logo-large { max-height: 80px !important; }
.pv-intro { font-size: .82rem; text-align: center; opacity: .85; margin-top: -.3rem; }
h3.sub { font-size: .9rem; margin: .4rem 0 0; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.hero-current { display: flex; align-items: center; gap: 1rem; }
.hero-current img { max-height: 70px; max-width: 200px; border-radius: 6px; }
.flash-info { background: #eff6ff; color: #1e3a8a; border-color: #bfdbfe; }
.venue-link { margin-left: auto; font-size: .8rem; }

/* Campaigns */
.editor { border: 1px solid #cfcfca; border-radius: 8px; overflow: hidden; background: #fff; }
.toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; background: #fafaf8; border-bottom: 1px solid var(--line); align-items: center; }
.toolbar button { font: inherit; font-size: .82rem; border: 1px solid transparent; background: none; padding: .3rem .55rem; border-radius: 5px; cursor: pointer; color: var(--ink); }
.toolbar button:hover { background: #eee; border-color: #ddd; }
.toolbar button.on { background: var(--brand); color: #fff; }
.toolbar button:disabled { opacity: .35; cursor: default; }
.toolbar .sep { width: 1px; height: 20px; background: #ddd; margin: 0 4px; }
.toolbar .grow { flex: 1; }
.editor-area { min-height: 360px; padding: 1.1rem 1.3rem; outline: none; line-height: 1.55; }
.editor-area h1 { font-size: 1.6rem; margin: 0 0 .6rem; }
.editor-area h2 { font-size: 1.25rem; margin: 1rem 0 .4rem; }
.editor-area p { margin: 0 0 .8rem; }
.editor-area img { max-width: 100%; height: auto; display: block; margin: .6rem 0; }
.editor-area a.btn { display: inline-block; background: var(--accent); color: #fff; padding: .55rem 1.1rem; border-radius: 6px; text-decoration: none; font-weight: 700; }
.editor-html { border: 0; border-radius: 0; min-height: 360px; }
.audience { background: #f4f4f1; border-radius: 6px; padding: .6rem .7rem; }
.audience strong { font-size: 1.15rem; }
button.danger { color: var(--err); }
.summary th { width: 120px; text-transform: none; letter-spacing: 0; font-size: .85rem; }
.summary .big { font-size: 1.3rem; }
.email-preview { width: 100%; height: 640px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.schedule-at { display: none; } .schedule-at.show { display: flex; }
.bar { height: 12px; background: #ecece8; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--ok); transition: width .4s; }
.tiles-inline { display: flex; gap: 1.6rem; margin: 0; }
.tiles-inline strong { font-size: 1.3rem; }
.status-draft { background: #f1f1ee; color: var(--muted); }
.status-scheduled { background: #eff6ff; color: #1d4ed8; }
.status-sending { background: var(--warn-bg); color: var(--warn); }
.status-sent { background: var(--ok-bg); color: var(--ok); }
.status-cancelled { background: var(--err-bg); color: var(--err); }
.dash-head { display: flex; gap: .6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.split > * { min-width: 0; }
label.check { overflow-wrap: anywhere; }
label.check.indent { margin-left: 1.6rem; }
#authorisation.disabled > label { opacity: .4; pointer-events: none; }
.small-cell { font-size: .82rem; }
.auth-queue { border-left: 5px solid #1d4ed8; margin-bottom: 1rem; }
.auth-row { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.auth-row .btn { margin-left: auto; }
.stack-tight { display: flex; flex-direction: column; gap: .35rem; }
.lbl { font-weight: 600; font-size: .9rem; }
.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.birthday-status { margin: 0; }
.treat-box { background: #fafaf8; border: 1px solid var(--line); border-radius: 8px; padding: .9rem; }
.setup-box { background: #f4f6fb; border: 1px solid #dbe3f3; border-radius: 8px; padding: .8rem 1rem; font-size: .88rem; }
.setup-box ol { margin: .4rem 0 0; padding-left: 1.2rem; }
.setup-box li { margin: .25rem 0; }
.report-venues { margin-left: 1.6rem; width: calc(100% - 1.6rem); }
/* Contacts */
.contacts-filter { flex-wrap: wrap; } .contacts-filter label.grow { flex: 1 1 260px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; padding: 2px 8px; border-radius: 999px; margin: 1px 4px 1px 0; background: #f1f1ee; white-space: nowrap; }
.chip .swatch { width: 9px; height: 9px; }
.chip-subscribed { background: var(--ok-bg); color: var(--ok); }
.chip-pending { background: #eff6ff; color: #1d4ed8; }
.chip-unsubscribed { background: #f1f1ee; color: var(--muted); text-decoration: line-through; }
.sub-card { gap: .45rem; } .sub-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.inline-consent { margin-top: .6rem; max-width: 520px; }
details > summary { cursor: pointer; }
.danger-zone { border-color: #fecaca; }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
