/* ===== ProximityDating - Mobile-First CSS ===== */
/* Style inspired by Biennale della Prossimità */

/* Self-hosted fonts */
@font-face { font-family: 'Source Sans 3'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/sourcesans3-400.ttf') format('truetype'); }
@font-face { font-family: 'Source Sans 3'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/sourcesans3-600.ttf') format('truetype'); }
@font-face { font-family: 'Source Sans 3'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/sourcesans3-700.ttf') format('truetype'); }
@font-face { font-family: 'Source Sans 3'; font-style: normal; font-weight: 800; font-display: swap; src: url('/fonts/sourcesans3-800.ttf') format('truetype'); }
@font-face { font-family: 'Hind'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/hind-400.ttf') format('truetype'); }
@font-face { font-family: 'Hind'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/hind-500.ttf') format('truetype'); }
@font-face { font-family: 'Hind'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/hind-600.ttf') format('truetype'); }
@font-face { font-family: 'Hind'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/hind-700.ttf') format('truetype'); }

:root {
    --primary: #0c71c3;
    --primary-dark: #095a9c;
    --primary-light: #a8d4f5;
    --accent: #8dc63f;
    --accent-dark: #6ea030;
    --accent-light: #d4edb8;
    --orange: #f8ae43;
    --success: #8dc63f;
    --danger: #cf2e2e;
    --warning: #f8ae43;
    --gray-50: #f8f9fa;
    --gray-100: #f0f2f4;
    --gray-200: #e2e5e9;
    --gray-300: #cdd1d7;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,.05);
    --tab-height: 64px;
    --nav-height: 56px;
}

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

body {
    font-family: 'Hind', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    font-size: 17px;
}
h1, h2, h3, h4, h5, h6 {
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ===== Navbar ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--primary);
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(12,113,195,0.2);
}
.nav-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    font-weight: 800;
    font-size: 18px;
    color: #fff;
    font-family: 'Source Sans 3', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.brand-logo-shell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}
.brand-logo-shell--hero {
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}
.brand-logo-shell--admin {
    background: transparent;
    padding: 0;
}
.brand-logo {
    display: block;
    height: 40px;
    width: auto;
}
.brand-edition {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.7;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
    padding-left: 0;
    align-self: center;
    text-align: center;
}
.event-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}
.nav-user-wrap {
    position: relative;
}
.nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    user-select: none;
}
.nav-user-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 120px;
    z-index: 200;
    overflow: hidden;
}
.nav-user-menu button {
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    font-family: inherit;
}
.nav-user-menu button:hover {
    background: var(--gray-50);
}
.nav-user-menu button.danger {
    color: var(--danger);
}

/* ===== Tab Bar ===== */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--tab-height);
    background: white;
    border-top: 3px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    padding: 8px 4px;
    color: var(--gray-400);
    font-size: 11px;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: color .2s;
}
.tab-btn.active { color: var(--accent); }
.tab-btn svg { width: 22px; height: 22px; }

/* ===== Main Content ===== */
#main-content {
    padding-top: var(--nav-height);
    padding-bottom: var(--tab-height);
    min-height: 100dvh;
}
.page { padding: 16px; max-width: 600px; margin: 0 auto; }
.page-full { padding: 0; max-width: 100%; }

/* ===== Login Page ===== */
.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 24px;
    text-align: center;
    background: linear-gradient(135deg, var(--primary) 0%, #3174b7 50%, var(--accent) 100%);
    color: white;
}
.login-page .logo { margin-bottom: 16px; }
.login-brand-logo {
    display: block;
    width: min(90vw, 560px);
    height: auto;
}
.login-page h1 { font-size: 32px; margin-bottom: 8px; font-family: 'Source Sans 3', sans-serif; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }
.login-page .subtitle { font-size: 17px; opacity: .9; margin-bottom: 32px; font-weight: 500; }
.login-card {
    background: white;
    padding: 24px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 400px;
    color: var(--gray-800);
    box-shadow: var(--shadow-lg);
    border-top: 4px solid var(--accent);
}
.login-card h2 { font-size: 20px; margin-bottom: 16px; color: var(--primary); font-family: 'Source Sans 3', sans-serif; font-weight: 700; }

/* ===== Privacy Page ===== */
.privacy-page { padding: 24px; max-width: 600px; margin: 0 auto; }
.privacy-page h1 { font-size: 22px; margin-bottom: 16px; color: var(--gray-800); }
.privacy-content {
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    max-height: 50vh;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
    box-shadow: var(--shadow);
}
.privacy-content h3 { margin-top: 16px; margin-bottom: 8px; font-size: 15px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 6px;
}
.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: border-color .2s;
    outline: none;
    background: white;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(141,198,63,0.15); }
.form-input::placeholder { color: var(--gray-400); }
textarea.form-input { resize: vertical; min-height: 80px; }

