/* ═══════════════════════════════════════════════════════════════════════════
   CivicFlow — Design System v3.1
   Aesthetic: Modern civic glass — deep navy depth, crisp white space,
   electric accent. Inter + Instrument Serif pairing.
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@300;400;500;600;700&display=swap');

/* ─── Tokens ─────────────────────────────────────────────────────────────── */
:root {
    /* Core palette */
    --ink: #0f1117;
    --ink-2: #374151;
    --ink-3: #6b7280;
    --rule: #e5e7eb;
    --rule-2: #f3f4f6;
    --paper: #ffffff;
    --paper-2: #f9fafb;
    --paper-3: #f3f4f6;
    /* Brand — electric blue-violet */
    --accent: #4f46e5;
    --accent-2: #6366f1;
    --accent-pale: #eef2ff;
    --accent-glow: rgba(79,70,229,0.15);
    /* Kept for legacy compat with theme system */
    --amber: #a19ce9;
    --amber-2: #6366f1;
    --amber-pale: #eef2ff;
    --green: #059669;
    --red: #dc2626;
    --blue: #2563eb;
    /* Typography */
    --font-serif: 'Instrument Serif', Georgia, serif;
    --font-sans: 'Inter', system-ui, sans-serif;
    --font-size-base: 15px;
    /* Layout */
    --radius: 8px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow: 0 1px 2px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
    --shadow-xl: 0 24px 64px rgba(0,0,0,0.18);
    --header-h: 64px;
    /* Header (overridable by themes) */
    --header-bg: #0f1117;
    --header-border: #4f46e5;
    --header-text: #ffffff;
    /* Calendar cell tokens */
    --cell-header-bg: #0f1117;
    --cell-header-text: rgba(255,255,255,0.6);
    --cell-today-bg: #eef2ff;
    --cell-today-text: #4f46e5;
    --cell-selected-bg: #eef2ff;
    --cell-selected-border: #4f46e5;
    --event-pill-radius: 4px;
}

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

html {
    font-size: var(--font-size-base, 16px);
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--paper);
    color: var(--ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--amber);
    text-decoration: none;
}

    a:hover {
        text-decoration: underline;
    }

/* ─── App Shell ──────────────────────────────────────────────────────────── */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    background: var(--header-bg, var(--ink));
    border-bottom: 1px solid rgba(79,70,229,0.4);
    backdrop-filter: blur(12px);
}

.header-inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 28px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 32px;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff !important;
    text-decoration: none;
    flex-shrink: 0;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    box-shadow: 0 0 12px rgba(79,70,229,0.5);
}

.brand-text {
    font-family: var(--font-sans);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
    line-height: 1.1;
}

    .brand-text em {
        font-style: normal;
        background: linear-gradient(90deg, #818cf8, #a78bfa);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

.site-nav {
    display: flex;
    gap: 2px;
    flex: 1;
}

.nav-link {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,0.6) !important;
    padding: 6px 14px;
    border-radius: 8px;
    transition: all 0.15s;
    text-decoration: none;
    letter-spacing: 0.01em;
}

    .nav-link:hover, .nav-link.active {
        color: #fff !important;
        background: rgba(255,255,255,0.08);
        text-decoration: none;
    }

.nav-admin {
    color: #a5b4fc !important;
    font-weight: 600;
}

    .nav-admin:hover {
        background: rgba(99,102,241,0.2) !important;
    }

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.user-greeting {
    font-size: 13px;
    color: rgba(255,255,255,0.5);
}

.logout-form {
    display: inline;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent);
    color: #fff;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    padding: 9px 20px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    text-decoration: none;
    letter-spacing: -0.01em;
}

    .btn-primary:hover {
        background: #4338ca;
        box-shadow: 0 0 0 3px rgba(79,70,229,0.25);
        text-decoration: none;
        color: #fff;
    }

    .btn-primary:active {
        transform: scale(0.98);
    }

    .btn-primary:disabled {
        opacity: 0.45;
        cursor: not-allowed;
    }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    color: var(--ink-2);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

    .btn-ghost:hover {
        background: var(--paper-2);
        border-color: var(--ink-3);
        color: var(--ink);
        text-decoration: none;
    }
/* Ghost in dark context (header area) */
.site-header .btn-ghost {
    color: rgba(255,255,255,0.7);
    border-color: rgba(255,255,255,0.15);
}

    .site-header .btn-ghost:hover {
        background: rgba(255,255,255,0.1);
        color: #fff;
        border-color: rgba(255,255,255,0.3);
    }

.btn-sm {
    padding: 5px 12px;
    font-size: 13px;
}

.btn-approve {
    background: var(--green);
    color: #fff;
    border: none;
    padding: 9px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s;
}

    .btn-approve:hover {
        background: #047857;
    }

.btn-danger {
    background: var(--red);
    color: #fff;
    border: none;
    padding: 9px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s;
}

    .btn-danger:hover {
        background: #b91c1c;
    }

    .btn-danger.btn-sm, .btn-approve.btn-sm {
        padding: 5px 12px;
        font-size: 13px;
    }

/* ─── Site Main ───────────────────────────────────────────────────────────── */
.site-main {
    flex: 1;
}

/* ─── Calendar Page ───────────────────────────────────────────────────────── */
.calendar-page {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 28px 64px;
}

.cal-hero {
    padding: 48px 0 32px;
    margin-bottom: 28px;
    position: relative;
}

    .cal-hero::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 1px;
        background: linear-gradient(90deg, var(--accent), transparent 60%);
    }

.cal-title {
    font-family: var(--font-serif);
    font-size: clamp(38px, 5vw, 60px);
    font-weight: 400;
    color: var(--ink);
    letter-spacing: -0.03em;
    line-height: 1.05;
}

.cal-subtitle {
    font-size: 16px;
    color: var(--ink-3);
    margin-top: 6px;
    font-weight: 400;
}

/* ── Toolbar ──────────────────────────────────────────────────────────────── */
.cal-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    flex-wrap: wrap;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    padding: 10px 16px;
    box-shadow: var(--shadow);
}

.view-switcher {
    display: flex;
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    overflow: hidden;
    flex-shrink: 0;
}

.view-btn {
    background: none;
    border: none;
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font-sans);
    padding: 6px 16px;
    cursor: pointer;
    color: var(--ink-3);
    transition: all 0.15s;
    letter-spacing: -0.01em;
}

    .view-btn.active {
        background: var(--accent);
        color: #fff;
        box-shadow: 0 1px 4px rgba(79,70,229,0.3);
    }

    .view-btn:hover:not(.active) {
        background: var(--paper-3);
        color: var(--ink);
    }

.cal-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.nav-arrow {
    background: none;
    border: 1px solid var(--rule);
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 15px;
    color: var(--ink-2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

    .nav-arrow:hover {
        background: var(--accent);
        border-color: var(--accent);
        color: #fff;
    }

.period-label {
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 400;
    color: var(--ink);
    min-width: 180px;
    text-align: center;
    letter-spacing: -0.01em;
}

.btn-today {
    background: none;
    border: 1px solid var(--rule);
    font-size: 13px;
    font-family: var(--font-sans);
    font-weight: 600;
    color: var(--accent);
    padding: 5px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
}

    .btn-today:hover {
        background: var(--accent);
        border-color: var(--accent);
        color: #fff;
    }

.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-3);
    border: 1px solid var(--rule);
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: all 0.15s;
    text-decoration: none;
    letter-spacing: -0.01em;
}

    .btn-export:hover {
        color: var(--accent);
        border-color: var(--accent);
        background: var(--accent-pale);
        text-decoration: none;
    }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.cal-layout {
    display: grid;
    grid-template-columns: 256px 1fr;
    gap: 24px;
    align-items: start;
}

/* ─── Filter Sidebar ──────────────────────────────────────────────────────── */
.filter-sidebar {
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: sticky;
    top: calc(var(--header-h) + 16px);
    box-shadow: var(--shadow);
}

.filter-heading {
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-3);
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--rule-2);
}

.filter-tags {
    padding: 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tag-filter {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-2);
    border: 1px solid transparent;
    transition: all 0.15s;
    user-select: none;
}

    .tag-filter input {
        position: absolute;
        opacity: 0;
        width: 0;
        height: 0;
    }

    .tag-filter:hover {
        background: var(--paper-2);
    }

    .tag-filter.active {
        background: var(--accent-pale);
        border-color: rgba(79,70,229,0.25);
        color: var(--accent);
    }

        .tag-filter.active .tag-name {
            font-weight: 600;
        }

    .tag-filter .tag-icon {
        font-size: 15px;
        flex-shrink: 0;
    }

.btn-clear-filters {
    margin: 4px 10px 12px;
    width: calc(100% - 20px);
    background: none;
    border: 1px dashed var(--rule);
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--ink-3);
    padding: 7px;
    cursor: pointer;
    font-family: var(--font-sans);
    font-weight: 500;
    transition: all 0.15s;
}

    .btn-clear-filters:hover {
        border-color: var(--red);
        color: var(--red);
        background: #fef2f2;
    }

.subscribe-box {
    padding: 14px 18px 18px;
    border-top: 1px solid var(--rule-2);
    background: var(--paper-2);
}

    .subscribe-box h4 {
        font-family: var(--font-sans);
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--ink-3);
        margin-bottom: 10px;
    }

    .subscribe-box p {
        font-size: 12px;
        color: var(--ink-3);
        margin-bottom: 10px;
        line-height: 1.5;
    }

.btn-subscribe {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 600;
    padding: 9px 14px;
    border-radius: var(--radius);
    margin-bottom: 6px;
    background: var(--ink);
    color: #fff;
    transition: all 0.15s;
    text-decoration: none;
    letter-spacing: -0.01em;
}

    .btn-subscribe:hover {
        background: var(--accent);
        text-decoration: none;
        color: #fff;
    }

    .btn-subscribe.btn-google {
        background: #1a73e8;
    }

        .btn-subscribe.btn-google:hover {
            background: #1557b0;
        }

    .btn-subscribe.btn-outline {
        background: none;
        border: 1px solid var(--rule);
        color: var(--ink-3);
    }

        .btn-subscribe.btn-outline:hover {
            border-color: var(--accent);
            color: var(--accent);
            background: var(--accent-pale);
        }

/* ─── Month Grid ──────────────────────────────────────────────────────────── */
.month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: var(--paper);
}

.dow-header {
    background: var(--cell-header-bg, var(--ink));
    color: var(--cell-header-text, rgba(255,255,255,0.55));
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-align: center;
    padding: 12px 4px;
}

