/* ═══════════════════════════════════════════════════════════
   Night Out Planner — AI Elevation · Light theme
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* AI Elevation brand */
    --blue:        #1e56b0;
    --blue-hi:     #2463c4;
    --blue-soft:   #eff4fd;
    --blue-glow:   rgba(30, 86, 176, 0.18);
    --gold:        #c8a84b;
    --gold-soft:   #fdf8ed;

    /* Surfaces */
    --bg:          #eef2f8;
    --surface:     #ffffff;
    --surface-2:   #f6f8fc;
    --border:      rgba(26, 35, 64, 0.10);
    --border-hi:   rgba(30, 86, 176, 0.30);

    /* Vote colours */
    --yes:         #16a34a;
    --yes-bg:      #f0fdf4;
    --yes-border:  rgba(22, 163, 74, 0.45);
    --yes-glow:    rgba(22, 163, 74, 0.15);

    --no:          #dc2626;
    --no-bg:       #fef2f2;
    --no-border:   rgba(220, 38, 38, 0.45);
    --no-glow:     rgba(220, 38, 38, 0.15);

    --maybe:       #d97706;
    --maybe-bg:    #fffbeb;
    --maybe-border:rgba(217, 119, 6, 0.45);
    --maybe-glow:  rgba(217, 119, 6, 0.15);

    /* Text */
    --text:        #1a2340;
    --muted:       #5a6b85;
    --faint:       #9aadca;

    --radius:      14px;
    --radius-sm:   9px;
    --radius-xs:   6px;
}

/* ─── Base ──────────────────────────────────────────────────── */
body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ─── Auth pages ────────────────────────────────────────────── */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    min-height: 100vh;
    background:
        radial-gradient(ellipse 80% 60% at 20% 30%, rgba(30, 86, 176, 0.07) 0%, transparent 65%),
        radial-gradient(ellipse 60% 50% at 80% 70%, rgba(200, 168, 75, 0.06) 0%, transparent 60%),
        var(--bg);
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 44px 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 2px 8px rgba(26, 35, 64, 0.06), 0 12px 40px rgba(26, 35, 64, 0.10);
}

.auth-logo {
    display: block;
    height: 48px;
    width: auto;
    object-fit: contain;
    margin: 0 auto 28px;
}

.auth-card h1 {
    font-size: 22px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: -0.03em;
    color: var(--text);
}

.subtitle {
    color: var(--muted);
    text-align: center;
    margin-bottom: 28px;
    font-size: 14px;
    line-height: 1.6;
}

.auth-alt {
    text-align: center;
    margin-top: 18px;
    font-size: 14px;
    color: var(--muted);
}
.auth-alt a { color: var(--blue); text-decoration: none; }
.auth-alt a:hover { text-decoration: underline; }

/* ─── Form fields ───────────────────────────────────────────── */
.field { margin-bottom: 16px; }

.field label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 7px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.field input {
    width: 100%;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 13px 15px;
    color: var(--text);
    font-size: 17px;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s;
    -webkit-appearance: none;
    font-family: inherit;
}
.field input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-glow);
    background: var(--surface);
}
.field input::placeholder { color: var(--faint); }

#code {
    letter-spacing: 0.45em;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 28px;
    text-align: center;
}

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 13px 22px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.18s;
    text-decoration: none;
    letter-spacing: -0.01em;
    font-family: inherit;
}
.btn-primary {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 2px 8px var(--blue-glow);
}
.btn-primary:hover {
    background: var(--blue-hi);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px var(--blue-glow);
}
.btn-primary:active { transform: none; }
.btn-full { width: 100%; }

.btn-danger {
    background: transparent;
    border: 1.5px solid var(--no-border);
    color: var(--no);
    padding: 7px 13px;
    font-size: 13px;
}
.btn-danger:hover { background: var(--no-bg); }
.btn-sm { padding: 7px 13px; font-size: 13px; }