.otp-input {
    text-align: center;
    font-size: 28px;
    letter-spacing: 12px;
    font-weight: 700;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    width: 100%;
}
.btn-primary { background: var(--accent); color: white; font-family: 'Source Sans 3', sans-serif; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; border-radius: 6px; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { background: var(--gray-300); cursor: not-allowed; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-outline {
    background: transparent;
    border: 2px solid var(--gray-300);
    color: var(--gray-600);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-accent { background: var(--primary); color: white; font-family: 'Source Sans 3', sans-serif; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; border-radius: 6px; }
.btn-accent:hover { background: var(--primary-dark); }
.btn-sm { padding: 8px 16px; font-size: 14px; }
.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 14px;
    cursor: pointer;
    text-decoration: underline;
    padding: 4px;
    width: auto;
}

.btn-row { display: flex; gap: 12px; }
.btn-row .btn { flex: 1; }

/* ===== Cards ===== */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-body { padding: 16px; }
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.card-subtitle { font-size: 13px; color: var(--gray-500); margin-bottom: 8px; }
.card-text { font-size: 14px; color: var(--gray-600); line-height: 1.5; }

/* ===== Tags / Chips ===== */
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: var(--gray-100);
    border-radius: 20px;
    font-size: 12px;
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: all .2s;
}
.tag.active, .tag.selected {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}
.tag:hover { border-color: var(--accent); }

/* ===== Swipe Cards ===== */
.swipe-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 500px;
    margin: 0 auto;
}
.swipe-card {
    position: absolute;
    width: 100%;
    height: 100%;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transition: transform .3s ease, opacity .3s ease;
    touch-action: none;
    cursor: grab;
}
.swipe-card:active { cursor: grabbing; }
.swipe-card .card-avatar {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80px;
    color: white;
    position: relative;
    overflow: hidden;
}
.swipe-card .card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.swipe-card .card-info { padding: 20px; }
.swipe-card .card-info h2 { font-size: 22px; margin-bottom: 4px; }
.swipe-card .card-info .org-name { color: var(--accent); font-size: 14px; font-weight: 700; margin-bottom: 8px; font-family: 'Source Sans 3', sans-serif; }
.swipe-card .card-info .role { color: var(--gray-500); font-size: 14px; margin-bottom: 12px; }
.swipe-card .card-info .bio { color: var(--gray-600); font-size: 14px; line-height: 1.5; }

.swipe-overlay {
    position: absolute;
    top: 20px;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 24px;
    font-weight: 900;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity .2s;
    pointer-events: none;
}
.swipe-overlay.like {
    right: 20px;
    color: var(--success);
    border: 4px solid var(--success);
}
.swipe-overlay.nope {
    left: 20px;
    color: var(--danger);
    border: 4px solid var(--danger);
}

.swipe-actions {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
}
.swipe-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: white;
    transition: transform .2s, box-shadow .2s;
}
.swipe-btn:hover { transform: scale(1.1); box-shadow: var(--shadow-lg); }
.swipe-btn.nope { border-color: var(--danger); color: var(--danger); }
.swipe-btn.like { border-color: var(--accent); color: var(--accent); }
.swipe-btn svg { width: 28px; height: 28px; }

.no-more-cards {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-400);
}
.no-more-cards svg { width: 80px; height: 80px; margin-bottom: 16px; opacity: .3; }

/* ===== Match Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 24px;
}
.modal {
    background: white;
    border-radius: var(--radius);
    width: 100%;
    max-width: 400px;
    padding: 32px 24px;
    text-align: center;
    animation: modalPop .3s ease;
}
@keyframes modalPop {
    from { transform: scale(.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.modal .match-icon { font-size: 64px; margin-bottom: 12px; }
.modal h2 { font-size: 24px; color: var(--accent); margin-bottom: 8px; font-family: 'Source Sans 3', sans-serif; }
.modal p { color: var(--gray-500); margin-bottom: 20px; }

/* ===== Chat ===== */
.chat-header {
    position: sticky;
    top: var(--nav-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 50;
}
.chat-header .back-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--gray-600);
}
.chat-messages {
    padding: 16px;
    padding-bottom: calc(60px + var(--tab-height));
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: calc(100dvh - var(--nav-height) - 60px - var(--tab-height));
    overflow-y: auto;
}
.msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
}
.msg.sent {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

/* ===== Profile Images ===== */
.profile-images { margin-bottom: 16px; }
.profile-images-card {
    position: relative;
}
.profile-upload-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.84);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 5;
}
.profile-upload-overlay .spinner {
    margin: 0;
}
.profile-upload-overlay-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    font-family: 'Source Sans 3', sans-serif;
}
.profile-images-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
}
.profile-img-slot {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    background: var(--gray-100);
    border: 2px dashed var(--gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color .2s;
}
.profile-img-slot:hover { border-color: var(--accent); }
.profile-img-slot.has-image { border-style: solid; border-color: transparent; }
.profile-img-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.profile-img-slot .remove-img {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s;
}
.profile-img-slot:hover .remove-img { opacity: 1; }
.profile-img-add {
    color: var(--gray-400);
    font-size: 28px;
    font-weight: 300;
}

/* Camera capture input styling */
.camera-input-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border-radius: 6px;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 14px;
    cursor: pointer;
    transition: background .2s;
}
.camera-input-label:hover { background: var(--primary-dark); }
.camera-input-label.is-disabled {
    opacity: 0.65;
    pointer-events: none;
    cursor: wait;
}
.camera-input-label svg { width: 18px; height: 18px; }
input.camera-input { display: none; }