.month-cell {
    min-height: 108px;
    padding: 8px 7px;
    border-right: 1px solid var(--rule-2);
    border-bottom: 1px solid var(--rule-2);
    background: var(--paper);
    transition: background 0.12s;
    cursor: pointer;
}

    .month-cell:nth-child(7n) {
        border-right: none;
    }

    .month-cell.other-month {
        background: var(--paper-2);
    }

        .month-cell.other-month .cell-day {
            color: var(--ink-3);
            opacity: 0.5;
        }

    .month-cell:hover:not(.today):not(.selected-cell) {
        background: #f5f3ff;
    }

    .month-cell.today {
        background: var(--cell-today-bg, #eef2ff);
    }

        .month-cell.today .cell-day {
            background: var(--cell-today-text, var(--accent));
            color: #fff;
            border-radius: 50%;
            width: 24px;
            height: 24px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
        }

    .month-cell.selected-cell {
        background: var(--cell-selected-bg, #eef2ff) !important;
        border-color: rgba(79,70,229,0.25) !important;
        box-shadow: inset 0 0 0 2px rgba(79,70,229,0.3);
    }

        .month-cell.selected-cell .cell-day {
            background: var(--accent);
            color: #fff;
            border-radius: 50%;
            width: 24px;
            height: 24px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
        }

    .month-cell:hover .cell-day {
        background: var(--accent-pale);
        border-radius: 50%;
        width: 24px;
        height: 24px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .month-cell.today:hover .cell-day,
    .month-cell.selected-cell:hover .cell-day {
        background: var(--accent);
        color: #fff;
    }

.cell-day {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: 4px;
    display: block;
    transition: all 0.12s;
}

.cell-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cell-event-pill {
    display: block;
    width: 100%;
    text-align: left;
    font-size: 10px;
    font-weight: 600;
    font-family: var(--font-sans);
    color: #fff;
    background: var(--tag-color, var(--accent));
    border-radius: var(--event-pill-radius, 4px);
    padding: 2px 6px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.12s;
    border: none;
    letter-spacing: -0.01em;
    opacity: 0.9;
}

    .cell-event-pill:hover {
        opacity: 1;
        transform: translateX(2px);
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    }

.cell-more {
    font-size: 10px;
    color: var(--accent);
    font-weight: 700;
    background: none;
    border: none;
    cursor: pointer;
    padding: 1px 4px;
    font-family: var(--font-sans);
    letter-spacing: -0.01em;
}

    .cell-more:hover {
        text-decoration: underline;
    }

/* ─── List View ───────────────────────────────────────────────────────────── */
.event-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.list-date-group {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--rule-2);
}

    .list-date-group:last-child {
        border-bottom: none;
    }

.list-date-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 4px;
    min-width: 56px;
}

.date-dow {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
}

.date-num {
    font-family: var(--font-serif);
    font-size: 34px;
    font-weight: 400;
    color: var(--ink);
    line-height: 1;
}

.date-mon {
    font-size: 10px;
    color: var(--ink-3);
    text-align: center;
    font-weight: 500;
}

.list-events {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.event-card {
    display: grid;
    grid-template-columns: 80px 1fr 24px;
    gap: 14px;
    align-items: center;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-family: var(--font-sans);
    transition: all 0.18s;
    box-shadow: var(--shadow);
}

    .event-card:hover {
        border-color: var(--accent);
        box-shadow: 0 4px 24px rgba(79,70,229,0.12);
        transform: translateY(-2px);
    }

.event-card-time {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    padding-top: 2px;
    letter-spacing: -0.01em;
}

.event-end {
    color: var(--ink-3);
    font-size: 11px;
    font-weight: 500;
}

.event-card-title {
    font-family: var(--font-serif);
    font-size: 17px;
    font-weight: 400;
    color: var(--ink);
    margin-bottom: 3px;
    letter-spacing: -0.01em;
}

.event-card-location {
    font-size: 12px;
    color: var(--ink-3);
    margin-bottom: 7px;
}

.event-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.event-card-arrow {
    font-size: 18px;
    color: var(--rule);
    align-self: center;
    transition: all 0.15s;
}

.event-card:hover .event-card-arrow {
    color: var(--accent);
    transform: translateX(2px);
}

.free-chip {
    display: inline-block;
    background: #d1fae5;
    color: #065f46;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 20px;
    letter-spacing: 0.04em;
    margin-bottom: 5px;
}

/* ─── Tag Badge ──────────────────────────────────────────────────────────── */
.tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    background: color-mix(in srgb, var(--tag-color, var(--accent)) 12%, white);
    color: color-mix(in srgb, var(--tag-color, var(--accent)) 70%, black);
    border: 1px solid color-mix(in srgb, var(--tag-color, var(--accent)) 25%, transparent);
}

/* ─── Cal Loading ─────────────────────────────────────────────────────────── */
.cal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
    color: var(--ink-3);
    gap: 14px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 2px solid var(--rule);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ─── Empty State ─────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 80px 32px;
    color: var(--ink-3);
}

    .empty-state p {
        font-size: 16px;
        margin-bottom: 20px;
    }

/* ─── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,10,20,0.6);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.18s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.event-modal {
    background: var(--paper);
    border-radius: var(--radius-xl);
    max-width: 600px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.22s cubic-bezier(0.34,1.56,0.64,1);
    border: 1px solid var(--rule);
}

@keyframes slideUp {
    from {
        transform: translateY(32px) scale(0.97);
        opacity: 0;
    }

    to {
        transform: none;
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--paper-2);
    border: 1px solid var(--rule);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 13px;
    cursor: pointer;
    color: var(--ink-3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    z-index: 1;
}

    .modal-close:hover {
        background: var(--red);
        border-color: var(--red);
        color: #fff;
    }

/* Modal header — full-bleed dark stripe */
.modal-header {
    background: var(--ink);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 32px 32px 24px;
    margin-bottom: 0;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 12px;
}

    .modal-tags .tag-badge {
        background: rgba(255,255,255,0.12);
        color: rgba(255,255,255,0.8);
        border-color: rgba(255,255,255,0.2);
    }

.modal-title {
    font-family: var(--font-serif);
    font-size: 28px;
    font-weight: 400;
    color: #fff;
    line-height: 1.2;
    margin-bottom: 14px;
    letter-spacing: -0.02em;
}

.modal-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: rgba(255,255,255,0.65);
}

    .modal-meta span {
        display: flex;
        align-items: center;
        gap: 6px;
    }

.free-badge {
    display: inline-block;
    background: var(--green);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.06em;
}

.modal-description {
    font-size: 15px;
    line-height: 1.75;
    color: var(--ink-2);
    padding: 24px 32px;
    white-space: pre-wrap;
    border-bottom: 1px solid var(--rule-2);
}

.modal-organizer {
    font-size: 13px;
    color: var(--ink-3);
    padding: 14px 32px;
    border-bottom: 1px solid var(--rule-2);
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 20px 32px 28px;
}

.btn-cal {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--rule);
    text-decoration: none;
    transition: all 0.15s;
    color: var(--ink);
}

    .btn-cal:hover {
        text-decoration: none;
    }

    .btn-cal.btn-google {
        border-color: #1a73e8;
        color: #1a73e8;
    }

        .btn-cal.btn-google:hover {
            background: #e8f0fe;
        }

    .btn-cal.btn-outlook {
        border-color: #0078d4;
        color: #0078d4;
    }

        .btn-cal.btn-outlook:hover {
            background: #e8f4fd;
        }

    .btn-cal.btn-apple {
        border-color: var(--ink-3);
    }

        .btn-cal.btn-apple:hover {
            background: var(--paper-2);
        }

/* ─── Submit Page ─────────────────────────────────────────────────────────── */
.submit-page {
    max-width: 760px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

.submit-header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--rule);
}

    .submit-header h1 {
        font-family: var(--font-serif);
        font-size: 40px;
        font-weight: 400;
        margin-bottom: 6px;
    }

    .submit-header p {
        font-size: 15px;
        color: var(--ink-3);
    }

.success-banner {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-lg);
    padding: 20px 24px;
}

.success-icon {
    background: var(--green);
    color: white;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.success-banner h3 {
    font-size: 17px;
    margin-bottom: 4px;
}

.success-banner p {
    font-size: 14px;
    color: var(--ink-3);
}

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.submit-form, .edit-card {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.form-section {
    padding: 28px 0;
    border-bottom: 1px solid var(--rule-2);
}

    .form-section:last-of-type {
        border-bottom: none;
    }

.section-title {
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 400;
    margin-bottom: 18px;
    color: var(--ink);
}

.section-hint {
    font-size: 13px;
    color: var(--ink-3);
    margin-bottom: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 16px;
}

    .form-group label {
        font-size: 13px;
        font-weight: 600;
        color: var(--ink-2);
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

.req {
    color: var(--red);
}

.form-control {
    font-family: var(--font-sans);
    font-size: 15px;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 10px 12px;
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
}

    .form-control:focus {
        outline: none;
        border-color: var(--amber);
        box-shadow: 0 0 0 3px rgba(194,124,26,0.12);
    }

    .form-control::placeholder {
        color: var(--ink-3);
    }

textarea.form-control {
    resize: vertical;
}

.color-input {
    padding: 4px;
    height: 40px;
    cursor: pointer;
}

.icon-input {
    font-size: 20px;
    text-align: center;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--ink-2);
    margin-bottom: 12px;
}

    .form-check input[type="checkbox"] {
        width: 16px;
        height: 16px;
        accent-color: var(--amber);
    }

.hint {
    font-size: 11px;
    color: var(--ink-3);
    display: block;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 24px;
}

.form-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 14px;
    color: var(--red);
    margin-top: 8px;
}

.form-message {
    background: var(--amber-pale);
    border: 1px solid var(--amber-2);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 14px;
    color: var(--amber);
    margin-top: 8px;
}

/* ─── Tag Picker ──────────────────────────────────────────────────────────── */
.tag-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-pick-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 20px;
    cursor: pointer;
    border: 1.5px solid var(--rule);
    color: var(--ink-2);
    background: var(--paper);
    transition: all 0.15s;
}

    .tag-pick-item input {
        position: absolute;
        opacity: 0;
        width: 0;
        height: 0;
    }

    .tag-pick-item:hover {
        border-color: var(--tag-color, #6366f1);
    }

    .tag-pick-item.selected {
        background: color-mix(in srgb, var(--tag-color, #6366f1) 15%, white);
        border-color: var(--tag-color, #6366f1);
        color: color-mix(in srgb, var(--tag-color, #6366f1) 80%, black);
    }

/* ─── Admin ────────────────────────────────────────────────────────────────── */
.admin-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

    .admin-header h1 {
        font-family: var(--font-serif);
        font-size: 36px;
        font-weight: 400;
    }

.admin-nav-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.admin-pill {
    background: var(--paper-2);
    border: 1px solid var(--rule);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    padding: 7px 16px;
    border-radius: 20px;
    cursor: pointer;
    color: var(--ink-2);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
}

    .admin-pill:hover {
        background: var(--paper-3);
        border-color: var(--ink-3);
    }

    .admin-pill.active {
        background: var(--ink);
        border-color: var(--ink);
        color: var(--paper);
    }

.badge {
    background: var(--amber);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
}

.badge-active {
    background: #dcfce7;
    color: #166534;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.badge-inactive {
    background: #fee2e2;
    color: #991b1b;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.badge-auto {
    background: #dbeafe;
    color: #1e40af;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.badge-no-filter {
    background: #f3f4f6;
    color: #6b7280;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.stats-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    flex: 1;
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-num {
    font-family: var(--font-serif);
    font-size: 36px;
    font-weight: 400;
    color: var(--ink);
}

.stat-label {
    font-size: 13px;
    color: var(--ink-3);
}

.admin-section {
    margin-bottom: 32px;
}

    .admin-section > h2 {
        font-family: var(--font-serif);
        font-size: 24px;
        font-weight: 400;
        margin-bottom: 16px;
        padding-bottom: 10px;
        border-bottom: 1px solid var(--rule);
    }

.section-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--rule);
}

    .section-toolbar h2 {
        font-family: var(--font-serif);
        font-size: 24px;
        font-weight: 400;
    }

/* Review cards */
.review-card {
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    margin-bottom: 10px;
    overflow: hidden;
    transition: border-color 0.15s;
}

    .review-card:hover {
        border-color: var(--amber);
    }

.review-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    background: var(--paper);
    transition: background 0.1s;
}

    .review-card-header:hover {
        background: var(--paper-2);
    }

.review-card.expanded .review-card-header {
    background: var(--amber-pale);
}

.review-title {
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 400;
    margin-bottom: 6px;
}

.review-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: var(--ink-3);
    margin-bottom: 8px;
}

.review-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.ical-badge {
    background: #dbeafe;
    color: #1e40af;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.expand-arrow {
    font-size: 12px;
    color: var(--ink-3);
    margin-top: 4px;
    flex-shrink: 0;
}

.review-card-body {
    padding: 16px 20px 20px;
    border-top: 1px solid var(--rule);
    background: var(--paper);
}

.review-description {
    font-size: 14px;
    line-height: 1.7;
    color: var(--ink-2);
    margin-bottom: 16px;
    white-space: pre-wrap;
}

.review-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.reject-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    flex: 1;
}

    .reject-form .form-control {
        max-width: 300px;
    }

/* Source list */
.source-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.source-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
}

.source-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.source-url {
    font-size: 12px;
    color: var(--ink-3);
    display: block;
    margin-bottom: 4px;
    word-break: break-all;
}

.sync-time {
    font-size: 12px;
    color: var(--ink-3);
}

.sync-error {
    font-size: 12px;
    color: var(--red);
    display: block;
    margin-top: 4px;
}

.source-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    align-items: flex-start;
}