/* ─── Alerts ────────────────────────────────────────────────── */
.alert {
    padding: 12px 15px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 18px;
    line-height: 1.5;
}
.alert-error {
    background: var(--no-bg);
    border: 1px solid var(--no-border);
    color: #b91c1c;
}
.alert-success {
    background: var(--yes-bg);
    border: 1px solid var(--yes-border);
    color: #15803d;
}

/* ─── App shell ─────────────────────────────────────────────── */
.app-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg);
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 58px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: 0 1px 4px rgba(26, 35, 64, 0.06);
}

.header-logo {
    height: 30px;
    width: auto;
    object-fit: contain;
}

.header-right { display: flex; align-items: center; gap: 16px; }

.user-name {
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
}

.header-link {
    font-size: 13px;
    color: var(--blue);
    text-decoration: none;
    font-weight: 600;
}
.header-link:hover { text-decoration: underline; }

/* ─── Tabs ──────────────────────────────────────────────────── */
.tabs {
    display: flex;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
}
.tab {
    flex: 1;
    padding: 14px 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--faint);
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: all 0.18s;
    text-align: center;
    letter-spacing: -0.01em;
    font-family: inherit;
}
.tab:hover { color: var(--muted); }
.tab.active {
    color: var(--text);
    border-bottom-color: var(--gold);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─── Date list ─────────────────────────────────────────────── */
.dates-list {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 560px;
    margin: 0 auto;
    width: 100%;
}

.date-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: 0 1px 3px rgba(26, 35, 64, 0.05);
    transition: box-shadow 0.18s, border-color 0.18s;
}
.date-card:hover {
    border-color: var(--border-hi);
    box-shadow: 0 4px 16px rgba(26, 35, 64, 0.10);
}

.date-label { margin-bottom: 14px; }

.date-day {
    display: inline-block;
    font-size: 9px;
    font-weight: 800;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    background: var(--gold-soft);
    border: 1px solid rgba(200, 168, 75, 0.3);
    border-radius: 4px;
    padding: 2px 7px;
    margin-bottom: 7px;
}

.date-date {
    display: block;
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.03em;
}

/* ─── Vote buttons ──────────────────────────────────────────── */
.vote-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.vote-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 13px 6px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    background: var(--surface-2);
    color: var(--faint);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    font-family: inherit;
}
.vote-btn:hover {
    color: var(--text);
    border-color: var(--border-hi);
    background: var(--blue-soft);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 35, 64, 0.08);
}
.vote-btn:active { transform: scale(0.96); }

.btn-icon {
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
    display: block;
}

.vote-btn.yes.active {
    background: var(--yes-bg);
    border-color: var(--yes-border);
    color: var(--yes);
    box-shadow: 0 0 0 3px var(--yes-glow), 0 2px 8px var(--yes-glow);
    transform: none;
}
.vote-btn.no.active {
    background: var(--no-bg);
    border-color: var(--no-border);
    color: var(--no);
    box-shadow: 0 0 0 3px var(--no-glow), 0 2px 8px var(--no-glow);
    transform: none;
}
.vote-btn.maybe.active {
    background: var(--maybe-bg);
    border-color: var(--maybe-border);
    color: var(--maybe);
    box-shadow: 0 0 0 3px var(--maybe-glow), 0 2px 8px var(--maybe-glow);
    transform: none;
}

.vote-btn.saving { opacity: 0.4; pointer-events: none; }

/* ─── Results ───────────────────────────────────────────────── */
.no-votes { font-size: 13px; color: var(--faint); font-style: italic; }

.summary-counts {
    display: flex;
    gap: 14px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 11px;
    letter-spacing: -0.01em;
}
.count-yes   { color: var(--yes); }
.count-no    { color: var(--no); }
.count-maybe { color: var(--maybe); }

.result-people { display: flex; flex-wrap: wrap; gap: 6px; }

.person-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid transparent;
}
.person-pill.yes   { background: var(--yes-bg);   color: var(--yes);   border-color: var(--yes-border); }
.person-pill.no    { background: var(--no-bg);    color: var(--no);    border-color: var(--no-border); }
.person-pill.maybe { background: var(--maybe-bg); color: var(--maybe); border-color: var(--maybe-border); }