/* ===== Privacy Modal Overlay ===== */
.privacy-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 250;
    padding: 16px;
}
.privacy-modal {
    background: white;
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: modalPop .3s ease;
    overflow: hidden;
}
.privacy-modal-header {
    padding: 20px 24px 12px;
    border-bottom: 1px solid var(--gray-200);
}
.privacy-modal-header h2 {
    font-size: 20px;
    color: var(--primary);
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 700;
}
.privacy-modal-body {
    padding: 16px 24px;
    overflow-y: auto;
    flex: 1;
    font-size: 14px;
    line-height: 1.6;
}
.privacy-modal-body h3 { margin-top: 14px; margin-bottom: 6px; font-size: 15px; color: var(--primary); }
.privacy-modal-footer {
    padding: 12px 24px 20px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 12px;
}
.privacy-modal-footer .btn { flex: 1; }
.msg.received {
    align-self: flex-start;
    background: var(--gray-100);
    color: var(--gray-800);
    border-bottom-left-radius: 4px;
}
.msg .msg-time {
    font-size: 11px;
    opacity: .6;
    margin-top: 4px;
}
.chat-input-area {
    position: fixed;
    bottom: var(--tab-height);
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--gray-200);
    padding: 8px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 60;
}
.chat-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.chat-input-area input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 24px;
    font-size: 15px;
    outline: none;
}
.chat-input-area input:focus { border-color: var(--accent); }
.chat-input-row button {
    padding: 10px 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 24px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Source Sans 3', sans-serif;
}
.chat-reply-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(12, 113, 195, 0.08);
    border-left: 3px solid var(--primary);
}
.chat-reply-copy {
    flex: 1;
    min-width: 0;
}
.chat-reply-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 3px;
}
.chat-reply-preview {
    font-size: 13px;
    color: var(--gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-reply-cancel {
    border: none;
    background: transparent;
    color: var(--gray-500);
    font-size: 16px;
    line-height: 1;
    padding: 2px;
    cursor: pointer;
}

/* Chat search bar */
.chat-search-bar {
    display: flex;
    gap: 8px;
    padding: 8px 16px;
    background: white;
    border-bottom: 1px solid var(--gray-200);
}
.chat-search-bar.hidden { display: none; }

/* Message status checks (WhatsApp style) */
.msg-status {
    font-size: 12px;
    margin-left: 4px;
    font-weight: 700;
    letter-spacing: -1px;
}
.msg-status.sent { color: rgba(255,255,255,0.5); }
.msg-status.delivered { color: rgba(255,255,255,0.7); }
.msg-status.read { color: #34b7f1; }
.msg.received .msg-status { display: none; }

/* Message highlight for search */
.msg.msg-highlight {
    box-shadow: 0 0 0 2px var(--accent);
}
.msg.msg-focus {
    box-shadow: 0 0 0 2px rgba(12, 113, 195, 0.35), 0 10px 26px rgba(12, 113, 195, 0.18);
    animation: msg-focus-pulse 1.4s ease;
}
.msg-body {
    white-space: pre-line;
}
.msg-reply-ref {
    display: block;
    width: 100%;
    border: none;
    text-align: left;
    margin: 0 0 8px;
    padding: 8px 10px;
    border-radius: 12px;
    border-left: 3px solid rgba(12, 113, 195, 0.35);
    background: rgba(12, 113, 195, 0.08);
    cursor: pointer;
}
.msg.sent .msg-reply-ref {
    background: rgba(255,255,255,0.12);
    border-left-color: rgba(255,255,255,0.45);
    color: white;
}
.msg-reply-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.78;
}
.msg-reply-body {
    display: block;
    font-size: 12px;
    line-height: 1.35;
    opacity: 0.9;
}

@keyframes msg-focus-pulse {
    0% { transform: scale(1); }
    35% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Message detail popup */
.msg {
    position: relative;
    cursor: pointer;
}
.msg-detail-popup {
    position: absolute;
    bottom: 100%;
    background: var(--gray-800);
    color: white;
    font-size: 11px;
    line-height: 1.6;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 4px;
    z-index: 10;
    box-shadow: var(--shadow-lg);
    white-space: nowrap;
    width: max-content;
}
.msg.received .msg-detail-popup { left: 0; }
.msg.sent .msg-detail-popup { right: 0; }

/* ===== Matches List ===== */
.match-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background .2s;
}
.match-item:hover { background: var(--gray-50); }
.match-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-dark);
    flex-shrink: 0;
    overflow: hidden;
}
.match-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.match-avatar.has-img,
.person-mini-avatar.has-img,
.card-avatar.has-img,
.org-logo.has-img { background: var(--gray-100); }
.match-info { flex: 1; min-width: 0; }
.match-info .name { font-weight: 600; font-size: 15px; }
.match-info .org { font-size: 13px; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Match type & unread badges */
.match-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    flex-shrink: 0;
}
.match-type-badge.mutual { background: var(--accent-light); color: var(--accent-dark); }
.match-type-badge.request { background: #e0e7ff; color: #3730a3; }
.unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}
.last-msg {
    font-size: 12px;
    color: var(--gray-400);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    margin-top: 2px;
}
.match-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

/* Match request section */
.match-request-section h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-600);
    padding: 12px 16px 4px;
    font-family: 'Source Sans 3', sans-serif;
}
.match-request-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}
.btn-accept-match, .btn-decline-match {
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: transform .1s, opacity .15s;
}
.btn-accept-match { background: var(--accent); color: white; }
.btn-accept-match:active { transform: scale(0.95); }
.btn-decline-match { background: var(--gray-200); color: var(--gray-600); }
.btn-decline-match:active { transform: scale(0.95); }