/* Tag admin list */
.tag-admin-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tag-admin-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 10px 16px;
}

.tag-admin-preview {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tag-admin-actions {
    display: flex;
    gap: 6px;
}

/* Edit card */
.edit-card {
    background: var(--paper-2);
    border: 1px solid var(--amber);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}

    .edit-card h3 {
        font-family: var(--font-serif);
        font-size: 20px;
        font-weight: 400;
        margin-bottom: 18px;
    }

    .edit-card .form-group {
        margin-bottom: 12px;
    }

/* Audit table */
.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

    .audit-table th {
        text-align: left;
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--ink-3);
        padding: 10px 12px;
        border-bottom: 2px solid var(--rule);
    }

    .audit-table td {
        padding: 9px 12px;
        border-bottom: 1px solid var(--rule-2);
        vertical-align: top;
    }

    .audit-table tr:hover td {
        background: var(--paper-2);
    }

.log-time {
    color: var(--ink-3);
    white-space: nowrap;
    font-family: monospace;
}

.log-action {
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 600;
    font-family: monospace;
}

.log-details {
    color: var(--ink-3);
    max-width: 320px;
}

/* Validation */
.validation-message {
    font-size: 12px;
    color: var(--red);
    margin-top: 3px;
}

/* ─── Access Denied / Not Found ───────────────────────────────────────────── */
.access-denied, .not-found {
    max-width: 500px;
    margin: 80px auto;
    text-align: center;
    padding: 0 24px;
}

    .access-denied h2, .not-found h2 {
        font-family: var(--font-serif);
        font-size: 32px;
        font-weight: 400;
        margin-bottom: 12px;
    }

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.site-footer {
    border-top: 1px solid rgba(79,70,229,0.25);
    background: var(--ink);
    padding: 24px 28px;
    margin-top: auto;
}

.footer-inner {
    max-width: 1320px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: rgba(255,255,255,0.35);
}

.footer-links {
    display: flex;
    gap: 20px;
}

    .footer-links a {
        color: rgba(255,255,255,0.35);
        text-decoration: none;
        transition: color 0.15s;
    }

        .footer-links a:hover {
            color: rgba(255,255,255,0.75);
        }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .cal-layout {
        grid-template-columns: 1fr;
    }

    .filter-sidebar {
        position: static;
    }

    .month-cell {
        min-height: 70px;
    }

    .event-card {
        grid-template-columns: 70px 1fr 20px;
    }
}

@media (max-width: 640px) {
    .cal-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .cal-nav {
        justify-content: center;
    }

    .header-inner {
        padding: 0 16px;
        gap: 16px;
    }

    .header-actions .btn-ghost {
        display: none;
    }

    .stats-bar {
        flex-direction: column;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .period-label {
        min-width: 150px;
        font-size: 18px;
    }

    .list-date-group {
        grid-template-columns: 60px 1fr;
    }

    .date-num {
        font-size: 28px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   EMBED MODE — Styles for /embed iframe page
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Embed Root ─────────────────────────────────────────────────────────── */
.embed-root {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    background: var(--paper);
    font-family: var(--font-sans);
}

    .embed-root.embed-no-chrome .embed-header {
        display: none;
    }

.embed-error,
.embed-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    color: var(--ink-3);
    font-size: 15px;
}

/* ─── Embed Org Header ───────────────────────────────────────────────────── */
.embed-header {
    background: var(--header-bg, var(--ink));
    padding: 14px 20px;
    border-bottom: 2px solid var(--header-border, var(--amber));
}

.embed-header-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 100%;
}

.embed-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}

.embed-org-name {
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 400;
    color: var(--paper);
    line-height: 1.2;
}

.embed-org-desc {
    font-size: 12px;
    color: rgba(250,247,244,0.6);
    margin-top: 2px;
}

/* ─── Embed Toolbar ──────────────────────────────────────────────────────── */
.embed-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: var(--paper-2);
    border-bottom: 1px solid var(--rule);
    flex-wrap: wrap;
}

.embed-view-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.embed-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ─── Tag filter chips (compact, icon-only in toolbar) ───────────────────── */
.embed-tag-filters {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.tag-filter-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid var(--rule);
    background: var(--paper);
    cursor: pointer;
    font-size: 15px;
    transition: all 0.15s;
    position: relative;
}

    .tag-filter-chip input {
        position: absolute;
        opacity: 0;
        width: 0;
        height: 0;
    }

    .tag-filter-chip:hover {
        border-color: var(--tag-color, var(--amber));
        transform: scale(1.1);
    }

    .tag-filter-chip.active {
        border-color: var(--tag-color, var(--amber));
        background: color-mix(in srgb, var(--tag-color, var(--amber)) 18%, white);
        box-shadow: 0 0 0 2px color-mix(in srgb, var(--tag-color, var(--amber)) 25%, transparent);
    }

/* ─── Cart Button ────────────────────────────────────────────────────────── */
.cart-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--ink);
    color: var(--paper);
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-sans);
    padding: 7px 13px;
    cursor: pointer;
    transition: background 0.15s;
}

    .cart-btn:hover {
        background: var(--ink-2);
    }

.cart-count {
    background: var(--amber);
    color: #fff;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
}

/* ─── Cart Panel ─────────────────────────────────────────────────────────── */
.cart-panel {
    background: var(--paper);
    border: 1px solid var(--amber);
    border-radius: var(--radius-lg);
    margin: 10px 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.cart-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--amber-pale);
    border-bottom: 1px solid var(--rule);
}

    .cart-panel-header h3 {
        font-family: var(--font-serif);
        font-size: 17px;
        font-weight: 400;
    }

.cart-close {
    background: none;
    border: none;
    font-size: 14px;
    color: var(--ink-3);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius);
}

    .cart-close:hover {
        background: var(--paper-3);
    }

.cart-items {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px 0;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 16px;
    border-bottom: 1px solid var(--rule-2);
    font-size: 13px;
}

    .cart-item:last-child {
        border-bottom: none;
    }

.cart-item-title {
    flex: 1;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-date {
    color: var(--ink-3);
    font-size: 12px;
    flex-shrink: 0;
}

.cart-remove {
    background: none;
    border: none;
    color: var(--ink-3);
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
    border-radius: 3px;
    flex-shrink: 0;
}

    .cart-remove:hover {
        background: #fee2e2;
        color: var(--red);
    }

.cart-actions {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--rule);
}

/* ─── Embed Calendar Body ────────────────────────────────────────────────── */
.embed-cal-body {
    flex: 1;
    padding: 12px 16px;
    overflow: auto;
}

/* Selected cell highlight */
.month-cell.selected-cell {
    background: var(--cell-selected-bg, color-mix(in srgb, var(--amber) 8%, var(--paper))) !important;
    border: 1px solid var(--cell-selected-border, color-mix(in srgb, var(--amber) 40%, transparent));
}

    .month-cell.selected-cell .cell-day {
        color: var(--amber);
        font-weight: 700;
    }

/* ═══════════════════════════════════════════════════════════════════════════
   EVENT ITEM BLOCK — image left / details right
   ═══════════════════════════════════════════════════════════════════════════ */

.event-item {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 0;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
    margin-bottom: 10px;
}

    .event-item:hover {
        border-color: var(--amber);
        box-shadow: 0 2px 12px rgba(194,124,26,0.12);
        transform: translateY(-1px);
    }

    .event-item.event-item-selected {
        border-color: var(--amber);
        background: color-mix(in srgb, var(--amber) 4%, var(--paper));
    }

/* Image column */
.event-item-image {
    width: 96px;
    min-height: 96px;
    flex-shrink: 0;
    overflow: hidden;
    cursor: pointer;
    background: var(--paper-3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

    .event-item-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        transition: transform 0.3s ease;
    }

.event-item:hover .event-item-image img {
    transform: scale(1.05);
}

.event-item-image-placeholder {
    font-size: 32px;
    line-height: 1;
    user-select: none;
}

/* Details column */
.event-item-details {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.event-item-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.event-item-time {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.time-chip {
    font-size: 11px;
    font-weight: 700;
    color: var(--amber);
    letter-spacing: 0.02em;
}

.time-sep {
    font-size: 10px;
    color: var(--ink-3);
}

.time-end {
    color: var(--ink-3);
    font-weight: 500;
}

.free-chip {
    background: var(--green);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 10px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.cost-chip {
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-3);
}

/* Action buttons (cart + report) */
.event-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.btn-cart-add,
.btn-cart-remove {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1.5px solid var(--rule);
    background: var(--paper);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    font-family: var(--font-sans);
    color: var(--ink-3);
    flex-shrink: 0;
}

    .btn-cart-add:hover {
        border-color: var(--amber);
        color: var(--amber);
        background: var(--amber-pale);
    }

.btn-cart-remove {
    border-color: var(--amber);
    background: var(--amber-pale);
    color: var(--amber);
    font-size: 11px;
}

    .btn-cart-remove:hover {
        border-color: var(--red);
        background: #fee2e2;
        color: var(--red);
    }

.btn-report {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1.5px solid transparent;
    background: transparent;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-3);
    transition: all 0.15s;
    flex-shrink: 0;
}

    .btn-report:hover {
        border-color: var(--red);
        color: var(--red);
        background: #fee2e2;
    }

/* Title as button */
.event-item-title-btn {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-family: var(--font-serif);
    font-size: 15px;
    font-weight: 400;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    line-height: 1.3;
    transition: color 0.12s;
}

    .event-item-title-btn:hover {
        color: var(--amber);
    }

.event-item-location {
    font-size: 12px;
    color: var(--ink-3);
    display: flex;
    align-items: flex-start;
    gap: 4px;
}

    .event-item-location a {
        color: var(--amber);
    }

        .event-item-location a:hover {
            text-decoration: underline;
        }

.ei-icon {
    flex-shrink: 0;
}

.event-item-desc {
    font-size: 12px;
    color: var(--ink-3);
    line-height: 1.5;
}

.event-item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}
/* Smaller tag badges inside event items */
.event-item .tag-badge {
    font-size: 10px;
    padding: 2px 6px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DAILY PANEL
   ═══════════════════════════════════════════════════════════════════════════ */

.daily-panel {
    margin: 0 16px 16px;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    animation: slideUp 0.2s ease;
}

.daily-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: var(--ink);
    border-bottom: 2px solid var(--amber);
}

.daily-panel-title {
    font-family: var(--font-serif);
    font-size: 17px;
    font-weight: 400;
    color: var(--paper);
}

    .daily-panel-title em {
        font-style: italic;
        color: var(--amber-2);
    }

.daily-close {
    background: none;
    border: none;
    color: rgba(250,247,244,0.6);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: all 0.15s;
}

    .daily-close:hover {
        color: var(--paper);
        background: rgba(255,255,255,0.1);
    }

.daily-events {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.daily-empty {
    padding: 32px;
    text-align: center;
    color: var(--ink-3);
    font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ABUSE REPORT DIALOG
   ═══════════════════════════════════════════════════════════════════════════ */

.report-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26,23,20,0.55);
    backdrop-filter: blur(4px);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.18s ease;
}

.report-dialog {
    background: var(--paper);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.22s ease;
}

.report-title {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 400;
    margin-bottom: 6px;
    color: var(--ink);
}

.report-event-name {
    font-size: 13px;
    color: var(--ink-3);
    margin-bottom: 18px;
    font-style: italic;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--rule);
}

.report-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius);
    padding: 14px 16px;
    font-size: 14px;
    color: var(--green);
    line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ADMIN — Shared Calendars + Abuse Reports
   ═══════════════════════════════════════════════════════════════════════════ */

/* Calendar card */
.cal-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cal-admin-card {
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.cal-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--paper-2);
    border-bottom: 1px solid var(--rule);
}