/* ─── Toast ─────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(70px);
    background: var(--text);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 700;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    z-index: 100;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(26, 35, 64, 0.25);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ─── Admin ─────────────────────────────────────────────────── */
.admin-content {
    max-width: 700px;
    margin: 0 auto;
    padding: 20px 16px;
    width: 100%;
}
.admin-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 14px;
    box-shadow: 0 1px 3px rgba(26, 35, 64, 0.05);
}
.admin-section h2 {
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--text);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}
.admin-section h2::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 16px;
    background: linear-gradient(to bottom, var(--blue), var(--gold));
    border-radius: 2px;
}
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; }
.inline-form input {
    flex: 1;
    min-width: 130px;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 10px 13px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s;
    font-family: inherit;
}
.inline-form input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-glow);
}
.inline-form input::placeholder { color: var(--faint); }
.field-hint { font-size: 12px; color: var(--faint); margin-top: 10px; line-height: 1.5; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
    text-align: left;
    color: var(--muted);
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    padding: 0 10px 10px 0;
    border-bottom: 1px solid var(--border);
}
.admin-table td {
    padding: 11px 10px 11px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.badge-admin {
    display: inline-block;
    padding: 3px 10px;
    background: var(--gold-soft);
    border: 1px solid rgba(200, 168, 75, 0.35);
    color: #92700a;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}
.text-muted { color: var(--muted); font-size: 14px; }

/* ─── Dashboard event cards ─────────────────────────────────── */
.event-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    box-shadow: 0 1px 3px rgba(26,35,64,.05);
    transition: border-color .18s, box-shadow .18s;
}
.event-card:hover { border-color: var(--border-hi); box-shadow: 0 4px 16px rgba(26,35,64,.10); }
.event-card-body { flex: 1; min-width: 0; }
.event-card-title {
    font-size: 16px; font-weight: 800; letter-spacing: -.02em;
    color: var(--text); text-decoration: none;
}
.event-card-title:hover { color: var(--blue); }
.event-card-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.event-card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ─── Status badges ─────────────────────────────────────────── */
.badge-replied {
    display: inline-block; padding: 3px 10px;
    background: var(--yes-bg); border: 1px solid var(--yes-border);
    color: var(--yes); border-radius: 999px; font-size: 11px; font-weight: 700;
}
.badge-calendar {
    display: inline-block; padding: 3px 10px;
    background: var(--blue-soft); border: 1px solid var(--border-hi);
    color: var(--blue); border-radius: 999px; font-size: 11px; font-weight: 700;
    cursor: help;
}
.badge-pending {
    display: inline-block; padding: 3px 10px;
    background: var(--maybe-bg); border: 1px solid var(--maybe-border);
    color: var(--maybe); border-radius: 999px; font-size: 11px; font-weight: 700;
}
.badge-waiting {
    display: inline-block; padding: 3px 10px;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--muted); border-radius: 999px; font-size: 11px; font-weight: 700;
}

/* ─── Invitee blocks ────────────────────────────────────────── */
.invitee-block {
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
}
.invitee-block:last-child { border-bottom: none; padding-bottom: 0; }
.invitee-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}

/* ─── Invite message box ────────────────────────────────────── */
.invite-box {
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 13px 15px;
}
.invite-meta { font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; }
.invite-text { font-size: 13px; color: var(--text); line-height: 1.6; word-break: break-all; }

/* ─── Ghost button ──────────────────────────────────────────── */
.btn-ghost {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    transition: all .18s;
    display: inline-flex; align-items: center;
}
.btn-ghost:hover { border-color: var(--border-hi); background: var(--blue-soft); color: var(--blue); }

/* ─── Day-of-week picker ────────────────────────────────────── */
.day-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.day-pill { display: inline-flex; align-items: center; cursor: pointer; }
.day-pill input { display: none; }
.day-pill span {
    display: inline-block;
    padding: 6px 13px;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: var(--surface-2);
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    transition: all .18s;
    user-select: none;
}
.day-pill input:checked + span {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}
.day-pill:hover span { border-color: var(--border-hi); color: var(--text); }
.range-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 6px;
}