/* Chat header with avatar */
.chat-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--primary-dark);
    flex-shrink: 0;
    overflow: hidden;
    cursor: pointer;
}
.chat-header-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-header-name {
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    color: var(--primary);
}
.chat-header-name:hover { text-decoration: underline; }

/* Chat accept bar */
.chat-accept-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 14px 16px;
    background: #fefce8;
    border-bottom: 1px solid #fde68a;
    font-size: 14px;
}
.chat-accept-bar .btn-accept-match,
.chat-accept-bar .btn-decline-match { padding: 8px 20px; font-size: 13px; }

/* Chat pending bar (requester waiting for response) */
.chat-pending-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 16px;
    background: #f0f4ff;
    border-bottom: 1px solid #c7d2fe;
    font-size: 14px;
    color: var(--gray-600);
}

/* Pending sent item in matches list */
.match-pending-sent {
    opacity: 0.8;
}

/* Swipe hints & feedback */
.swipe-hint {
    text-align: center;
    font-size: 13px;
    color: var(--gray-400);
    padding: 8px 0 4px;
    letter-spacing: 0.3px;
}
.swipe-feedback {
    text-align: center;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .4s ease;
}
.swipe-fb {
    font-size: 18px;
    font-weight: 800;
    padding: 4px 20px;
    border-radius: 20px;
    animation: swipeFbPop .3s ease;
}
.swipe-fb.like { color: var(--accent-dark); background: var(--accent-light); }
.swipe-fb.nope { color: var(--danger); background: #fde2e2; }
@keyframes swipeFbPop {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

/* Tab bar unread badge */
.tab-btn { position: relative; }
.tab-badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 20px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ===== Browse / Filter ===== */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 0;
    -webkit-overflow-scrolling: touch;
}
.people-filter-panel {
    margin-bottom: 2px;
}
.filter-bar--collapsible {
    overflow: hidden;
    max-height: none;
    transition: max-height .2s ease;
}
.filter-bar--collapsible.is-collapsed {
    max-height: var(--filter-collapsed-height, 46px);
}
.filter-bar::-webkit-scrollbar { display: none; }
.filter-chip {
    white-space: normal;
    padding: 7px 14px;
    border-radius: 18px;
    background: white;
    border: 1px solid var(--gray-300);
    font-size: 12px;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: all .15s;
    flex: 0 1 auto;
    max-width: 100%;
}
.filter-toggle {
    padding: 2px 0 0;
    margin-top: 4px;
    text-decoration: none;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.filter-toggle::after {
    content: '▾';
    font-size: 12px;
    transition: transform .2s ease;
}
.filter-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
}
.filter-chip.active { background: var(--accent); color: white; border-color: var(--accent); }

.org-list { display: flex; flex-direction: column; gap: 12px; }
.org-card { cursor: pointer; transition: transform .15s; }
.org-card:hover { transform: translateY(-2px); }
.org-card .card-body { display: flex; gap: 12px; }
.org-card .org-logo,
.org-card-expandable .org-logo {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}
.org-card .org-logo img,
.org-card-expandable .org-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.org-logo--default {
    background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
}
.org-logo--promotori_nazionali {
    background: linear-gradient(135deg, #f59e0b, #f97316);
}
.org-logo--comitato_locale {
    background: linear-gradient(135deg, #0c71c3, #0ea5e9);
}
.org-logo--comunita_pratiche {
    background: linear-gradient(135deg, #178b6a, #22c55e);
}
.org-logo--large {
    width: 64px;
    height: 64px;
}
.org-logo-symbol {
    color: white;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.org-logo-badge {
    position: absolute;
    right: -4px;
    bottom: -4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: white;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.org-logo-badge--promotori_nazionali {
    background: #f59e0b;
}
.org-logo-badge--comitato_locale {
    background: #0c71c3;
}
.org-logo-badge--comunita_pratiche {
    background: #178b6a;
}
.org-card .org-info { flex: 1; }
.org-area-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}
.org-area-badges--compact {
    margin: 6px 0;
}
.org-area-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.org-area-legend--map {
    margin-top: 12px;
}
.org-area-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid transparent;
    line-height: 1;
}
.org-area-badge-symbol {
    font-size: 12px;
}
.org-area-badge--promotori_nazionali {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.24);
}
.org-area-badge--comitato_locale {
    background: rgba(12, 113, 195, 0.1);
    color: #0b5ea0;
    border-color: rgba(12, 113, 195, 0.22);
}
.org-area-badge--comunita_pratiche {
    background: rgba(23, 139, 106, 0.1);
    color: #12735a;
    border-color: rgba(23, 139, 106, 0.22);
}

/* ===== Section Headers ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    margin-top: 20px;
}
.section-header h2 { font-size: 18px; color: var(--primary); font-family: 'Source Sans 3', sans-serif; font-weight: 700; }
.section-header:first-child { margin-top: 0; }
.section-header--after-filters { margin-top: 10px; }

/* ===== Tabs ===== */
.tabs-scroll-wrap {
    position: relative;
    margin-bottom: 16px;
    overflow: hidden;
}
.tabs-scroll-wrap::before,
.tabs-scroll-wrap::after {
    position: absolute;
    top: 3px;
    bottom: 3px;
    width: 28px;
    display: flex;
    align-items: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s ease;
    z-index: 1;
    font-size: 16px;
    font-weight: 700;
    color: rgba(12, 113, 195, 0.72);
}
.tabs-scroll-wrap::before {
    content: '‹';
    left: 0;
    justify-content: flex-start;
    padding-left: 6px;
    background: linear-gradient(90deg, rgba(244, 246, 248, 0.98) 35%, rgba(244, 246, 248, 0));
}
.tabs-scroll-wrap::after {
    content: '›';
    right: 0;
    justify-content: flex-end;
    padding-right: 6px;
    background: linear-gradient(270deg, rgba(244, 246, 248, 0.98) 35%, rgba(244, 246, 248, 0));
}
.tabs-scroll-wrap.is-scrollable-left::before { opacity: 1; }
.tabs-scroll-wrap.is-scrollable-right::after { opacity: 1; }
.tabs {
    display: flex;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    padding: 3px;
    margin-bottom: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    flex: 1 0 auto;
    padding: 8px 12px;
    text-align: center;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: var(--gray-500);
    transition: all .2s;
    background: transparent;
    border: none;
}
.tab.active { background: white; color: var(--gray-800); box-shadow: var(--shadow); }

/* ===== Loading & Toast ===== */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
    margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
    position: fixed;
    bottom: calc(var(--tab-height) + 16px);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--gray-800);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    z-index: 300;
    transition: transform .3s ease;
    white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ===== Utility ===== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }

/* ===== Responsive ===== */
@media (min-width: 768px) {
    .swipe-container { height: 560px; }
    .login-card { padding: 32px; }
    .profile-images-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 480px) {
    .tabs-scroll-wrap::before,
    .tabs-scroll-wrap::after {
        width: 24px;
        font-size: 14px;
    }
    .tabs { gap: 2px; }
    .tab { padding: 8px 8px; font-size: 13px; min-width: 0; }
    .filter-bar { padding: 6px 0; gap: 6px; }
    .filter-chip { padding: 5px 10px; font-size: 11px; }
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 40px 24px;
}
.empty-state h3 {
    font-size: 18px;
    color: var(--gray-700);
    font-family: 'Source Sans 3', sans-serif;
}
.empty-state-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}
.empty-state-actions .btn {
    min-width: 200px;
}