.cal-card-org {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cal-card-logo {
    height: 36px;
    width: auto;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}

.cal-color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cal-card-desc {
    font-size: 12px;
    color: var(--ink-3);
    margin-top: 2px;
}

.cal-card-key,
.cal-card-embed {
    padding: 12px 20px;
    border-bottom: 1px solid var(--rule-2);
}

    .cal-card-key label,
    .cal-card-embed label {
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--ink-3);
        display: block;
        margin-bottom: 5px;
    }

.key-display {
    font-size: 12px;
    font-family: monospace;
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 4px 10px;
    user-select: all;
    display: inline-block;
    word-break: break-all;
}

.embed-url-row {
    margin-bottom: 6px;
}

.embed-url {
    font-size: 12px;
    font-family: monospace;
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 4px 10px;
    display: block;
    word-break: break-all;
    user-select: all;
}

.embed-params-hint {
    font-size: 11px;
    color: var(--ink-3);
    margin-bottom: 10px;
}

.embed-snippet-box {
    margin-top: 6px;
}

.embed-snippet {
    font-size: 11px;
    font-family: monospace;
    background: var(--ink);
    color: #a8e6cf;
    border-radius: 6px;
    padding: 10px 14px;
    display: block;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.6;
    user-select: all;
}

.cal-card-actions {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    flex-wrap: wrap;
}

/* Abuse report list */
.report-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.report-filter-pills {
    display: flex;
    gap: 6px;
}

.report-card {
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.report-card-header {
    padding: 12px 16px;
    background: var(--paper-2);
    border-bottom: 1px solid var(--rule);
}

.report-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.report-event-name {
    font-size: 14px;
    font-weight: 600;
}

.report-date {
    font-size: 12px;
    color: var(--ink-3);
    margin-left: auto;
}

/* Status badges */
.report-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.report-status-pending {
    background: #fef9c3;
    color: #713f12;
}

.report-status-reviewed {
    background: #dcfce7;
    color: #166534;
}

.report-status-dismissed {
    background: #f3f4f6;
    color: #6b7280;
}

.report-status-action {
    background: #fee2e2;
    color: #991b1b;
}

.report-card-body {
    padding: 14px 16px;
}

.report-row {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 13px;
    align-items: flex-start;
}

.report-field-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-3);
    min-width: 72px;
    flex-shrink: 0;
    padding-top: 1px;
}

.report-reason {
    font-weight: 600;
}

.report-review-form {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--rule);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.report-review-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ─── Modal image ─────────────────────────────────────────────────────────── */
.modal-image-wrap {
    margin: -32px -32px 20px -32px;
    height: 220px;
    overflow: hidden;
}

.modal-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ─── Cart button in modal ────────────────────────────────────────────────── */
.btn-cart {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-sans);
    padding: 8px 14px;
    border-radius: var(--radius);
    border: 1.5px solid var(--amber);
    background: var(--amber-pale);
    color: var(--amber);
    cursor: pointer;
    transition: all 0.15s;
}

    .btn-cart:hover {
        background: var(--amber);
        color: #fff;
    }

    .btn-cart.in-cart {
        background: var(--amber);
        color: #fff;
        border-color: var(--amber);
    }

        .btn-cart.in-cart:hover {
            background: #a5681a;
        }

/* ─── Responsive embed ────────────────────────────────────────────────────── */
@media (max-width: 560px) {
    .embed-toolbar {
        padding: 8px 12px;
    }

    .embed-cal-body {
        padding: 8px 12px;
    }

    .event-item {
        grid-template-columns: 72px 1fr;
    }

    .event-item-image {
        width: 72px;
        min-height: 72px;
    }

    .event-item-image-placeholder {
        font-size: 24px;
    }

    .daily-panel {
        margin: 0 8px 12px;
    }

    .event-item-title-btn {
        font-size: 13px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   BULK ICAL IMPORT PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

.page-subtitle {
    font-size: 15px;
    color: var(--ink-3);
    margin-top: 4px;
}

/* ── Step 1: Upload zone ─────────────────────────────────────────────────── */

.upload-zone-wrap {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 28px;
    align-items: start;
}

.upload-zone {
    border: 2px dashed var(--rule);
    border-radius: var(--radius-lg);
    background: var(--paper-2);
    padding: 48px 32px;
    text-align: center;
    transition: border-color 0.2s, background 0.2s;
    cursor: default;
}

    .upload-zone.dragging {
        border-color: var(--amber);
        background: var(--amber-pale);
    }

    .upload-zone.upload-error {
        border-color: var(--red);
        background: #fff5f5;
    }

.upload-icon {
    font-size: 48px;
    line-height: 1;
    margin-bottom: 12px;
}

.upload-title {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 400;
    margin-bottom: 4px;
}

    .upload-title code {
        font-family: monospace;
        font-size: 20px;
        background: var(--paper-3);
        padding: 1px 6px;
        border-radius: 4px;
    }

.upload-subtitle {
    font-size: 14px;
    color: var(--ink-3);
    margin-bottom: 16px;
}

.upload-browse-btn {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.upload-hint {
    font-size: 12px;
    color: var(--ink-3);
    line-height: 1.6;
    max-width: 460px;
    margin: 16px auto 0;
}

.upload-error-msg {
    margin-top: 16px;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 10px 16px;
    font-size: 14px;
    color: var(--red);
    text-align: left;
}

.upload-parsing {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    color: var(--ink-3);
    font-size: 14px;
}

/* ── Instructions panel ──────────────────────────────────────────────────── */

.import-instructions {
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    padding: 24px;
}

    .import-instructions h3 {
        font-family: var(--font-serif);
        font-size: 18px;
        font-weight: 400;
        margin-bottom: 14px;
        padding-bottom: 10px;
        border-bottom: 1px solid var(--rule);
    }

.import-steps-list {
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 13px;
    color: var(--ink-2);
    line-height: 1.6;
}

    .import-steps-list li {
        margin: 0;
    }

    .import-steps-list strong {
        color: var(--ink);
    }

.import-tip {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--rule);
    font-size: 12px;
    color: var(--ink-3);
    line-height: 1.6;
}

    .import-tip strong {
        color: var(--ink-2);
    }

    .import-tip a {
        color: var(--amber);
    }

/* ── Step 2: Preview ─────────────────────────────────────────────────────── */

.import-preview {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.preview-summary {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 15px;
}

.preview-count {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 400;
    color: var(--ink);
}

.preview-selected {
    font-size: 14px;
    font-weight: 600;
    color: var(--amber);
}

.import-options-bar {
    display: flex;
    align-items: flex-end;
    gap: 24px;
    flex-wrap: wrap;
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
}

.import-options-left, .import-options-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

    .preview-table th {
        background: var(--ink);
        color: rgba(250,247,244,0.75);
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        padding: 10px 12px;
        text-align: left;
        white-space: nowrap;
    }

    .preview-table td {
        padding: 10px 12px;
        border-bottom: 1px solid var(--rule-2);
        vertical-align: top;
    }

    .preview-table tr:last-child td {
        border-bottom: none;
    }

    .preview-table tr:hover td {
        background: var(--paper-2);
    }

    .preview-table tr.row-deselected td {
        opacity: 0.4;
        text-decoration: line-through;
        text-decoration-color: var(--ink-3);
    }

        .preview-table tr.row-deselected td:first-child {
            text-decoration: none;
            opacity: 1;
        }

.col-check {
    width: 36px;
    text-align: center;
}

.col-allday {
    width: 60px;
    text-align: center;
    font-size: 16px;
}

.preview-title {
    font-weight: 600;
    color: var(--ink);
    max-width: 240px;
}

.preview-date {
    white-space: nowrap;
}

.preview-time {
    color: var(--ink-3);
    font-size: 12px;
}

.preview-location {
    color: var(--ink-2);
    max-width: 180px;
}

.preview-desc {
    color: var(--ink-3);
    max-width: 220px;
}

.preview-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 4px;
}

/* Spinner inside button */
.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

/* ── Step 3: Results ─────────────────────────────────────────────────────── */

.import-results {
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    overflow: hidden;
    max-width: 640px;
}

.results-header {
    background: var(--ink);
    padding: 18px 24px;
    border-bottom: 2px solid var(--amber);
}

    .results-header h2 {
        font-family: var(--font-serif);
        font-size: 24px;
        font-weight: 400;
        color: var(--paper);
    }

.results-stats {
    display: flex;
    padding: 24px;
    gap: 24px;
    border-bottom: 1px solid var(--rule);
}

.result-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    border-radius: var(--radius-lg);
}

.result-added {
    background: #f0fdf4;
}

.result-skipped {
    background: var(--paper-2);
}

.result-rejected {
    background: #fff5f5;
}

.result-num {
    font-family: var(--font-serif);
    font-size: 40px;
    font-weight: 400;
    line-height: 1;
}

.result-added .result-num {
    color: var(--green);
}

.result-skipped .result-num {
    color: var(--ink-3);
}

.result-rejected .result-num {
    color: var(--red);
}

.result-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-3);
    margin-top: 4px;
    text-align: center;
}

.results-rejected-list {
    padding: 16px 24px;
    border-bottom: 1px solid var(--rule);
}

    .results-rejected-list h3 {
        font-size: 14px;
        font-weight: 600;
        margin-bottom: 10px;
        color: var(--red);
    }

.rejected-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 0;
    border-bottom: 1px solid var(--rule-2);
    font-size: 13px;
}

    .rejected-row:last-child {
        border-bottom: none;
    }

.rejected-title {
    font-weight: 600;
    color: var(--ink);
}

.rejected-reason {
    color: var(--red);
    font-size: 12px;
}

.results-actions {
    padding: 16px 24px;
    display: flex;
    gap: 10px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
    .upload-zone-wrap {
        grid-template-columns: 1fr;
    }

    .import-options-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONTENT FILTER ADMIN
   ═══════════════════════════════════════════════════════════════════════════ */

.filter-tester {
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 20px;
}

.filter-tester-title {
    font-family: var(--font-serif);
    font-size: 17px;
    font-weight: 400;
    margin-bottom: 12px;
}

.filter-test-clean {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 14px;
    color: var(--green);
}

.filter-test-flagged {
    background: #fef9c3;
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    padding: 12px 14px;
    font-size: 14px;
}

.filter-test-reject {
    color: var(--red);
    font-weight: 700;
}

.filter-test-flag {
    color: #92400e;
    font-weight: 600;
}

.filter-test-violations {
    margin: 8px 0 0 16px;
    list-style: disc;
}

    .filter-test-violations li {
        margin-bottom: 4px;
        font-size: 13px;
    }

.auto-reject-tag {
    background: var(--red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 6px;
}

.filter-cat-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.filter-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

    .filter-table th {
        text-align: left;
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--ink-3);
        padding: 10px 12px;
        border-bottom: 2px solid var(--rule);
    }

    .filter-table td {
        padding: 9px 12px;
        border-bottom: 1px solid var(--rule-2);
        vertical-align: middle;
    }

    .filter-table tr.row-inactive td {
        opacity: 0.45;
    }

    .filter-table tr:hover td {
        background: var(--paper-2);
    }

.filter-word {
    font-size: 12px;
    font-family: monospace;
    background: var(--paper-2);
    padding: 2px 7px;
    border-radius: 3px;
    border: 1px solid var(--rule);
    user-select: all;
}

/* Category badges */
.cat-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cat-hate {
    background: #fee2e2;
    color: #991b1b;
}

.cat-violence {
    background: #fecaca;
    color: #7f1d1d;
}

.cat-profanity {
    background: #fef3c7;
    color: #92400e;
}

.cat-harassment {
    background: #ede9fe;
    color: #5b21b6;
}

.cat-adult {
    background: #fce7f3;
    color: #9d174d;
}

.cat-spam {
    background: #f3f4f6;
    color: #374151;
}

.cat-custom {
    background: #dbeafe;
    color: #1e40af;
}

/* Type chips */
.type-chip {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
}

.type-regex {
    background: #dbeafe;
    color: #1e40af;
}

.type-literal {
    background: #f3f4f6;
    color: #374151;
}

/* Toggle button inside table */
.toggle-btn {
    border: none;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    cursor: pointer;
    transition: opacity 0.15s;
}

    .toggle-btn:hover {
        opacity: 0.8;
    }

.notes-cell {
    color: var(--ink-3);
    max-width: 200px;
    font-size: 12px;
}

.date-cell {
    color: var(--ink-3);
    font-size: 12px;
    white-space: nowrap;
}

.actions-cell {
    white-space: nowrap;
}

.inline-error {
    font-size: 12px;
    color: var(--red);
}

/* ═══════════════════════════════════════════════════════════════════════════
   DELETED EVENTS TABLE
   ═══════════════════════════════════════════════════════════════════════════ */

.deleted-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

    .deleted-table th {
        text-align: left;
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--ink-3);
        padding: 10px 12px;
        border-bottom: 2px solid var(--rule);
        white-space: nowrap;
    }

    .deleted-table td {
        padding: 9px 12px;
        border-bottom: 1px solid var(--rule-2);
        vertical-align: middle;
    }

    .deleted-table tr:hover td {
        background: var(--paper-2);
    }