/* ─── Page intro ────────────────────────────────────────────── */
.page-intro { margin-bottom: 4px; }
.page-title { font-size: 20px; font-weight: 800; letter-spacing: -.03em; }
.page-subtitle { font-size: 14px; color: var(--muted); margin-top: 3px; }

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 400px) {
    .auth-card { padding: 30px 18px; }
    .date-date { font-size: 17px; }
    .vote-btn { padding: 11px 4px; font-size: 9px; }
    .btn-icon { font-size: 17px; }
    .app-header { padding: 0 14px; }
    .header-logo { height: 26px; }
    .user-name { display: none; }
}

/* ─── Calendar grid ──────────────────────────────────────────── */
.cal-wrap {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px 16px;
}

.cal-range {
    font-size: 14px;
    color: var(--muted);
    text-align: center;
    margin-bottom: 18px;
    line-height: 1.5;
}
.cal-range strong { color: var(--text); }

.cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 14px;
}
.cal-nav-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 7px 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}
.cal-nav-btn:hover:not(:disabled) {
    background: var(--blue-soft);
    border-color: var(--border-hi);
}
.cal-nav-btn:disabled { opacity: 0.25; pointer-events: none; }
#cal-month-label { font-size: 15px; font-weight: 800; color: var(--text); white-space: nowrap; }

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}
.cal-day-head {
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--faint);
    padding: 2px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.cal-day {
    min-height: 54px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xs);
    gap: 5px;
    padding: 4px 2px;
}
.cal-day-num {
    font-size: 13px;
    line-height: 1;
    color: var(--muted);
}
.cal-day.other-month .cal-day-num { color: var(--faint); opacity: 0.45; }
.cal-day.event-date {
    cursor: pointer;
    background: var(--surface);
    border: 1.5px solid var(--border);
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.cal-day.event-date .cal-day-num {
    color: var(--text);
    font-weight: 700;
}
.cal-day.event-date:hover {
    background: var(--blue-soft);
    border-color: var(--border-hi);
}
.cal-day.event-date.popover-open {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-glow);
}

/* Vote state tints */
.cal-day.event-date.yes   { background: var(--yes-bg);   border-color: var(--yes-border); }
.cal-day.event-date.no    { background: var(--no-bg);    border-color: var(--no-border); }
.cal-day.event-date.maybe { background: var(--maybe-bg); border-color: var(--maybe-border); }

/* Dot indicator */
.cal-vote-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--faint);
    flex-shrink: 0;
}
.cal-vote-dot.yes   { background: var(--yes); }
.cal-vote-dot.no    { background: var(--no); }
.cal-vote-dot.maybe { background: var(--maybe); }

/* Vote popover */
.cal-popover {
    position: fixed;
    background: var(--surface);
    border: 1.5px solid var(--border-hi);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    box-shadow: 0 4px 20px rgba(26, 35, 64, 0.16), 0 1px 4px rgba(26, 35, 64, 0.08);
    z-index: 200;
}
.cal-popover-date {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}
.cal-popover-btns {
    display: flex;
    gap: 6px;
}
.cal-popover-btns .vote-btn {
    flex: 1;
}

/* ── Secondary calendar month labels ────────────────────────── */
#res-cal-month-label,
#dates-cal-month-label {
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
    white-space: nowrap;
}

/* ── Results calendar: count badges inside cells ─────────────── */
.res-counts {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    justify-content: center;
}
.res-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1.4;
}
.res-badge.yes   { background: var(--yes-bg);   color: var(--yes);   }
.res-badge.no    { background: var(--no-bg);     color: var(--no);    }
.res-badge.maybe { background: var(--maybe-bg);  color: var(--maybe); }

/* ── Results popover people pills ────────────────────────────── */
.res-people {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 4px;
}

