/* 2know Events – shared styles for the public RSVP page and the admin area */

:root {
    --bg: #f6f5fb;
    --surface: #ffffff;
    --surface-2: #f0eef8;
    --text: #1d1b2b;
    --muted: #6b6880;
    --border: #e1deee;
    --accent: #7c3aed;
    --accent-2: #ec4899;
    --accent-text: #ffffff;
    --ok: #15803d;
    --ok-bg: #dcfce7;
    --warn: #a16207;
    --warn-bg: #fef3c7;
    --bad: #b91c1c;
    --bad-bg: #fee2e2;
    --radius: 14px;
    --shadow: 0 10px 40px rgba(60, 30, 120, .12);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12101c;
        --surface: #1c1930;
        --surface-2: #26223d;
        --text: #f1effa;
        --muted: #a29fba;
        --border: #342f50;
        --accent: #a78bfa;
        --accent-2: #f472b6;
        --accent-text: #14101f;
        --ok: #86efac;
        --ok-bg: #14301f;
        --warn: #fcd34d;
        --warn-bg: #36290a;
        --bad: #fca5a5;
        --bad-bg: #3a1616;
        --shadow: 0 10px 40px rgba(0, 0, 0, .45);
    }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

a { color: var(--accent); }
h1, h2 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.2rem; }
p { margin: 0 0 1rem; }
pre { margin: 0; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Forms ---------- */

.field { margin-bottom: 1.1rem; }
label { display: block; font-weight: 600; margin-bottom: .35rem; font-size: .95rem; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="datetime-local"], input[type="file"], textarea, select {
    width: 100%;
    padding: .7rem .85rem;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
}
textarea { resize: vertical; }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
    outline-offset: 1px;
}

.help { color: var(--muted); font-size: .85rem; margin: .35rem 0 0; }
.field-error, .form-error { color: var(--bad); font-size: .85rem; margin: .3rem 0 0; min-height: 0; }
.field-error:empty, .form-error:empty { display: none; }
.form-error { background: var(--bad-bg); padding: .6rem .8rem; border-radius: 10px; margin: 0 0 1rem; }