.deleted-title {
    font-weight: 500;
    max-width: 220px;
}

.deleted-date {
    white-space: nowrap;
    font-size: 12px;
    color: var(--ink-3);
}

.deleted-user {
    font-size: 12px;
    color: var(--ink-3);
    font-family: monospace;
}

.was-approved-chip {
    display: inline-block;
    margin-left: 6px;
    font-size: 10px;
    font-weight: 600;
    background: #dcfce7;
    color: #166534;
    padding: 1px 6px;
    border-radius: 10px;
}

/* Event source chips */
.source-chip {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
}

.source-manual {
    background: #dbeafe;
    color: #1e40af;
}

.source-icalfeed {
    background: #ede9fe;
    color: #5b21b6;
}

.source-email {
    background: #fef9c3;
    color: #713f12;
}

/* ═══════════════════════════════════════════════════════════════════════════
   USER MANAGEMENT & BAN ADMIN
   ═══════════════════════════════════════════════════════════════════════════ */

.user-search-bar {
    margin-bottom: 14px;
}

.user-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    flex-wrap: wrap;
    transition: border-color 0.15s;
}

    .user-card:hover {
        border-color: var(--amber);
    }

.user-card-banned {
    border-color: #fecaca;
    background: #fff5f5;
}

.user-card-identity {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    flex: 1;
    min-width: 0;
}

.user-avatar {
    font-size: 24px;
    flex-shrink: 0;
    padding-top: 2px;
    line-height: 1;
}

.banned-avatar {
    filter: grayscale(1);
}

.user-email {
    font-weight: 600;
    font-size: 14px;
    word-break: break-all;
    color: var(--ink);
}

.user-display-name {
    font-size: 12px;
    color: var(--ink-3);
    margin-top: 2px;
}

.user-meta {
    font-size: 11px;
    color: var(--ink-3);
    margin-top: 4px;
}

.user-card-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.ban-reason {
    font-size: 13px;
    color: var(--red);
    max-width: 320px;
    text-align: right;
    line-height: 1.4;
}

.ban-reason-label {
    font-weight: 600;
    margin-right: 4px;
}

.user-event-stats {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: var(--ink-3);
    flex-wrap: wrap;
    justify-content: flex-end;
}

.deleted-stat {
    color: var(--red);
}

.user-card-actions {
    display: flex;
    gap: 6px;
}

/* Ban dialog */
.ban-dialog-user {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    margin: 8px 0 0;
}

.ban-consequences {
    background: #fff5f5;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 12px 16px;
    margin: 14px 0;
}

    .ban-consequences h4 {
        font-size: 13px;
        font-weight: 700;
        color: var(--red);
        margin-bottom: 8px;
    }

    .ban-consequences ul {
        padding-left: 18px;
        font-size: 13px;
        color: var(--ink-2);
        line-height: 1.8;
        margin: 0;
    }

/* Admin role badges (for calendar admin roster) */
.admin-role-badge {
}

.role-owner {
    background: var(--amber-pale);
    color: var(--amber);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.role-admin {
    background: #dbeafe;
    color: #1e40af;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.role-moderator {
    background: #ede9fe;
    color: #5b21b6;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Admin add-admin form */
.add-admin-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding: 10px;
    background: var(--paper-2);
    border-radius: var(--radius);
    margin-bottom: 10px;
}

.admin-roster {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--paper);
    border: 1px solid var(--rule-2);
    border-radius: var(--radius);
    font-size: 13px;
    flex-wrap: wrap;
}

.admin-identity {
    flex: 1;
    min-width: 0;
}

.admin-email {
    font-weight: 600;
    word-break: break-all;
}

.admin-name {
    font-size: 12px;
    color: var(--ink-3);
}

.admin-since {
    font-size: 11px;
    color: var(--ink-3);
    margin-left: auto;
}

/* Tier badges (shared calendar cards) */
.tier-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 9px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: color-mix(in srgb, var(--tier-color, #6b7280) 15%, white);
    color: color-mix(in srgb, var(--tier-color, #6b7280) 80%, black);
    border: 1px solid color-mix(in srgb, var(--tier-color, #6b7280) 30%, transparent);
}

.tier-badge-lg {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 800;
    padding: 3px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: color-mix(in srgb, var(--tier-color, #6b7280) 15%, white);
    color: color-mix(in srgb, var(--tier-color, #6b7280) 80%, black);
    border: 1px solid color-mix(in srgb, var(--tier-color, #6b7280) 30%, transparent);
}

.tier-info-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.tier-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tier-price {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
}

.tier-feature {
    font-size: 12px;
    color: var(--ink-3);
    white-space: nowrap;
}

.tier-actions {
    display: flex;
    gap: 6px;
}

.sub-expiry {
    font-size: 12px;
    color: var(--ink-3);
    margin-top: 8px;
}

    .sub-expiry.expired {
        color: var(--red);
        font-weight: 600;
    }

.email-ingestion-info {
    background: var(--paper-2);
    border-radius: var(--radius);
    padding: 10px 14px;
}

.email-ingestion-address {
    font-size: 14px;
    margin-bottom: 4px;
}

.email-ingestion-hint {
    font-size: 12px;
    color: var(--ink-3);
    margin: 0;
}

.tier-locked-hint {
    font-size: 13px;
    color: var(--ink-3);
    background: var(--paper-3);
    border-radius: var(--radius);
    padding: 8px 12px;
}

.badge-payment-lapsed {
    background: #fef9c3;
    color: #713f12;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.cal-restricted {
    border-color: #fecaca !important;
}

.cal-card-section {
    padding: 12px 20px;
    border-bottom: 1px solid var(--rule-2);
}

    .cal-card-section:last-child {
        border-bottom: none;
    }

.section-field-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-3);
    display: block;
    margin-bottom: 6px;
}

.section-sub-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.email-alias-row {
    display: flex;
    align-items: center;
    gap: 0;
}

.email-alias-suffix {
    font-size: 14px;
    color: var(--ink-3);
    background: var(--paper-3);
    border: 1px solid var(--rule);
    border-left: none;
    padding: 9px 12px;
    border-radius: 0 var(--radius) var(--radius) 0;
    white-space: nowrap;
}

.email-alias-row .form-control {
    border-radius: var(--radius) 0 0 var(--radius);
}

/* Embed restricted overlay */
.embed-restricted {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    padding: 48px 32px;
    background: var(--paper-2);
    text-align: center;
}

.embed-restricted-inner {
    max-width: 360px;
}

.restricted-icon {
    font-size: 40px;
    margin-bottom: 14px;
    line-height: 1;
}

.embed-restricted-inner h2 {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 400;
    margin-bottom: 8px;
}

.embed-restricted-inner p {
    font-size: 14px;
    color: var(--ink-3);
    line-height: 1.6;
}

/* Stat card variants */
.stat-card-muted {
    opacity: 0.7;
}

.stat-card-danger {
    background: #fff5f5;
    border: 1px solid #fecaca;
}


/* ═══════════════════════════════════════════════════════════════════════════
   ENTITY ADMIN
   ═══════════════════════════════════════════════════════════════════════════ */

.entity-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.entity-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    flex-wrap: wrap;
    transition: border-color 0.15s;
}

    .entity-card:hover {
        border-color: var(--amber);
    }

    .entity-card.entity-inactive {
        opacity: 0.55;
    }

.entity-card-left {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    flex: 1;
    min-width: 0;
}

.entity-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: var(--radius);
    flex-shrink: 0;
}

.entity-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: var(--amber-pale);
    color: var(--amber);
    font-family: var(--font-serif);
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 400;
}

.entity-info {
    flex: 1;
    min-width: 0;
}

.entity-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--ink);
    margin-bottom: 3px;
}

.entity-desc {
    font-size: 13px;
    color: var(--ink-3);
    line-height: 1.4;
    margin: 0 0 6px;
}

.entity-meta {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--ink-3);
}

    .entity-meta a {
        color: var(--amber);
        text-decoration: none;
    }

        .entity-meta a:hover {
            text-decoration: underline;
        }

.entity-card-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    padding-top: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   THEME EDITOR
   ═══════════════════════════════════════════════════════════════════════════ */

.theme-editor-layout {
    display: grid;
    grid-template-columns: 220px 1fr 320px;
    gap: 16px;
    align-items: start;
    min-height: 500px;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */

.theme-list-sidebar {
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.theme-list-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--rule-2);
    cursor: pointer;
    transition: background 0.12s;
}

    .theme-list-item:last-child {
        border-bottom: none;
    }

    .theme-list-item:hover {
        background: var(--paper-3);
    }

    .theme-list-item.selected {
        background: var(--amber-pale);
        border-left: 3px solid var(--amber);
    }

    .theme-list-item.inactive {
        opacity: 0.5;
    }

.theme-list-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--ink);
    margin-bottom: 2px;
}

.theme-list-meta {
    font-size: 11px;
    color: var(--ink-3);
}

/* ── Editor panel ────────────────────────────────────────────────────────── */

.theme-editor-panel {
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.theme-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--paper-2);
    border-bottom: 1px solid var(--rule);
    flex-wrap: wrap;
    gap: 10px;
}

.theme-editor-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-editor-name {
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 400;
    margin: 0;
    color: var(--ink);
}

.theme-editor-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* ── Setting groups ──────────────────────────────────────────────────────── */

.theme-setting-group {
    border-bottom: 1px solid var(--rule-2);
    padding: 14px 20px;
}

    .theme-setting-group:last-of-type {
        border-bottom: none;
    }

.theme-group-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-3);
    margin: 0 0 10px;
}

.theme-settings-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.theme-setting-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    align-items: center;
    gap: 12px;
    padding: 6px 8px;
    border-radius: var(--radius);
    transition: background 0.1s;
}

    .theme-setting-row:hover {
        background: var(--paper-2);
    }

    .theme-setting-row.setting-customised {
        background: color-mix(in srgb, var(--amber) 6%, var(--paper));
    }

.theme-setting-label {
    font-size: 13px;
    color: var(--ink-2);
    display: flex;
    align-items: center;
    gap: 5px;
}

.setting-custom-dot {
    color: var(--amber);
    font-size: 10px;
}

/* Color input row */
.color-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

    .color-input-row input[type="color"] {
        width: 36px;
        height: 36px;
        padding: 2px;
        border: 1px solid var(--rule);
        border-radius: var(--radius);
        cursor: pointer;
        flex-shrink: 0;
    }

.color-text-input {
    font-family: monospace;
    font-size: 13px;
    width: 90px;
    padding: 6px 8px;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--paper);
    color: var(--ink);
}

/* px input row */
.px-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.px-input {
    width: 72px;
    text-align: center;
}

.px-unit {
    font-size: 12px;
    color: var(--ink-3);
}

/* font input row */
.font-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.font-input {
    font-size: 13px;
}