/* ── Dates-only calendar: selected dates (admin view) ─────────── */
.cal-day.selected-date {
    background: var(--blue-soft);
    border: 1.5px solid var(--border-hi);
    border-radius: var(--radius-xs);
    cursor: default;
}
.cal-day.selected-date .cal-day-num {
    color: var(--blue);
    font-weight: 700;
}

/* ─── Event type pills (create form) ──────────────────────────── */
.type-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.type-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: var(--surface-2);
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .18s;
    user-select: none;
}
.type-pill:has(input:checked) {
    background: var(--blue-soft);
    border-color: var(--blue);
    color: var(--blue);
}
.type-pill input { display: none; }

/* ─── Event type tag (event list) ─────────────────────────────── */
.type-tag {
    display: inline-block;
    padding: 2px 9px;
    background: var(--blue-soft);
    border: 1px solid var(--border-hi);
    color: var(--blue);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

/* ─── Meeting slot list (event.php Slots tab) ──────────────────── */
.slot-day-block { margin-bottom: 20px; }
.slot-day-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 8px;
    font-size: 13px; font-weight: 700; color: var(--text);
    margin-bottom: 10px;
}
.slot-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.slot-time-pill {
    display: inline-flex; align-items: center;
    padding: 5px 12px;
    background: var(--blue-soft);
    border: 1px solid var(--border-hi);
    color: var(--blue);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}

/* ─── Meeting availability grid ────────────────────────────────── */
.meeting-section {
    max-width: 100%;
    padding: 20px 16px;
}
.meeting-hint {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 16px;
    text-align: center;
}
.meeting-grid-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
}
.meeting-grid {
    border-collapse: collapse;
    min-width: 100%;
    font-size: 13px;
}
.meeting-grid th,
.meeting-grid td {
    border: 1px solid var(--border);
    text-align: center;
    white-space: nowrap;
}
.meeting-grid thead th {
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    background: var(--surface-2);
    text-transform: uppercase;
    letter-spacing: .05em;
}
.meeting-grid th.time-col,
.meeting-grid td.time-col {
    text-align: right;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface-2);
    min-width: 56px;
    position: sticky;
    left: 0;
    z-index: 2;
}
.meeting-grid thead th.time-col { z-index: 3; }

.slot-cell {
    width: 52px;
    min-width: 52px;
    height: 40px;
    cursor: pointer;
    background: transparent;
    transition: background .12s;
    position: relative;
}
.slot-cell:hover { background: var(--blue-soft); }

/* Blocked out: the invitee cannot make this one. */
.slot-cell.busy { background: var(--no-bg); border-color: var(--no-border); }
.slot-cell.busy::after {
    content: '';
    display: block;
    width: 12px; height: 2px;
    border-radius: 2px;
    background: var(--no);
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}
/* Blocked by their linked calendar rather than by hand. */
.slot-cell.busy.from-calendar {
    background: repeating-linear-gradient(
        -45deg,
        var(--no-bg), var(--no-bg) 4px,
        rgba(220, 38, 38, .13) 4px, rgba(220, 38, 38, .13) 8px
    );
}
.slot-cell.saving { opacity: 0.4; pointer-events: none; }

/* Painting a run of cells should not select the table text as well. */
.meeting-grid.dragging { user-select: none; -webkit-user-select: none; }
.meeting-grid.dragging .slot-cell { cursor: crosshair; }

.slot-empty {
    width: 52px;
    min-width: 52px;
    height: 40px;
    background: var(--surface-2);
    opacity: 0.35;
}

.slot-section-row td { padding: 0; }
.slot-section-label {
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .07em;
    background: var(--surface-2);
    text-align: left;
    border-top: 2px solid var(--border-hi);
}

