:root {
    --bg: #f1f5f9;
    --card: #ffffff;
    --ink: #0f172a;
    --accent: #4f46e5;
    --accent-dark: #4338ca;
    --accent-2: #0ea5e9;
    --muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .05);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.5;
}

a { color: var(--accent); }

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

/* Header / nav */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    padding: .75rem 1.25rem;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    border-top: 3px solid var(--accent);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .05);
}
.admin-header { border-top-color: var(--accent-2); }
.brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--ink);
}
.logo { height: 44px; width: auto; }
.main-nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.main-nav a { text-decoration: none; color: var(--muted); font-weight: 600; }
.main-nav a.active, .main-nav a:hover { color: var(--accent); }

/* Footer */
.site-footer {
    text-align: center;
    color: var(--muted);
    padding: 1.5rem;
    font-size: .9rem;
}

/* Cards / posts */
h1 { margin-top: 0; }
.post-list { list-style: none; padding: 0; display: grid; gap: 1rem; }
.post-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow);
    transition: transform .12s ease, box-shadow .12s ease;
}
.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(15, 23, 42, .08), 0 12px 32px rgba(15, 23, 42, .08);
}
.post-card h2 { margin: 0 0 .25rem; font-size: 1.25rem; }
.post-card h2 a { text-decoration: none; }
.badge {
    display: inline-block;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .15rem .5rem;
    border-radius: 999px;
    color: #fff;
}
.badge.article { background: var(--accent); }
.badge.event   { background: var(--accent-2); }
.badge.draft   { background: var(--muted); }
.meta { color: var(--muted); font-size: .88rem; margin: .25rem 0 .5rem; }

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}
th, td { padding: .55rem .7rem; text-align: left; border-bottom: 1px solid var(--border); font-size: .92rem; }
th { background: #f8fafc; color: var(--muted); text-transform: uppercase; font-size: .78rem; letter-spacing: .03em; }
tr:hover td { background: #f8fafc; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--accent); }
th .arrow { color: var(--accent); font-size: .8em; }

/* Forms */
form.stack { display: grid; gap: .9rem; max-width: 640px; }
label { font-weight: 600; display: block; margin-bottom: .2rem; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], select, textarea {
    width: 100%;
    padding: .5rem .65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    background: #fff;
    transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}
textarea { min-height: 160px; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > div { flex: 1 1 180px; }

.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: .5rem 1rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .12s ease, box-shadow .12s ease;
}
.btn:hover { background: var(--accent-dark); box-shadow: 0 4px 12px rgba(79, 70, 229, .25); }
.btn.secondary { background: var(--muted); }
.btn.secondary:hover { background: #475569; box-shadow: none; }
.btn.danger { background: #e11d48; }
.btn.danger:hover { background: #be123c; box-shadow: none; }
.btn.small { padding: .3rem .6rem; font-size: .85rem; }

.flash {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    padding: .6rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}
.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: .6rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

/* Stats grid */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 1rem;
    text-align: center;
    box-shadow: var(--shadow);
}
.stat .num { font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat .lbl { color: var(--muted); font-size: .9rem; }

.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.filters > div { display: flex; flex-direction: column; }

/* Generic centered panel (login box, etc.) */
.member-card {
    max-width: 420px;
    margin: 2rem auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-top: 6px solid var(--accent);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 6px 20px rgba(0,0,0,.08);
}
.member-card .logo { height: 60px; }

/* Membership ID card — real card ratio (85.6 × 53.98 mm ≈ 1.586) */
.card-wrap { display: flex; flex-direction: column; align-items: center; margin: 2.5rem auto; perspective: 900px; }
.id-card {
    width: min(92vw, 470px);
    aspect-ratio: 85.6 / 53.98;
    border-radius: 16px;
    padding: clamp(.9rem, 3.4vw, 1.5rem);
    color: #fff;
    /* background: linear-gradient(135deg, var(--accent) 0%, #6d28d9 55%, var(--accent-2) 100%); */
    background: #032360;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .28);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    position: relative;
    transform-style: preserve-3d;
    will-change: transform;
    transition: transform .4s ease, box-shadow .4s ease;
}
/* subtle decorative sheen */
.id-card::after {
    content: "";
    position: absolute;
    inset: -40% -30% auto auto;
    width: 60%;
    height: 140%;
    background: radial-gradient(closest-side, rgba(255,255,255,.18), transparent 70%);
    pointer-events: none;
}
.id-card > * { position: relative; z-index: 1; }
.mc-top { display: flex; align-items: center; justify-content: space-between; gap: .55rem; }
.mc-logo { height: clamp(48px, 15vw, 78px); width: auto; filter: drop-shadow(0 1px 3px rgba(0,0,0,.35)); }
.mc-club {
    font-weight: 700;
    font-size: clamp(.68rem, 2.6vw, .9rem);
    letter-spacing: .03em;
    text-transform: uppercase;
    opacity: .95;
}
.mc-name { font-size: clamp(1.15rem, 5.4vw, 1.8rem); font-weight: 800; line-height: 1.1; }
.mc-vehicles {
    margin-top: .3rem;
    font-size: clamp(.66rem, 2.6vw, .85rem);
    opacity: .9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mc-bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: .6rem; }
.mc-fields { display: flex; gap: clamp(.9rem, 4.5vw, 1.8rem); }
.mc-fields > div { display: flex; flex-direction: column; }
.mc-label {
    font-size: clamp(.54rem, 2.1vw, .66rem);
    text-transform: uppercase;
    letter-spacing: .05em;
    opacity: .75;
}
.mc-value { font-size: clamp(.92rem, 3.6vw, 1.18rem); font-weight: 700; }
.mc-status {
    font-size: clamp(.6rem, 2.4vw, .78rem);
    font-weight: 700;
    padding: .32rem .65rem;
    border-radius: 999px;
    white-space: nowrap;
    align-self: center;
}
.id-card.is-valid .mc-status { background: rgba(16, 185, 129, .95); }
.id-card.is-invalid .mc-status { background: rgba(239, 68, 68, .95); }
.card-caption { color: var(--muted); font-size: .85rem; margin-top: 1rem; }

/* Pell HTML editor (email content) */
.pell { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.pell-content { height: 220px; background: #fff; }
.pell-actionbar { background: #f8fafc; border-bottom: 1px solid var(--border); }
.pell-button { color: var(--ink); }