/* Reset button */
.btn-reset {
    background: none;
    border: none;
    color: var(--ink-3);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: var(--radius);
    transition: color 0.12s;
    flex-shrink: 0;
}

    .btn-reset:hover {
        color: var(--amber);
    }

/* Editor footer */
.theme-editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--paper-2);
    border-top: 1px solid var(--rule);
}

.theme-editor-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--ink-3);
    font-size: 14px;
    border: 1px dashed var(--rule);
    border-radius: var(--radius-lg);
}

/* ── Live preview panel ───────────────────────────────────────────────────── */

.theme-preview-panel {
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: sticky;
    top: 20px;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--rule);
    background: var(--paper-3);
}

    .preview-header h4 {
        font-family: var(--font-serif);
        font-size: 15px;
        font-weight: 400;
        margin: 0;
    }

.preview-hint {
    font-size: 11px;
    color: var(--ink-3);
}

.theme-preview-frame {
    padding: 12px;
    /* The <style> tag injected here redefines :root inside this scope.
     Because :root targets the document root, the variables leak out to the
     live page intentionally during preview. */
}

/* Mini calendar preview — uses the same CSS variables as the real calendar */
.theme-preview-calendar {
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 11px;
}

.preview-cal-header {
    background: var(--header-bg, var(--ink));
    color: var(--header-text, var(--paper));
    padding: 8px 10px;
    font-family: var(--font-serif);
    font-size: 14px;
    font-weight: 400;
    border-bottom: 2px solid var(--header-border, var(--amber));
}

.preview-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--rule-2);
}

.preview-dow {
    background: var(--cell-header-bg, var(--ink));
    color: var(--cell-header-text, rgba(250,247,244,0.7));
    text-align: center;
    padding: 4px 2px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.preview-cell {
    background: var(--paper);
    padding: 3px;
    min-height: 36px;
}

    .preview-cell.preview-today {
        background: var(--cell-today-bg, var(--amber-pale));
    }

.preview-day-num {
    display: inline-block;
    font-size: 10px;
    color: var(--ink-3);
    padding: 1px 3px;
    border-radius: 50%;
}

.preview-today .preview-day-num {
    background: var(--cell-today-text, var(--amber));
    color: #fff;
}

.preview-event-pill {
    font-size: 9px;
    background: color-mix(in srgb, var(--amber) 15%, white);
    border-left: 2px solid var(--amber);
    border-radius: var(--event-pill-radius, 2px);
    padding: 1px 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
    color: var(--ink);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 1200px) {
    .theme-editor-layout {
        grid-template-columns: 200px 1fr;
    }

    .theme-preview-panel {
        display: none;
    }
}

@media (max-width: 800px) {
    .theme-editor-layout {
        grid-template-columns: 1fr;
    }

    .theme-list-sidebar {
        display: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SUPER ADMIN CHROME
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Nav link ────────────────────────────────────────────────────────────── */

.nav-superadmin {
    color: #7c3aed !important;
    font-weight: 700 !important;
    background: rgba(124, 58, 237, 0.08);
    border-radius: var(--radius);
    padding: 4px 10px !important;
}

    .nav-superadmin:hover {
        background: rgba(124, 58, 237, 0.16) !important;
        color: #5b21b6 !important;
    }

/* ── Page chrome ─────────────────────────────────────────────────────────── */

.sa-page {
    --sa-accent: #7c3aed;
}

.sa-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.sa-badge {
    display: inline-block;
    background: var(--sa-accent);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 6px;
}

.sa-header-brand h1 {
    font-family: var(--font-serif);
    font-size: 28px;
    font-weight: 400;
    margin: 0 0 4px;
}

.sa-header-meta {
    font-size: 13px;
    color: var(--ink-3);
    padding-top: 6px;
}

.sa-user-label strong {
    color: var(--ink);
}

.sa-no-access {
    text-align: center;
    padding: 60px 20px;
    color: var(--ink-3);
}

    .sa-no-access .restricted-icon {
        font-size: 48px;
        margin-bottom: 14px;
    }

    .sa-no-access h2 {
        font-family: var(--font-serif);
        font-size: 26px;
        font-weight: 400;
        margin-bottom: 10px;
    }

/* ── Permission summary bar ──────────────────────────────────────────────── */

.sa-permission-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
    padding: 12px 16px;
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
}

.sa-perm-chip {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 10px;
    background: rgba(124, 58, 237, 0.1);
    color: #5b21b6;
    white-space: nowrap;
}

.sa-perm-denied {
    background: var(--paper-3);
    color: var(--ink-3);
    text-decoration: line-through;
}

/* ── Tab navigation ──────────────────────────────────────────────────────── */

.sa-nav-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--rule);
    padding-bottom: 14px;
}

/* ── Data table ──────────────────────────────────────────────────────────── */

.sa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

    .sa-table th {
        text-align: left;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--ink-3);
        padding: 10px 12px;
        border-bottom: 2px solid var(--rule);
        white-space: nowrap;
        background: var(--paper-2);
    }

    .sa-table td {
        padding: 9px 12px;
        border-bottom: 1px solid var(--rule-2);
        vertical-align: middle;
    }

    .sa-table tr:hover td {
        background: var(--paper-2);
    }

    .sa-table tr.row-inactive td {
        opacity: 0.5;
    }

.sa-cell-primary {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
}

.sa-cell-email {
    font-size: 12px;
    color: var(--ink-3);
}

.sa-cell-date {
    font-size: 12px;
    color: var(--ink-3);
    white-space: nowrap;
}

.sa-cell-num {
    text-align: center;
    font-weight: 700;
}

.sa-cell-notes {
    font-size: 12px;
    color: var(--ink-3);
    max-width: 200px;
}

.sa-cell-actions {
    white-space: nowrap;
    display: flex;
    gap: 4px;
    align-items: center;
}

.sa-cell-sub {
    font-size: 11px;
    color: var(--ink-3);
    font-weight: 400;
}

.sa-entity-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 3px;
    flex-shrink: 0;
}

/* ── Filter bar ──────────────────────────────────────────────────────────── */

.sa-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--ink-3);
}

/* ── Permission grid (grant / edit staff form) ───────────────────────────── */

.sa-perm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.sa-perm-group {
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 10px 12px;
}

.sa-perm-group-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-3);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--rule-2);
}

.sa-perm-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    margin-bottom: 5px;
    cursor: pointer;
}

    .sa-perm-check:hover {
        color: var(--sa-accent);
    }

    .sa-perm-check input[type="checkbox"] {
        cursor: pointer;
    }

/* ── Staff cards ─────────────────────────────────────────────────────────── */

.sa-staff-card {
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    transition: border-color 0.15s;
}

    .sa-staff-card:hover {
        border-color: rgba(124, 58, 237, 0.4);
    }

    .sa-staff-card.sa-staff-self {
        border-color: var(--sa-accent);
        border-width: 2px;
    }

.sa-self-badge {
    background: rgba(124, 58, 237, 0.12);
    color: var(--sa-accent);
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
}

.sa-staff-identity {
    flex: 1;
    min-width: 180px;
}

.sa-staff-email {
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
    word-break: break-all;
}

.sa-staff-notes {
    font-size: 12px;
    color: var(--ink-3);
    margin-top: 3px;
}

.sa-staff-meta {
    font-size: 11px;
    color: var(--ink-3);
    margin-top: 5px;
}

/* Per-group permission dots on staff cards */
.sa-staff-perms {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0;
}

.sa-staff-perm-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sa-perm-group-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-3);
    width: 68px;
    flex-shrink: 0;
}

.sa-perm-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 3px;
}

.sa-perm-dot-on {
    background: rgba(124, 58, 237, 0.12);
    color: #5b21b6;
}

.sa-perm-dot-off {
    background: var(--paper-3);
    color: var(--ink-3);
}

.sa-staff-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
    flex-shrink: 0;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
    .sa-staff-card {
        flex-direction: column;
    }

    .sa-staff-actions {
        flex-direction: row;
        align-items: flex-start;
    }

    .sa-perm-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .sa-table {
        font-size: 12px;
    }
}

@media (max-width: 600px) {
    .sa-perm-grid {
        grid-template-columns: 1fr;
    }

    .sa-permission-bar {
        display: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   HOME PAGE — DAY PANEL & BELOW-CALENDAR LIST
   ═══════════════════════════════════════════════════════════════════════════ */

/* When sidebar is hidden (menu=false), calendar takes full width */
.cal-main-fullwidth {
    grid-column: 1 / -1;
}

/* ── Day panel (appears below the month grid on click) ───────────────────── */

.daily-panel {
    margin-top: 8px;
    border: 1px solid var(--rule);
    border-top: 3px solid var(--amber);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    background: var(--paper);
    animation: slideDown 0.18s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.daily-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: var(--ink);
    border-bottom: 2px solid var(--header-border, var(--amber));
}

.daily-panel-title {
    font-family: var(--font-serif);
    font-size: 16px;
    font-weight: 400;
    color: var(--paper);
    margin: 0;
}

    .daily-panel-title em {
        font-style: normal;
        color: var(--amber);
    }

.daily-close {
    background: none;
    border: none;
    color: rgba(250,247,244,0.6);
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius);
    line-height: 1;
    transition: color 0.15s, background 0.15s;
}

    .daily-close:hover {
        color: var(--paper);
        background: rgba(255,255,255,0.12);
    }

.daily-events {
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 420px;
    overflow-y: auto;
}

.daily-empty {
    padding: 24px 18px;
    color: var(--ink-3);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ── Below-calendar upcoming events strip ────────────────────────────────── */

.below-calendar-list {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px solid var(--rule);
}

.bcl-heading {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 400;
    margin: 0 0 16px;
    color: var(--ink);
}

.bcl-subheading {
    font-size: 16px;
    font-weight: 400;
    color: var(--amber);
    margin-left: 8px;
}

.bcl-empty {
    color: var(--ink-3);
    font-size: 15px;
    padding: 16px 0;
}

.bcl-event-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bcl-event-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--paper);
    border: 1px solid var(--rule-2);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    text-align: left;
    width: 100%;
}

    .bcl-event-row:hover {
        border-color: var(--amber);
        background: var(--paper-2);
    }

.bcl-date-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 40px;
    flex-shrink: 0;
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 4px 6px;
}

.bcl-month {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--amber);
    line-height: 1;
}

.bcl-day {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 400;
    line-height: 1.1;
    color: var(--ink);
}

.bcl-event-body {
    flex: 1;
    min-width: 0;
}

.bcl-event-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bcl-event-meta {
    font-size: 12px;
    color: var(--ink-3);
    margin-top: 2px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Month cell cursor signal */
.month-cell {
    cursor: pointer;
}

    .month-cell:hover .cell-day {
        background: var(--amber-pale);
        border-radius: 50%;
        width: 24px;
        height: 24px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .month-cell.selected-cell {
        background: var(--cell-selected-bg, color-mix(in srgb, var(--amber) 8%, var(--paper))) !important;
        border: 1px solid var(--cell-selected-border, color-mix(in srgb, var(--amber) 40%, transparent));
    }

        .month-cell.selected-cell .cell-day {
            background: var(--amber);
            color: #fff;
            border-radius: 50%;
            width: 24px;
            height: 24px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
        }


/* ═══════════════════════════════════════════════════════════════════════════
   WEEK TIMELINE VIEW
   ═══════════════════════════════════════════════════════════════════════════ */

.week-view {
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: var(--paper);
}

/* ── Day header row ────────────────────────────────────────────────────────── */
.week-header-grid {
    display: grid;
    grid-template-columns: 56px repeat(7, 1fr);
    background: var(--ink);
    border-bottom: 1px solid rgba(79,70,229,0.3);
}

.week-time-gutter {
    border-right: 1px solid rgba(255,255,255,0.08);
}

.week-day-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 6px;
    border-right: 1px solid rgba(255,255,255,0.06);
    cursor: default;
}

    .week-day-header:last-child {
        border-right: none;
    }

.week-today-header {
    background: rgba(79,70,229,0.15);
}

.wdh-dow {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.5);
    margin-bottom: 4px;
}