/* ─── Meeting results heatmap ──────────────────────────────────── */
.slot-res {
    width: 52px;
    min-width: 52px;
    height: 40px;
    font-size: 11px;
    font-weight: 700;
    color: var(--faint);
    vertical-align: middle;
}
.slot-res span { display: block; }
/* Heat is how many invitees can make the slot, so darker green is better. */
.slot-res.heat-none { background: var(--no-bg); color: var(--no); }
.slot-res.heat-low  { background: rgba(22,163,74,.12); color: var(--yes); }
.slot-res.heat-mid  { background: rgba(22,163,74,.28); color: var(--yes); }
.slot-res.heat-high { background: rgba(22,163,74,.50); color: #15803d; }
.slot-res.heat-full { background: var(--yes-bg); border-color: var(--yes-border); color: var(--yes); }

/* ─── Availability legend ──────────────────────────────────────── */
.slot-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-bottom: 14px;
    font-size: 12px;
    color: var(--muted);
}
.slot-legend span { display: inline-flex; align-items: center; gap: 6px; }
.slot-legend .key {
    width: 16px; height: 16px;
    border-radius: 4px;
    border: 1px solid var(--border);
    display: inline-block;
}
.slot-legend .key-free { background: var(--surface); }
.slot-legend .key-busy { background: var(--no-bg); border-color: var(--no-border); }
.slot-legend .key-cal  {
    border-color: var(--no-border);
    background: repeating-linear-gradient(
        -45deg,
        var(--no-bg), var(--no-bg) 3px,
        rgba(220, 38, 38, .18) 3px, rgba(220, 38, 38, .18) 6px
    );
}

/* ─── Calendar link prompt above the grid ──────────────────────── */
.cal-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid var(--border-hi);
    border-radius: var(--radius-sm);
    background: var(--blue-soft);
    font-size: 13px;
    line-height: 1.45;
}
.cal-banner.linked {
    border-color: var(--yes-border);
    background: var(--yes-bg);
}
.cal-banner div { flex: 1; min-width: 200px; }

/* ─── Confirm bar under the grid ───────────────────────────────── */
.confirm-bar {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    text-align: center;
}
.confirm-summary {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}
.confirm-bar .field-hint { margin-top: 10px; }

/* ─── Calendar linking page ────────────────────────────────────── */
.cal-link-page {
    max-width: 640px;
    margin: 0 auto;
    padding: 20px 16px 48px;
}
.back-link {
    display: inline-block;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--blue);
    text-decoration: none;
}
.back-link:hover { text-decoration: underline; }

.cal-status {
    display: grid;
    grid-template-columns: minmax(110px, auto) 1fr;
    gap: 8px 16px;
    font-size: 14px;
}
.cal-status dt { font-weight: 600; color: var(--muted); }
.cal-status dd { color: var(--text); }

.cal-help {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 8px;
    background: var(--surface-2);
}
.cal-help summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: var(--blue);
}
.cal-help p { margin-top: 10px; font-size: 13px; line-height: 1.6; color: var(--muted); }
.cal-help code {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 1px 5px;
    font-size: 12px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 14px;
    margin-bottom: 6px;
    cursor: pointer;
}
.check-row input { width: 17px; height: 17px; accent-color: var(--blue); }

.tick-list { list-style: none; font-size: 13px; line-height: 1.7; color: var(--muted); }
.tick-list li { padding-left: 22px; position: relative; }
.tick-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--yes);
    font-weight: 700;
}
.cal-privacy { background: var(--surface-2); }

/* ─── Best slots summary (admin results) ──────────────────────── */
.best-slots { list-style: none; counter-reset: best; }
.best-slots li {
    counter-increment: best;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 10px;
    padding: 10px 12px 10px 38px;
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    background: var(--surface);
    font-size: 14px;
}
.best-slots li::before {
    content: counter(best);
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--blue-soft);
    color: var(--blue);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.best-when  { font-weight: 700; }
.best-count {
    font-size: 12px; font-weight: 700;
    padding: 2px 8px; border-radius: 999px;
    background: var(--surface-2); color: var(--muted);
}
.best-count.all { background: var(--yes-bg); color: var(--yes); }
.best-missing { font-size: 12px; color: var(--muted); }

.text-danger { color: var(--no); }

.alert-info {
    background: var(--blue-soft);
    border: 1px solid var(--border-hi);
    color: var(--text);
}