/* ===== Expandable Org Cards ===== */
.org-card-expandable { cursor: pointer; transition: transform .15s; }
.org-card-expandable:hover { transform: translateY(-2px); }
.org-card-expandable .card-body.org-card-header { display: flex; gap: 12px; align-items: flex-start; }
.org-card-expandable .org-info { flex: 1; }
.expand-icon {
    font-size: 18px;
    color: var(--gray-400);
    flex-shrink: 0;
    transition: transform .2s;
    line-height: 1;
    margin-top: 4px;
}
.org-card-detail {
    padding: 0 16px 16px;
    border-top: 1px solid var(--gray-100);
    margin-top: 8px;
    padding-top: 12px;
}

/* ===== Person Cards ===== */
.person-card { transition: transform .15s; }
.person-card:hover { transform: translateY(-2px); }

/* ===== Browse Map ===== */
.browse-map {
    width: 100%;
    height: 350px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    z-index: 1;
}
@media (min-width: 768px) {
    .browse-map { height: 450px; }
}
.map-list-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.map-org-icon .org-pin {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    box-shadow: 0 2px 6px rgba(0,0,0,.3);
    border: 2px solid white;
}
.map-org-icon .org-pin--default {
    background: var(--primary);
}
.map-org-icon .org-pin--promotori_nazionali {
    background: linear-gradient(135deg, #f59e0b, #f97316);
}
.map-org-icon .org-pin--comitato_locale {
    background: linear-gradient(135deg, #0c71c3, #0ea5e9);
}
.map-org-icon .org-pin--comunita_pratiche {
    background: linear-gradient(135deg, #178b6a, #22c55e);
}
.map-venue-icon .venue-pin {
    font-size: 24px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.3));
}
/* Override leaflet draw toolbar text for Italian */
.leaflet-draw-toolbar a { font-size: 0; }
.leaflet-draw-draw-polygon::after, .leaflet-draw-draw-rectangle::after, .leaflet-draw-draw-circle::after { font-size: 12px; }
/* Make draw controls more touch-friendly on mobile */
@media (max-width: 480px) {
    .leaflet-draw-toolbar a { width: 36px; height: 36px; line-height: 36px; }
    .browse-map { height: 300px; }
}

.person-mini {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
}
.person-mini:last-child { border-bottom: none; }
.person-mini-clickable {
    cursor: pointer;
    border-radius: 10px;
    padding: 10px;
    margin: 0 -10px;
    transition: background-color .2s ease, transform .2s ease;
}
.person-mini-clickable:hover {
    background: rgba(12, 113, 195, 0.06);
    transform: translateX(2px);
}
.person-mini-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    flex-shrink: 0;
    overflow: hidden;
}
.person-mini-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== Browse Search ===== */
.browse-search .form-input {
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
}
.browse-privacy-note {
    margin: 12px 0 18px;
    padding: 14px 16px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(12, 113, 195, 0.08), rgba(23, 139, 106, 0.08));
    border: 1px solid rgba(12, 113, 195, 0.16);
}
.browse-privacy-note strong {
    display: block;
    margin-bottom: 6px;
    color: var(--primary-dark);
}
.browse-privacy-note p {
    margin: 0 0 10px;
    font-size: 14px;
    color: var(--gray-600);
}