.wdh-num {
    font-family: var(--font-sans);
    font-size: 20px;
    font-weight: 300;
    color: rgba(255,255,255,0.8);
    line-height: 1;
}

.wdh-today {
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* ── All-day strip ─────────────────────────────────────────────────────────── */
.week-allday-grid {
    display: grid;
    grid-template-columns: 56px repeat(7, 1fr);
    border-bottom: 1px solid var(--rule);
    min-height: 32px;
    background: var(--paper-2);
}

.week-allday-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-3);
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--rule);
}

.week-allday-col {
    padding: 3px 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-right: 1px solid var(--rule-2);
}

    .week-allday-col:last-child {
        border-right: none;
    }

.week-allday-pill {
    display: block;
    width: 100%;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-sans);
    color: #fff;
    background: var(--tag-color, var(--accent));
    border: none;
    border-radius: 3px;
    padding: 2px 5px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.12s;
    opacity: 0.9;
}

    .week-allday-pill:hover {
        opacity: 1;
    }

/* ── Scrollable body ────────────────────────────────────────────────────────── */
.week-body-scroll {
    overflow-y: auto;
    max-height: 640px;
    scroll-behavior: smooth;
    /* Auto-scroll to 7am on mount is handled via JS or initial scroll-padding */
}

.week-body-grid {
    display: grid;
    grid-template-columns: 56px repeat(7, 1fr);
    position: relative;
}

/* ── Hour labels column ─────────────────────────────────────────────────────── */
.week-time-col {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--rule);
    background: var(--paper-2);
}

.week-hour-label {
    height: 64px; /* must match HourPx constant */
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 4px 8px 0 0;
    font-size: 10px;
    font-weight: 600;
    color: var(--ink-3);
    flex-shrink: 0;
    letter-spacing: 0em;
}

/* ── Day columns ─────────────────────────────────────────────────────────────── */
.week-day-col {
    position: relative;
    border-right: 1px solid var(--rule-2);
    min-height: 1024px; /* (22-6) * 64 = 1024 */
}

    .week-day-col:last-child {
        border-right: none;
    }

.week-day-today {
    background: #fafafe;
}

/* Hour grid lines inside each day column */
.week-hour-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 64px;
    border-top: 1px solid var(--rule-2);
    pointer-events: none;
}

    .week-hour-line:nth-child(1) {
        top: 0;
    }

    .week-hour-line:nth-child(2) {
        top: 64px;
    }

    .week-hour-line:nth-child(3) {
        top: 128px;
    }

    .week-hour-line:nth-child(4) {
        top: 192px;
    }

    .week-hour-line:nth-child(5) {
        top: 256px;
    }

    .week-hour-line:nth-child(6) {
        top: 320px;
    }

    .week-hour-line:nth-child(7) {
        top: 384px;
    }

    .week-hour-line:nth-child(8) {
        top: 448px;
    }

    .week-hour-line:nth-child(9) {
        top: 512px;
    }

    .week-hour-line:nth-child(10) {
        top: 576px;
    }

    .week-hour-line:nth-child(11) {
        top: 640px;
    }

    .week-hour-line:nth-child(12) {
        top: 704px;
    }

    .week-hour-line:nth-child(13) {
        top: 768px;
    }

    .week-hour-line:nth-child(14) {
        top: 832px;
    }

    .week-hour-line:nth-child(15) {
        top: 896px;
    }

    .week-hour-line:nth-child(16) {
        top: 960px;
    }

    .week-hour-line:nth-child(17) {
        top: 1024px;
    }

/* "Now" red line */
.week-now-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--red);
    z-index: 10;
    pointer-events: none;
}

    .week-now-line::before {
        content: '';
        position: absolute;
        left: -4px;
        top: -4px;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background: var(--red);
    }

/* Timed events */
.week-event {
    position: absolute;
    left: 2px;
    right: 2px;
    background: var(--tag-color, var(--accent));
    border: none;
    border-radius: 5px;
    padding: 3px 6px;
    cursor: pointer;
    text-align: left;
    font-family: var(--font-sans);
    overflow: hidden;
    transition: filter 0.12s, box-shadow 0.12s;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

    .week-event:hover {
        filter: brightness(1.1);
        box-shadow: 0 2px 12px rgba(0,0,0,0.2);
        z-index: 20;
    }

.we-title {
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.we-time {
    font-size: 10px;
    color: rgba(255,255,255,0.75);
    white-space: nowrap;
    line-height: 1;
}

/* View icon in toolbar buttons */
.view-icon {
    font-size: 13px;
    opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════════════════════
   AGENDA VIEW  (month-scoped day list)
   ═══════════════════════════════════════════════════════════════════════════ */

.agenda-list {
    display: flex;
    flex-direction: column;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.agenda-day-row {
    display: grid;
    grid-template-columns: 64px 1fr;
    border-bottom: 1px solid var(--rule-2);
    min-height: 60px;
}

    .agenda-day-row:last-child {
        border-bottom: none;
    }

.agenda-today-row {
    background: #fafaff;
}

/* Date column */
.agenda-date-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 14px 8px;
    border-right: 1px solid var(--rule-2);
    background: var(--paper-2);
    position: sticky;
    top: 0;
}

.agenda-dow {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-3);
    margin-bottom: 2px;
}

.agenda-day {
    font-size: 22px;
    font-weight: 300;
    font-family: var(--font-sans);
    color: var(--ink);
    line-height: 1;
}

.agenda-day-today {
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

/* Events column */
.agenda-events-col {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
}

.agenda-event-row {
    display: grid;
    grid-template-columns: 4px 72px 1fr auto 20px;
    align-items: center;
    gap: 10px;
    padding: 8px 14px 8px 0;
    margin: 0 0 1px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-family: var(--font-sans);
    transition: background 0.12s;
    border-radius: 0;
    width: 100%;
}

    .agenda-event-row:hover {
        background: var(--accent-pale);
    }

.agenda-event-stripe {
    width: 4px;
    height: 100%;
    border-radius: 2px;
    align-self: stretch;
    min-height: 24px;
}

.agenda-event-time {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 12px;
    font-weight: 700;
    color: var(--ink-2);
    white-space: nowrap;
    gap: 0;
}

.agenda-ampm {
    font-size: 10px;
    font-weight: 500;
    color: var(--ink-3);
    text-transform: uppercase;
}

.agenda-allday-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--accent-pale);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
}

.agenda-event-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.agenda-event-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.agenda-event-loc {
    font-size: 11px;
    color: var(--ink-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agenda-event-tags {
    display: flex;
    gap: 3px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

    .agenda-event-tags .tag-badge {
        padding: 2px 5px;
        font-size: 12px;
    }

/* ── Empty state icon ────────────────────────────────────────────────────────── */
.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .week-header-grid,
    .week-allday-grid,
    .week-body-grid {
        grid-template-columns: 40px repeat(7, 1fr);
    }

    .week-time-gutter,
    .week-time-col {
        width: 40px;
    }

    .week-hour-label {
        font-size: 9px;
        padding-right: 4px;
    }
}

@media (max-width: 700px) {
    .week-view {
        border-radius: var(--radius);
    }

    .agenda-event-row {
        grid-template-columns: 4px 60px 1fr 20px;
    }

    .agenda-event-tags {
        display: none;
    }

    .wdh-num {
        font-size: 16px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SUPER ADMIN — calendar expand panel, link row, subdomain badge
   ═══════════════════════════════════════════════════════════════════════════ */

/* Row highlight when expanded */
.sa-row-expanded td {
    background: color-mix(in srgb, var(--accent) 4%, var(--paper)) !important;
    border-bottom: none !important;
}

/* Expand row — no padding, no background flicker */
.sa-expand-row td {
    background: var(--paper-2);
}

.sa-expand-row:hover td {
    background: var(--paper-2) !important;
}

/* Calendar manage panel */
.sa-calendar-panel {
    border-top: 2px solid var(--accent);
    background: var(--paper-2);
}

.sa-panel-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--rule);
    background: var(--paper-3);
    padding: 0 16px;
}

    .sa-panel-tabs .view-btn {
        border-radius: 0;
        border-bottom: 2px solid transparent;
        margin-bottom: -1px;
        font-size: 13px;
        padding: 10px 18px;
    }

        .sa-panel-tabs .view-btn.active {
            background: none;
            color: var(--accent);
            border-bottom-color: var(--accent);
            font-weight: 700;
        }

.sa-panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--rule-2);
    flex-wrap: wrap;
}

/* Nested table inside panel — slightly smaller, no outer border */
.sa-panel-table {
    font-size: 12px;
}

    .sa-panel-table th {
        font-size: 10px;
        padding: 8px 12px;
    }

    .sa-panel-table td {
        padding: 7px 12px;
    }

/* Link row in calendar edit card */
.edit-card-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

    .edit-card-header-row h3 {
        margin: 0;
    }

.cal-link-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 7px 12px;
    flex-wrap: wrap;
}

.cal-link-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-3);
    white-space: nowrap;
}

.cal-link-code {
    font-size: 12px;
    font-family: monospace;
    color: var(--accent);
    background: var(--accent-pale);
    padding: 2px 8px;
    border-radius: 4px;
    word-break: break-all;
}

/* Subdomain badge in calendars table */
.subdomain-badge {
    font-size: 12px;
    font-family: monospace;
    font-weight: 600;
    background: var(--ink);
    color: #a5b4fc;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: -0.01em;
}

/* Dim placeholder text */
.sa-cell-dim {
    color: var(--ink-3);
    font-size: 13px;
}

/* badge-pending (for event status) */
.badge-pending {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    background: #fef9c3;
    color: #854d0e;
}


/* ─── Review card tag editor ─────────────────────────────────────────────── */
.review-tag-editor {
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 16px;
    background: var(--paper-2);
}

.tag-editor-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-3);
    margin-bottom: 10px;
}

.tag-editor-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.tag-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-sans);
    padding: 4px 12px;
    border-radius: 20px;
    cursor: pointer;
    border: 2px solid color-mix(in srgb, var(--tag-color, var(--accent)) 35%, transparent);
    background: color-mix(in srgb, var(--tag-color, var(--accent)) 10%, white);
    color: color-mix(in srgb, var(--tag-color, var(--accent)) 70%, black);
    transition: all 0.15s;
}

    .tag-toggle-btn:hover {
        background: color-mix(in srgb, var(--tag-color, var(--accent)) 20%, white);
    }

.tag-toggle-on {
    background: var(--tag-color, var(--accent));
    color: #fff;
    border-color: var(--tag-color, var(--accent));
}

    .tag-toggle-on:hover {
        filter: brightness(1.1);
        background: var(--tag-color, var(--accent));
    }

.tag-save-msg {
    font-size: 12px;
    color: var(--green);
    font-weight: 600;
    margin-bottom: 6px;
}

.tag-editor-actions {
    display: flex;
    gap: 8px;
}

/* ─── Accept Invite page ─────────────────────────────────────────────────── */
.invite-card {
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

    .invite-card h2 {
        font-family: var(--font-serif);
        font-size: 28px;
        font-weight: 400;
        letter-spacing: -0.02em;
        margin: 12px 0 10px;
        color: var(--ink);
    }

    .invite-card p {
        color: var(--ink-2);
        margin-bottom: 20px;
        font-size: 15px;
        line-height: 1.6;
    }

    .invite-card .btn-primary,
    .invite-card .btn-ghost {
        margin: 0 4px;
    }

.invite-card-success {
    border-color: var(--green);
}

    .invite-card-success h2 {
        color: var(--green);
    }

.invite-card-error {
    border-color: var(--red);
}

    .invite-card-error h2 {
        color: var(--red);
    }

.invite-icon {
    font-size: 52px;
    line-height: 1;
    margin-bottom: 4px;
}

.invite-message {
    background: var(--paper-2);
    border-left: 3px solid var(--accent);
    padding: 10px 16px;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
    color: var(--ink-2);
    margin: 0 0 20px;
    text-align: left;
    font-size: 14px;
    line-height: 1.6;
}

.invite-expiry {
    font-size: 12px;
    color: var(--ink-3);
    margin-bottom: 24px;
}

.invite-auth-note {
    font-size: 13px;
    color: var(--ink-3);
    margin-bottom: 20px;
    line-height: 1.5;
}

/* ─── AI review panels ───────────────────────────────────────────────────── */
.review-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.quality-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 22px;
    border-radius: 11px;
    font-size: 11px;
    font-weight: 800;
    font-family: var(--font-sans);
    background: color-mix(in srgb, var(--qcolor) 15%, white);
    color: var(--qcolor);
    border: 1.5px solid color-mix(in srgb, var(--qcolor) 40%, transparent);
    cursor: default;
    flex-shrink: 0;
}