.check { display: flex; gap: .65rem; align-items: flex-start; font-weight: 400; margin-bottom: 1rem; }
.check input { margin-top: .3rem; width: 1.05rem; height: 1.05rem; flex: none; accent-color: var(--accent); }
.check span { font-size: .9rem; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ping { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

.input-prefix { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.input-prefix span { padding: .7rem .6rem .7rem .85rem; color: var(--muted); background: var(--surface-2); white-space: nowrap; font-size: .9rem; display: flex; align-items: center; }
.input-prefix input { border: 0; border-radius: 0; }

.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .5rem; }
.form-inline { display: flex; gap: .6rem; flex-wrap: wrap; }
.form-inline input { flex: 1 1 14rem; width: auto; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .65rem 1.1rem;
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
    color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: 10px;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { color: var(--accent-text); background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.btn-primary:hover { background: linear-gradient(135deg, var(--accent), var(--accent-2)); filter: brightness(1.07); }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.btn-danger:hover { background: var(--bad-bg); }
.btn-small { padding: .3rem .65rem; font-size: .82rem; border-radius: 8px; }
.btn-block { display: flex; width: 100%; padding: .85rem 1rem; font-size: 1.05rem; }
.btn:disabled { opacity: .6; cursor: progress; }

.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }
form.inline { display: inline; margin: 0; }

/* ---------- Public page ---------- */

body.public {
    min-height: 100vh;
    display: flex; flex-direction: column;
    background:
        radial-gradient(900px 500px at 15% -10%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 70%),
        radial-gradient(800px 500px at 100% 0%, color-mix(in srgb, var(--accent-2) 22%, transparent), transparent 70%),
        var(--bg);
}
.stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 1.5rem 16px; }

.card {
    width: 100%; max-width: 30rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 1.75rem;
    box-shadow: var(--shadow);
}
.card-center { text-align: center; }
.card-narrow { max-width: 24rem; text-align: left; }
.card-narrow h1 { text-align: center; }
.card h1 { font-size: 2rem; }

.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 700; color: var(--accent); margin-bottom: .4rem; }
.lead { color: var(--muted); }

.meta { margin: 1rem 0; padding: 0; display: grid; gap: .6rem; }
.meta > div { display: flex; gap: .9rem; }
.meta dt { flex: 0 0 3.2rem; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; padding-top: .15rem; }
.meta dd { margin: 0; font-weight: 600; }
.desc { white-space: pre-line; color: var(--muted); margin-bottom: 1.5rem; }

.notice { background: var(--warn-bg); color: var(--warn); padding: .9rem 1rem; border-radius: 12px; font-weight: 600; }

.result { text-align: center; padding: 1.5rem 0 .5rem; }
.result h2 { font-size: 1.6rem; }
.result p { white-space: pre-line; color: var(--muted); }
.result-icon {
    width: 4rem; height: 4rem; margin: 0 auto 1rem; border-radius: 50%;
    display: grid; place-items: center; font-size: 2rem; font-weight: 700;
    background: var(--surface-2); color: var(--accent);
}
.result-confirmed .result-icon { background: var(--ok-bg); color: var(--ok); }
.result-confirmed .result-icon::before { content: "\2713"; }
.result-pending .result-icon::before { content: "\2709"; }

.site-footer { text-align: center; padding: 1rem; font-size: .8rem; color: var(--muted); display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }

/* ---------- Admin ---------- */

.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 68rem; margin: 0 auto; padding: .75rem 16px; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { font-weight: 800; text-decoration: none; color: var(--text); background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.topnav { display: flex; gap: 1.1rem; align-items: center; }
.topnav a { color: var(--text); text-decoration: none; font-weight: 600; }
.topnav a:hover { color: var(--accent); }

.container { max-width: 68rem; margin: 0 auto; padding: 1.5rem 16px 4rem; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head h1 { margin: .15rem 0 .1rem; }
.page-head p { margin: 0; }
.back { font-size: .85rem; text-decoration: none; color: var(--muted); }
.back:hover { color: var(--accent); }

.flash { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 500; }
.flash-success { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--bad-bg); color: var(--bad); }
.flash-warning { background: var(--warn-bg); color: var(--warn); display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }

code { font: .88em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: .1rem .35rem; border-radius: 6px; }

.checks { list-style: none; margin: 1rem 0; padding: 0; display: grid; gap: .4rem; }
.checks li { padding-left: 1.6rem; position: relative; font-size: .92rem; }
.checks li::before { position: absolute; left: 0; font-weight: 700; }
.check-ok::before { content: "\2713"; color: var(--ok); }
.check-bad::before { content: "\2715"; color: var(--bad); }
.check-warn::before { content: "!"; color: var(--warn); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin: 0 0 1.25rem; min-width: 0; }
.panel legend { font-weight: 700; padding: 0 .4rem; }
.panel > .help, .card > .help, .container > .help { margin-bottom: 1rem; }
.panel-narrow { max-width: 30rem; }
.panel-danger { border-color: color-mix(in srgb, var(--bad) 30%, var(--border)); }
.form-stack { max-width: 44rem; }

.linkbox { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.linkbox label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.linkbox-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.linkbox-row input { flex: 1 1 16rem; width: auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9rem; }

.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; }
.tabs a { padding: .65rem 1rem; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.count { display: inline-block; min-width: 1.4rem; padding: 0 .4rem; margin-left: .25rem; text-align: center; font-size: .78rem; background: var(--surface-2); color: var(--muted); border-radius: 999px; }
.count-alert { background: var(--warn-bg); color: var(--warn); }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.toolbar h2 { margin: 0; }
.toolbar-right { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.toolbar-right input[type="search"] { width: 14rem; padding: .4rem .7rem; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); text-decoration: none; color: var(--text); font-size: .88rem; font-weight: 600; }
.chip span { color: var(--muted); margin-left: .2rem; }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chip.active span { color: inherit; opacity: .8; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.table th.num, .table td.num { text-align: right; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.actions form.inline { display: inline-block; margin: 0 .3rem .3rem 0; }
.table tr[hidden] { display: none; }
.hint { font-size: .8rem; color: var(--warn); margin-top: .15rem; }

.badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.badge-confirmed { background: var(--ok-bg); color: var(--ok); }
.badge-pending { background: var(--warn-bg); color: var(--warn); }
.badge-declined { background: var(--bad-bg); color: var(--bad); }
.badge-sent { background: var(--ok-bg); color: var(--ok); }
.badge-queued { background: var(--warn-bg); color: var(--warn); }
.badge-failed { background: var(--bad-bg); color: var(--bad); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.inline-form { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.inline-form input { flex: 1 1 16rem; max-width: 26rem; }

.mailchecks { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .55rem; }
.mc { display: flex; gap: .75rem; align-items: flex-start; padding: .7rem .85rem; border-radius: 10px; background: var(--surface-2); }
.mc-icon { flex: 0 0 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .8rem; }
.mc .small { margin-top: .1rem; }
.mc-error { background: var(--bad-bg); }
.mc-error .mc-icon { background: color-mix(in srgb, var(--bad) 25%, transparent); color: var(--bad); }
.mc-warning { background: var(--warn-bg); }
.mc-warning .mc-icon { background: color-mix(in srgb, var(--warn) 25%, transparent); color: var(--warn); }
.mc-ok .mc-icon { background: var(--ok-bg); color: var(--ok); }
.mc-info .mc-icon { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }

.tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }
.tag { padding: .05rem .55rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: .74rem; font-weight: 600; text-decoration: none; }
.tag:hover { color: var(--accent); border-color: var(--accent); }
.check-col { width: 2.2rem; }
.check-col input { width: auto; }
.filters { flex: 1 1 auto; }
.filters select { width: auto; padding: .4rem .7rem; }
.bulkbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: .9rem; padding: .7rem .9rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.bulkbar select { width: auto; min-width: 12rem; padding: .4rem .7rem; }
.pager { display: flex; gap: .75rem; align-items: center; justify-content: center; margin: 1rem 0; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-start; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin: 0 0 1.25rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; text-align: center; }
.stat strong { display: block; font-size: 1.6rem; line-height: 1.2; }
.stat span { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.fold-panel > summary { cursor: pointer; list-style-position: inside; }
.fold-panel > summary h2 { display: inline; margin: 0; font-size: 1.15rem; }
.fold-panel[open] > summary { margin-bottom: .6rem; }
.fold { border-top: 1px solid var(--border); padding: .7rem 0; }
.fold:first-of-type { border-top: 0; }
.fold summary { cursor: pointer; font-weight: 600; padding: .2rem 0; }
.fold[open] summary { margin-bottom: .75rem; }
.attend { min-width: 5.5rem; }
.attend-yes { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); }
.inline-form .check { margin: 0; }
tr:target td { background: var(--warn-bg); }

.nav-dot { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; background: var(--bad); margin-left: .35rem; vertical-align: middle; }

.empty { text-align: center; padding: 2.5rem 1rem; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); color: var(--muted); }

/* ---------- Header image (public event page + admin preview) ---------- */

/* The same 16:9 crop on phone and desktop; the card is the only width constraint. */
.hero {
    position: relative;
    margin: -1.75rem -1.75rem 1.25rem;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 22px 22px 0 0;
    background: var(--surface-2);
}
.hero img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; }
.hero-top img { object-position: 50% 0; }
.hero-bottom img { object-position: 50% 100%; }
.hero.hero-preview { margin: 0 0 1rem; max-width: 28rem; border-radius: 12px; }

/* ---------- Logo (backend) ---------- */

.brand.brand-has-logo { background: none; -webkit-text-fill-color: currentColor; display: flex; align-items: center; }
.brand-logo { display: block; height: 2rem; width: auto; max-width: 12rem; object-fit: contain; }
.login-logo-wrap { text-align: center; margin-bottom: 1rem; }
.login-logo { display: inline-block; height: auto; width: auto; max-height: 3.5rem; max-width: 100%; }

.design-grid { align-items: start; gap: 1rem; }
.logo-preview { display: flex; align-items: center; justify-content: center; min-height: 5rem; padding: 1rem; margin-bottom: 1rem; border: 1px dashed var(--border); border-radius: 12px; background: var(--surface); text-align: center; }
.logo-preview img { max-height: 3rem; max-width: 100%; width: auto; height: auto; }
.logo-preview-dark { background: #1c1930; border-color: #342f50; }
.remove-form { margin-top: .75rem; }
.link-button.danger { color: var(--bad); }

/* ---------- Small screens ---------- */

@media (max-width: 480px) {
    .card { padding: 1.25rem; border-radius: 18px; }
    .card h1 { font-size: 1.6rem; }
    .hero { margin: -1.25rem -1.25rem 1rem; border-radius: 18px 18px 0 0; }
    .container { padding-top: 1rem; }
    .brand-logo { height: 1.6rem; max-width: 9rem; }
    .topbar-inner { gap: .5rem; }
    .topnav { gap: .85rem; font-size: .92rem; flex-wrap: wrap; }
    .page-head h1 { font-size: 1.4rem; }
    .tabs a { padding: .6rem .7rem; font-size: .92rem; }
    .linkbox-row .btn { flex: 1 1 auto; }
    .toolbar-right { width: 100%; }
    .toolbar-right input[type="search"] { flex: 1 1 auto; width: auto; }
}

/* Tables turn into stacked cards on phones (cells carry data-label for their caption). */
@media (max-width: 720px) {
    .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tr { padding: .8rem 1rem; border-bottom: 1px solid var(--border); }
    .table-stack tbody tr:last-child { border-bottom: 0; }
    .table-stack td { padding: .2rem 0; border: 0; text-align: left; }
    .table-stack td[data-label]::before { content: attr(data-label); display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
    .table-stack td.num { display: inline-block; width: 32%; text-align: left; vertical-align: top; }
    .table-stack td.actions { padding-top: .6rem; }
    /* comfortable touch targets for the per-row actions */
    .table-stack .btn-small { padding: .6rem .95rem; font-size: .92rem; min-height: 2.6rem; }
    .table-stack td.actions form.inline { margin: 0 .4rem .5rem 0; }
}

.example { background: var(--surface-2); border-radius: 10px; padding: .75rem 1rem; margin: .5rem 0 1rem; font: .88rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-x: auto; }

/* address book on phones (after the base rules above, so these win) */
@media (max-width: 640px) {
    .stats { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
    .stat strong { font-size: 1.4rem; }
    .attend { min-height: 2.6rem; min-width: 6.5rem; }
    .bulkbar select { width: 100%; }
    .filters select, .filters input[type="search"] { flex: 1 1 100%; width: 100%; }
    .head-actions .btn { flex: 1 1 auto; }
    .table-stack td.check-col { display: inline-block; width: auto; padding-right: .6rem; }
    .table-stack th.check-col { display: none; }
}