/* ===== Toggle Switch ===== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--gray-300);
    border-radius: 26px;
    transition: background .25s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform .25s;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

/* ===== Chat Person Buttons ===== */
.btn-chat-person {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 20px;
    border: 1px solid var(--primary);
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.btn-chat-person:hover { background: var(--primary); color: white; }
.btn-chat-person:disabled { opacity: .6; cursor: default; }
.btn-chat-person.sent { border-color: var(--accent); color: var(--accent); }

.btn-chat-mini {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--primary);
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all .2s;
}
.btn-chat-mini:hover { background: var(--primary); color: white; }

/* ===== Admin Styles ===== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}
.admin-sidebar {
    width: 240px;
    background: var(--primary);
    color: white;
    padding: 0;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}
.admin-sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 20px;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 800;
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}
.admin-brand-logo {
    display: block;
    width: min(100%, 220px);
    height: auto;
}
.admin-sidebar-brand small {
    display: block;
    font-size: 11px;
    font-weight: 600;
    opacity: 0.7;
    text-transform: none;
    letter-spacing: 0;
    margin-top: 2px;
}
.admin-nav { list-style: none; padding: 12px 0; }
.admin-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all .2s;
    font-family: 'Source Sans 3', sans-serif;
}
.admin-nav a:hover, .admin-nav a.active {
    background: rgba(255,255,255,0.12);
    color: white;
}
.admin-nav a.active { border-left: 3px solid var(--accent); }
.admin-main {
    flex: 1;
    margin-left: 240px;
    padding: 24px 32px;
    background: var(--gray-50);
}
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.admin-header h1 {
    font-size: 24px;
    color: var(--primary);
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 800;
}
.admin-search {
    margin-bottom: 16px;
}
.admin-search .form-input {
    width: 100%;
    max-width: 420px;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
}
.admin-search .form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(141, 198, 63, 0.15);
}
.admin-chat-shell {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 68vh;
}
.admin-chat-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    background: linear-gradient(180deg, rgba(12,113,195,0.05), rgba(12,113,195,0));
}
.admin-chat-messages {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    background: #f8fafc;
    min-height: 360px;
}
.admin-chat-composer {
    padding: 16px 20px;
    border-top: 1px solid var(--gray-200);
    background: white;
}
.admin-chat-composer .form-input {
    width: 100%;
}
.admin-chat-empty {
    margin: auto 0;
    text-align: center;
    color: var(--gray-500);
    font-size: 14px;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.admin-table th, .admin-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
    font-size: 14px;
}
.admin-table th {
    background: var(--gray-50);
    font-weight: 700;
    font-family: 'Source Sans 3', sans-serif;
    color: var(--gray-600);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.admin-table tr:hover td { background: var(--gray-50); }
.admin-table .actions {
    display: flex;
    gap: 8px;
}
.admin-table .actions button {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid;
    background: transparent;
    font-weight: 600;
}
.admin-table .actions .btn-edit { border-color: var(--primary); color: var(--primary); }
.admin-table .actions .btn-edit:hover { background: var(--primary); color: white; }
.admin-table .actions .btn-del { border-color: var(--danger); color: var(--danger); }
.admin-table .actions .btn-del:hover { background: var(--danger); color: white; }

.admin-form {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    max-width: 700px;
}
.admin-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.admin-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
}
.admin-badge-green { background: var(--accent-light); color: var(--accent-dark); }
.admin-badge-red { background: #fde2e2; color: var(--danger); }
.admin-badge-blue { background: var(--primary-light); color: var(--primary-dark); }

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.admin-stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--accent);
}
.admin-stat-card .stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    font-family: 'Source Sans 3', sans-serif;
}
.admin-stat-card .stat-label {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 4px;
}

@media (max-width: 768px) {
    .admin-sidebar {
        position: fixed;
        width: 100%;
        height: auto;
        bottom: auto;
        top: 0;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        padding: 0;
        gap: 0;
        z-index: 200;
    }
    .admin-sidebar-brand {
        padding: 10px 14px;
        font-size: 14px;
        flex-shrink: 0;
        border-bottom: none;
        flex: 1;
        gap: 6px;
    }
    .admin-sidebar-brand small { display: none; }
    .admin-brand-logo { width: min(100%, 142px); }
    .admin-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: none;
        border: none;
        color: white;
        font-size: 22px;
        cursor: pointer;
        margin-right: 4px;
    }
    .admin-nav {
        display: none;
        width: 100%;
        padding: 0 0 8px;
        background: var(--primary-dark);
        flex-direction: column;
    }
    .admin-nav.open { display: flex; }
    .admin-nav li { width: 100%; }
    .admin-nav a {
        padding: 12px 20px;
        font-size: 14px;
        white-space: normal;
        gap: 10px;
        border-left: 3px solid transparent;
    }
    .admin-nav a .nav-icon { font-size: 16px; }
    .admin-nav a.active { border-left: 3px solid var(--accent); border-bottom: none; background: rgba(255,255,255,0.12); }
    .admin-main { margin-left: 0; margin-top: 48px; padding: 12px; }
    .admin-header { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 16px; }
    .admin-header h1 { font-size: 18px; }
    .admin-search .form-input { max-width: 100%; }
    .admin-form .form-row { grid-template-columns: 1fr; }
    .admin-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
    .admin-stat-card { padding: 12px; }
    .admin-stat-card .stat-value { font-size: 22px; }

    /* Responsive table wrapper */
    .admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -12px; padding: 0 12px; }
    .admin-table { font-size: 12px; min-width: 500px; }
    .admin-table th, .admin-table td { padding: 8px 10px; }
    .admin-table .actions { flex-direction: column; gap: 4px; }
    .admin-table .actions button { padding: 4px 8px; font-size: 11px; }

    /* Hide table on mobile, show cards instead */
    .admin-table-wrap { display: none; }
    .admin-cards { display: flex !important; }
}