.quality-flag-icon {
    font-size: 13px;
    color: #7c3aed;
    cursor: default;
    flex-shrink: 0;
}

.ai-panel {
    border-radius: var(--radius);
    border: 1px solid var(--rule);
    margin-bottom: 12px;
    overflow: hidden;
}

.ai-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--paper-2);
    border-bottom: 1px solid var(--rule);
    font-size: 12px;
    font-weight: 700;
}

.ai-panel-icon {
    font-size: 14px;
}

.ai-panel-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-2);
}

.ai-panel-hint {
    font-size: 11px;
    font-weight: 400;
    color: var(--ink-3);
    margin-left: auto;
}

.ai-grade-chip {
    margin-left: auto;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--qcolor) 12%, white);
    color: var(--qcolor);
    border: 1px solid color-mix(in srgb, var(--qcolor) 30%, transparent);
}

.ai-flags {
    padding: 8px 14px 4px;
}

.ai-flag-row {
    font-size: 12px;
    color: #7c3aed;
    font-weight: 600;
    padding: 3px 0;
}

.ai-hints {
    margin: 0;
    padding: 8px 14px 10px 28px;
    list-style: disc;
}

    .ai-hints li {
        font-size: 12px;
        color: var(--ink-2);
        padding: 2px 0;
        line-height: 1.5;
    }

.ai-quality-panel {
    border-color: color-mix(in srgb, #7c3aed 30%, var(--rule));
}

    .ai-quality-panel .ai-panel-header {
        background: color-mix(in srgb, #7c3aed 5%, var(--paper));
    }

.ai-tag-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 14px;
}

.ai-suggest-btn {
    position: relative;
}

.suggest-conf {
    font-size: 7px;
    margin-left: 2px;
    vertical-align: middle;
}

.ai-tags-panel {
    border-color: color-mix(in srgb, #0891b2 30%, var(--rule));
}

    .ai-tags-panel .ai-panel-header {
        background: color-mix(in srgb, #0891b2 5%, var(--paper));
    }

.ai-dupes-panel {
    border-color: color-mix(in srgb, #d97706 30%, var(--rule));
}

    .ai-dupes-panel .ai-panel-header {
        background: color-mix(in srgb, #d97706 5%, var(--paper));
    }

.ai-dupe-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 7px 14px;
    border-top: 1px solid var(--rule);
    font-size: 13px;
    flex-wrap: wrap;
}

.ai-dupe-title {
    font-weight: 600;
    color: var(--ink);
    flex: 1 1 180px;
}

.ai-dupe-date {
    color: var(--ink-3);
    font-size: 12px;
    white-space: nowrap;
}

.ai-dupe-score {
    font-weight: 700;
    font-size: 12px;
    white-space: nowrap;
}

.ai-dupe-reasons {
    font-size: 11px;
    color: var(--ink-3);
    font-style: italic;
    flex-basis: 100%;
    padding-left: 0;
}

/* ─── Super Admin — AI settings tab ─────────────────────────────────────── */
.ai-feature-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.ai-flag-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-2);
    cursor: pointer;
    padding: 5px 10px;
    border-radius: var(--radius);
    border: 1px solid var(--rule);
    background: var(--paper-2);
    transition: background 0.12s;
}

    .ai-flag-check:hover {
        background: var(--paper-3, #f1f5f9);
    }

.ai-flag-zero {
    border-color: color-mix(in srgb, #059669 30%, var(--rule));
}

.ai-flag-premium {
    border-color: color-mix(in srgb, #7c3aed 25%, var(--rule));
}

.ai-flag-tag {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ai-flag-tag-free {
    background: #dcfce7;
    color: #059669;
}

.ai-flag-tag-premium {
    background: #ede9fe;
    color: #7c3aed;
}

.ai-feature-flags-inline {
    flex-wrap: nowrap;
    gap: 4px;
}

.ai-flag-check-sm {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 3px 7px;
    border-radius: var(--radius);
    border: 1px solid var(--rule);
    background: var(--paper-2);
    cursor: pointer;
    white-space: nowrap;
}

.ai-flag-disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.form-control-sm {
    padding: 4px 6px;
    font-size: 12px;
    height: 28px;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    margin-top: 4px;
}

/* ─── Entity tier & transactions ─────────────────────────────────────────── */
.sa-section-divider {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ink-3);
    border-top: 1px solid var(--rule);
    padding-top: 14px;
    margin: 16px 0 12px;
}

.sub-expiry {
    font-size: 12px;
    color: var(--ink-3);
}

    .sub-expiry.expired {
        color: var(--red);
        font-weight: 600;
    }

.sa-transactions-panel {
    background: var(--paper-2);
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}

.sa-transactions-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 700;
    color: var(--ink-2);
    background: var(--paper-3, #f8fafc);
    border-bottom: 1px solid var(--rule);
    flex-wrap: wrap;
}

.badge-pending {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: color-mix(in srgb, #d97706 15%, white);
    color: #d97706;
    border: 1px solid color-mix(in srgb, #d97706 30%, transparent);
}

/* ─── Tier preview card (entity edit form) ───────────────────────────────── */
.tier-preview-card {
    border: 1.5px solid color-mix(in srgb, var(--tier-color) 35%, var(--rule));
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--tier-color) 4%, var(--paper));
    padding: 14px 16px;
    margin-bottom: 16px;
}

.tier-preview-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.tier-preview-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--tier-color);
}

.tier-promo-tag {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--tier-color) 15%, white);
    color: var(--tier-color);
    border: 1px solid color-mix(in srgb, var(--tier-color) 30%, transparent);
}

.tier-promo-term {
    font-size: 11px;
    color: var(--ink-3);
    font-style: italic;
}

.tier-preview-desc {
    font-size: 12px;
    color: var(--ink-2);
    margin: 0 0 10px;
    line-height: 1.5;
}

.tier-preview-limits {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    margin-bottom: 10px;
    overflow-x: auto;
}

.tier-limit-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1 1 0;
    min-width: 80px;
    padding: 10px 8px;
    background: color-mix(in srgb, var(--tier-color) 8%, var(--paper));
    border: 1px solid color-mix(in srgb, var(--tier-color) 22%, var(--rule));
    border-radius: var(--radius);
    text-align: center;
}

.tier-limit-icon {
    font-size: 16px;
    line-height: 1;
}

.tier-limit-label {
    color: var(--ink-3);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tier-limit-value {
    font-weight: 700;
    color: var(--tier-color);
    font-size: 13px;
}

.tier-promo-accounting {
    font-size: 14px;
    font-weight: 600;
    color: var(--green);
    background: color-mix(in srgb, var(--green) 8%, var(--paper));
    border: 1px solid color-mix(in srgb, var(--green) 25%, transparent);
    border-radius: var(--radius);
    padding: 5px 10px;
    margin-bottom: 10px;
}

.tier-preview-features {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tier-feature-chip {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    background: color-mix(in srgb, var(--tier-color) 10%, white);
    color: color-mix(in srgb, var(--tier-color) 70%, black);
    border: 1px solid color-mix(in srgb, var(--tier-color) 25%, transparent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   AUTH PAGES — Sign In, Register, Forgot Password, Reset Password, etc.
   ═══════════════════════════════════════════════════════════════════════════ */

.auth-page {
    min-height: calc(100vh - var(--header-h, 0px));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    background: radial-gradient(ellipse 80% 60% at 20% 0%, color-mix(in srgb, var(--accent) 8%, transparent), transparent), radial-gradient(ellipse 60% 50% at 80% 100%, color-mix(in srgb, var(--accent) 6%, transparent), transparent), var(--paper-2);
}

.auth-card {
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 16px;
    padding: 44px 40px 36px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 8px 32px rgba(0,0,0,0.08), 0 32px 64px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

    /* Accent top bar */
    .auth-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--cyan, #06b6d4)));
        border-radius: 16px 16px 0 0;
    }

/* ── Brand ─────────────────────────────────────────────────────────────── */
.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}

.auth-brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--cyan, #06b6d4)));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    font-weight: 800;
    flex-shrink: 0;
    letter-spacing: -0.5px;
}

.auth-brand-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.auth-brand-sub {
    font-size: 11px;
    color: var(--ink-3);
    margin-top: 1px;
    letter-spacing: 0.02em;
}

/* ── Heading ────────────────────────────────────────────────────────────── */
.auth-card h2 {
    font-family: var(--font-serif);
    font-size: 26px;
    font-weight: 400;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
    color: var(--ink);
}

.auth-subtitle {
    font-size: 14px;
    color: var(--ink-3);
    margin-bottom: 24px;
    line-height: 1.5;
}

/* ── Form fields ────────────────────────────────────────────────────────── */
.auth-card .form-group {
    margin-bottom: 18px;
}

    .auth-card .form-group label {
        display: block;
        font-size: 13px;
        font-weight: 600;
        color: var(--ink-2);
        margin-bottom: 6px;
    }

.auth-card .form-control {
    height: 42px;
    font-size: 14px;
    border-radius: 8px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

    .auth-card .form-control:focus {
        border-color: var(--accent);
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
        outline: none;
    }

/* ── Submit button ──────────────────────────────────────────────────────── */
.btn-full {
    width: 100%;
    justify-content: center;
    height: 44px;
    font-size: 15px;
    border-radius: 10px;
    margin-top: 4px;
    font-weight: 700;
    letter-spacing: 0.01em;
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 75%, var(--cyan, #06b6d4)));
    box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 30%, transparent);
    transition: transform 0.1s, box-shadow 0.15s;
}

    .btn-full:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 35%, transparent);
    }

    .btn-full:active {
        transform: translateY(0);
    }

/* ── Remember me ────────────────────────────────────────────────────────── */
.auth-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--ink-3);
}

/* ── Footer links ───────────────────────────────────────────────────────── */
.auth-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--rule);
    font-size: 13px;
    flex-wrap: wrap;
}

    .auth-links a {
        color: var(--accent);
        font-weight: 600;
        text-decoration: none;
        transition: opacity 0.15s;
    }

        .auth-links a:hover {
            opacity: 0.75;
        }

    .auth-links span {
        color: var(--ink-3);
    }

/* ── Confirmation / info cards (centered layout) ────────────────────────── */
.auth-card-centered {
    text-align: center;
}

    .auth-card-centered .auth-brand {
        justify-content: center;
    }

.auth-confirm-icon {
    font-size: 48px;
    line-height: 1;
    margin-bottom: 12px;
}

.auth-confirm-title {
    font-family: var(--font-serif);
    font-size: 26px;
    font-weight: 400;
    margin-bottom: 8px;
    color: var(--ink);
}

.auth-confirm-body {
    font-size: 14px;
    color: var(--ink-3);
    line-height: 1.6;
    margin-bottom: 24px;
}

/* ── Validation / error messages ────────────────────────────────────────── */
.auth-card .validation-message {
    font-size: 12px;
    color: var(--red);
    margin-top: 4px;
}

.auth-card .form-error {
    background: color-mix(in srgb, var(--red) 8%, var(--paper));
    border: 1px solid color-mix(in srgb, var(--red) 25%, transparent);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--red);
    margin-top: 14px;
}

/* ── Password strength hint ─────────────────────────────────────────────── */
.auth-hint {
    font-size: 11px;
    color: var(--ink-3);
    margin-top: 4px;
    line-height: 1.4;
}