/* Hide hamburger on desktop, show on mobile */
.admin-menu-toggle { display: none; }
@media (max-width: 768px) {
    .admin-menu-toggle { display: flex !important; }
}

/* Admin card list (mobile-friendly alternative to tables) */
.admin-cards {
    display: none;
    flex-direction: column;
    gap: 10px;
}
.admin-card-item {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.admin-card-item .ac-header {
    display: flex;
    align-items: center;
    gap: 10px;
}
.admin-card-item .ac-avatar {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    font-size: 18px;
}
.admin-card-item .ac-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.admin-card-item .ac-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--primary);
    flex: 1;
    min-width: 0;
    word-break: break-word;
}
.admin-card-item .ac-subtitle {
    font-size: 12px;
    color: var(--gray-500);
}
.admin-card-item .ac-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.admin-card-item .ac-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    border-top: 1px solid var(--gray-100);
    padding-top: 8px;
    margin-top: 2px;
}
.admin-card-item .ac-actions button {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid;
    background: transparent;
    font-weight: 600;
    flex: 1;
    min-width: 0;
}

.analytics-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin: 18px 0 22px;
}
.analytics-summary-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border-radius: 18px;
    background: white;
    box-shadow: var(--shadow);
}
.analytics-summary-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
}
.analytics-summary-label {
    font-size: 12px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.analytics-toolbar {
    display: flex;
    gap: 12px;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.analytics-control {
    min-width: 160px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.analytics-control label,
.analytics-checkbox {
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.analytics-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 10px;
}
.analytics-caption {
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--gray-500);
}
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.analytics-grid-bottom {
    margin-top: 16px;
}
.analytics-panel {
    background: white;
    border-radius: 22px;
    box-shadow: var(--shadow);
    padding: 18px;
    overflow: hidden;
}
.analytics-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 12px;
}
.analytics-panel-head h3 {
    margin: 0;
    font-size: 16px;
}
.analytics-panel-subtitle {
    font-size: 12px;
    color: var(--gray-500);
}
.analytics-map,
.analytics-graph {
    width: 100%;
    height: 420px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(12, 113, 195, 0.04), rgba(255, 255, 255, 0.96));
}
.analytics-top-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.analytics-top-item {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--gray-50);
}
.analytics-top-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(12, 113, 195, 0.12);
    color: var(--primary);
    font-weight: 800;
}
.analytics-top-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.analytics-top-copy span {
    font-size: 12px;
    color: var(--gray-500);
}
.analytics-top-value {
    font-weight: 800;
    color: var(--primary);
}
.analytics-selection {
    min-height: 140px;
    padding: 14px;
    border-radius: 16px;
    background: var(--gray-50);
    font-size: 14px;
    color: var(--gray-700);
}

@media (max-width: 900px) {
    .analytics-grid {
        grid-template-columns: 1fr;
    }
    .analytics-map,
    .analytics-graph {
        height: 340px;
    }
}
@media (max-width: 640px) {
    .analytics-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .analytics-control {
        min-width: 0;
    }
}

/* ===== PWA Install Banner ===== */
#pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    font-size: 14px;
    z-index: 10000;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.2);
}
#pwa-install-banner span { flex: 1; }
#pwa-install-btn {
    background: #fff;
    color: var(--primary);
    border: none;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
    font-size: 14px;
}
#pwa-dismiss-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

/* ===== Venues & Rooms (admin) ===== */
.admin-venues { display: flex; flex-direction: column; gap: 16px; margin-top: 12px; }
.venue-card .rooms-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.room-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
    padding: 10px 12px; border: 1px solid #e5e7eb; border-radius: 8px; background: #fafafa; }
.room-row.room-conflict { background: #fef2f2; border-color: #fecaca; }
.room-row .room-main { flex: 1; min-width: 0; }
.room-row .room-title { font-weight: 600; }
.room-row .room-meta { font-size: 13px; color: #555; margin-top: 2px; }
.room-row .room-conflict-msg { color: #b91c1c; font-size: 12px; margin-top: 4px; }
.room-row .room-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }
.venue-footer { margin-top: 10px; }
.admin-empty { color: #888; padding: 12px; font-style: italic; }
.admin-empty-sm { color: #888; font-size: 13px; padding: 6px 0; }

/* Action buttons inside venue cards / room rows: match admin-table .actions */
.venue-card .ac-header > div:last-child,
.room-row .room-actions {
    display: flex; gap: 6px; flex-wrap: wrap;
}
.venue-card .ac-header .btn-edit,
.venue-card .ac-header .btn-del,
.room-row .room-actions .btn-edit,
.room-row .room-actions .btn-del {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid;
    background: transparent;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}
.venue-card .ac-header .btn-edit,
.room-row .room-actions .btn-edit { border-color: var(--primary); color: var(--primary); }
.venue-card .ac-header .btn-edit:hover,
.room-row .room-actions .btn-edit:hover { background: var(--primary); color: #fff; }
.venue-card .ac-header .btn-del,
.room-row .room-actions .btn-del { border-color: var(--danger); color: var(--danger); }
.venue-card .ac-header .btn-del:hover,
.room-row .room-actions .btn-del:hover { background: var(--danger); color: #fff; }

/* ===== User-side program ===== */
.rooms-page { padding: 0 0 18px; background: #f6f8f3; }
.program-hero {
    background: #0c71c3;
    color: #fff;
    padding: 22px 16px 18px;
    display: grid;
    gap: 14px;
}
.program-kicker {
    color: #d4edb8;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
}
.program-hero h2 {
    margin: 0;
    font-size: 31px;
    line-height: 1;
    color: #fff;
}
.program-subtitle { font-size: 15px; color: rgba(255,255,255,0.88); margin-top: 4px; }
.program-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.program-counts span {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.22);
    border-radius: 8px;
    padding: 8px;
    font-size: 12px;
    line-height: 1.15;
}
.program-counts strong { display: block; font-size: 20px; line-height: 1; }
.program-days {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: var(--nav-height);
    z-index: 20;
}
.program-day-pill {
    flex: 0 0 auto;
    min-width: 116px;
    padding: 9px 10px;
    border-radius: 8px;
    background: #f8ae43;
    color: #1f2937;
    text-decoration: none;
    box-shadow: 0 1px 0 rgba(0,0,0,0.08);
}
.program-day-pill span { display: block; font-size: 12px; text-transform: capitalize; }
.program-day-pill strong { display: block; font-size: 17px; line-height: 1.1; }
.program-timeline { padding: 14px 16px 22px; }
.program-day-section { margin-bottom: 22px; }
.program-day-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 10px;
    padding-bottom: 8px;
    border-bottom: 3px solid #8dc63f;
}
.program-day-heading span {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 24px;
    line-height: 1;
    font-weight: 800;
    text-transform: capitalize;
    color: #0c71c3;
}
.program-day-heading strong { color: var(--gray-600); font-size: 14px; }
.program-session {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 10px;
    background: #fff;
    border: 1px solid #dfe5dc;
    border-left: 5px solid #0c71c3;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.program-session.is-booked { border-left-color: #8dc63f; background: #f7fcf1; }
.program-session.is-full { opacity: 0.66; }
.program-time {
    color: #0c71c3;
    font-family: 'Source Sans 3', sans-serif;
    line-height: 1.1;
    border-right: 1px solid var(--gray-200);
    padding-right: 9px;
}
.program-time strong { display: block; font-size: 20px; }
.program-time span { display: block; margin-top: 3px; color: var(--gray-500); font-size: 13px; }
.program-body { min-width: 0; }
.program-place {
    color: #6ea030;
    font-weight: 800;
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 3px;
}
.program-body h3 {
    margin: 0;
    color: var(--gray-900);
    font-size: 18px;
    line-height: 1.15;
}
.program-body p {
    color: var(--gray-600);
    font-size: 14px;
    line-height: 1.35;
    margin: 7px 0 0;
}
.program-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 9px;
}
.program-meta span,
.program-alert {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #eef5fb;
    color: #095a9c;
    font-size: 12px;
    font-weight: 700;
}
.program-alert { background: #fff4e3; color: #9a5a05; vertical-align: middle; }
.program-action {
    grid-column: 2;
    display: flex;
    justify-content: flex-end;
    margin-top: 2px;
}
.program-action .btn { min-width: 92px; }

@media (min-width: 760px) {
    .program-hero { grid-template-columns: minmax(0, 1fr) 360px; align-items: end; padding: 30px 28px 24px; }
    .program-timeline { padding: 18px 28px 28px; max-width: 1040px; margin: 0 auto; }
    .program-days { padding-left: max(28px, calc((100vw - 1040px) / 2)); padding-right: max(28px, calc((100vw - 1040px) / 2)); }
    .program-session { grid-template-columns: 92px minmax(0, 1fr) auto; align-items: start; }
    .program-action { grid-column: auto; margin-top: 0; }
}

.notif-bell { position: relative; cursor: pointer; }
.notif-bell .nb-count { position: absolute; top: -4px; right: -8px; background: #dc2626; color: #fff;
    border-radius: 999px; font-size: 10px; padding: 1px 5px; font-weight: 700; }
.notif-list { padding: 16px; }
.notif-item { background: #fff; border-radius: 10px; padding: 12px; margin-bottom: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05); border-left: 3px solid #2563eb; }
.notif-item.unread { border-left-color: #dc2626; background: #fff7ed; }
.notif-item.notif-item--action { cursor: pointer; transition: transform .2s ease, box-shadow .2s ease, border-left-color .2s ease; }
.notif-item.notif-item--action:hover { transform: translateX(2px); box-shadow: 0 6px 18px rgba(12,113,195,0.12); border-left-color: var(--primary); }
.notif-item .nt-title { font-weight: 600; margin-bottom: 4px; }
.notif-item .nt-body { white-space: pre-line; font-size: 13px; color: #444; }
.notif-item .nt-time { font-size: 11px; color: #888; margin-top: 4px; }
