/* ═══════════════════════════════════════════════════════════
   Rotary Fellowship App — Design System v3.0
   Ponster-inspired · Dual-rail Sidebar · Poppins · Green palette
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800;900&display=swap');

/* ── Variables ──────────────────────────────────────────── */
:root {
    /* Rotary brand (kept for badges, alerts) */
    --primary:        #17458F;
    --primary-dark:   #0d2d5e;
    --gold:           #F7A81B;
    --gold-dark:      #d4880e;
    --gold-light:     #fff8e6;

    /* Sidebar green palette */
    --rail-bg:          var(--primary-dark);   /* club's dark color (collapsed state) */
    --rail-width:       62px;      /* collapsed width */

    /* Sidebar states */
    --sb-expanded-bg:       #F3FAF6;   /* light mint panel — Ponster style */
    --sb-expanded-border:   #DCE9E1;
    --sb-collapsed-bg:      var(--primary-dark);   /* club's registered dark color */

    /* Nav item colours — expanded */
    --sb-text:          #374151;
    --sb-text-dark:     #111827;
    --sb-label-color:   #4E6A5E;   /* visible section labels */
    --sb-hover-bg:      rgba(0,0,0,0.05);
    --sb-hover-color:   var(--primary);
    --sb-active-bg:     var(--primary);   /* uses club's registered color */
    --sb-active-color:  #FFFFFF;

    /* Nav item colours — collapsed (dark sidebar) */
    --sb-c-icon:        rgba(255,255,255,0.78);
    --sb-c-icon-hover:  #FFFFFF;
    --sb-c-icon-active: #FFFFFF;
    --sb-c-hover-bg:    rgba(255,255,255,0.12);
    --sb-c-active-bg:   rgba(255,255,255,0.20);

    /* Sidebar widths */
    --sidebar-expanded:  260px;
    --sidebar-collapsed: 78px;

    /* Top bar */
    --topbar-height: 62px;

    /* Content offset */
    --content-offset:          var(--sidebar-collapsed);
    --content-offset-expanded: var(--sidebar-expanded);

    /* Surface & text */
    --bg:       #F4F6F5;
    --card-bg:  #FFFFFF;
    --border:   #E8EDE9;
    --text:     #111827;
    --sub:      #6B7280;
    --muted:    #9CA3AF;

    /* Semantic colours */
    --success:        #16a34a;
    --success-light:  #dcfce7;
    --danger:         #dc2626;
    --danger-light:   #fee2e2;
    --warning:        #d97706;
    --warning-light:  #fef3c7;
    --info:           #2563eb;
    --info-light:     #dbeafe;

    /* Motion */
    --ease:        cubic-bezier(.4,0,.2,1);
    --ease-spring: cubic-bezier(.26,1.6,.4,1);
    --dur:         .24s;
}

/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }

/* ═══════════════════════════════════════════════════════════
   APP SHELL
   ═══════════════════════════════════════════════════════════ */

.app-layout {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    min-width: 0;
    margin-left: var(--content-offset-expanded);
    transition: margin-left var(--dur) var(--ease);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}
.main-content.sidebar-collapsed {
    margin-left: var(--content-offset);
}
/* Sibling-selector fallback: reflects the sidebar's .collapsed state the
   instant it's set, before JS gets a chance to also toggle .sidebar-collapsed
   on .main-content (which — since sidebar.php's <script> runs before
   .main-content exists in the DOM — used to arrive a frame late via
   DOMContentLoaded and cause a visible layout jump on load). */
.app-sidebar.collapsed + .main-content {
    margin-left: var(--content-offset);
}
.app-sidebar.collapsed + .main-content .topbar-expand-btn {
    display: flex;
}

.page-body {
    padding: 24px 28px 48px;
    animation: fadeSlideUp .3s var(--ease) both;
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR — single panel, morphs white ↔ dark-green
   Expanded  = white bg, icons + text labels
   Collapsed = dark forest-green bg, icons only (centred)
   ═══════════════════════════════════════════════════════════ */

.app-sidebar.no-transition,
.app-sidebar.no-transition * { transition: none !important; }

/* ── Shell ── */
.app-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-expanded);       /* 240px */
    background: var(--sb-expanded-bg);    /* #fff   */
    border-right: 1.5px solid var(--sb-expanded-border);
    display: flex;
    flex-direction: column;
    z-index: 300;
    overflow: hidden;
    transition:
        width        .28s cubic-bezier(.4,0,.2,1),
        background   .28s ease,
        border-color .28s ease,
        box-shadow   .28s ease;
}

/* Collapsed: narrows + turns dark green */
.app-sidebar.collapsed {
    width: var(--sidebar-collapsed);      /* 62px */
    background: var(--sb-collapsed-bg);   /* #1A3A2E */
    border-right-color: transparent;
    box-shadow: 3px 0 18px rgba(0,0,0,.14);
}

/* ── Header: logo + brand + collapse pin ── */
.sb-header {
    height: 70px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    flex-shrink: 0;
    border-bottom: 1px solid #D0E5D8;
    overflow: hidden;
    transition: border-color .28s ease;
}
.app-sidebar.collapsed .sb-header {
    background: #ffffff;
    border-bottom-color: #DCE9E1;
    justify-content: center;
    padding: 0;
    gap: 0;
}

/* Logo mark — no background, just the image/initials */
.sb-logo {
    width: 40px;
    height: 40px;
    border-radius: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -.02em;
    flex-shrink: 0;
    overflow: hidden;
}
.app-sidebar.collapsed .sb-logo { color: var(--primary); }
.sb-logo img { width: 40px; height: 40px; object-fit: contain; border-radius: 0; }

/* Brand text */
.sb-brand {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    opacity: 1;
    transform: translateX(0);
    transition: opacity .2s ease, transform .22s ease;
}
.app-sidebar.collapsed .sb-brand {
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    transform: translateX(-6px);
    pointer-events: none;
    transition: opacity .2s ease, max-width .28s ease, transform .22s ease;
}
.sb-brand strong {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--sb-text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -.01em;
}
.sb-brand span {
    display: block;
    font-size: 8.5px;
    font-weight: 500;
    color: var(--sb-label-color);
    letter-spacing: .09em;
    text-transform: uppercase;
    margin-top: 1px;
}

/* Collapse pin button */
.sb-pin {
    width: 26px;
    height: 26px;
    border: 1px solid #D0E5D8;
    background: transparent;
    border-radius: 8px;
    color: var(--sb-label-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    flex-shrink: 0;
    cursor: pointer;
    transition: background .18s, color .18s, border-color .18s, opacity .22s;
}
.sb-pin:hover { background: #E6F4EC; color: #1A3A2E; border-color: #B0D4BE; }
.app-sidebar.collapsed .sb-pin { opacity: 0; pointer-events: none; }
.sb-pin i { transition: transform .26s cubic-bezier(.4,0,.2,1); }

/* ── Scrollable nav area ── */
.sb-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    scrollbar-width: thin;
    scrollbar-color: #C8D8CE transparent;
    transition: padding .28s ease;
}
.app-sidebar.collapsed .sb-nav { padding: 10px 0 14px; }
.sb-nav::-webkit-scrollbar { width: 3px; }
.sb-nav::-webkit-scrollbar-track { background: transparent; }
.sb-nav::-webkit-scrollbar-thumb { background: #D4DAD6; border-radius: 3px; }

/* Hide scrollbar thumb when collapsed (dark bg) */
.app-sidebar.collapsed .sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); }

/* ── Section label ── */
.sb-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .11em;
    text-transform: uppercase;
    color: var(--sb-label-color);   /* #4E6A5E — dark enough to read */
    padding: 18px 8px 14px;
    white-space: nowrap;
    user-select: none;
    overflow: hidden;
    opacity: 1;
    transition: opacity .2s ease;
}
.app-sidebar.collapsed .sb-section-label { opacity: 0; height: 0; padding: 0; }

/* ── Nav item ── */
.sb-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--sb-text);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    outline: none;
    transition:
        background  .22s ease,
        color       .22s ease,
        transform   .2s  cubic-bezier(.4,0,.2,1),
        padding     .28s ease,
        box-shadow  .22s ease;
}

/* Expanded hover */
.sb-item:hover {
    background: var(--sb-hover-bg);
    color: var(--sb-hover-color);
    transform: translateX(2px);
}

/* Expanded active: club-color pill */
.sb-item.active {
    background: var(--sb-active-bg);
    color: var(--sb-active-color);
    font-weight: 600;
    transform: translateX(0);
    box-shadow: 0 4px 16px rgba(0,0,0,.18);
}

/* ── Collapsed item overrides ── */
.app-sidebar.collapsed .sb-item {
    justify-content: center;
    padding: 12px 0;
    color: var(--sb-c-icon);
    background: transparent;
    box-shadow: none;
    transform: none;
    border-radius: 0;
}
.app-sidebar.collapsed .sb-item:hover {
    background: var(--sb-c-hover-bg);
    color: var(--sb-c-icon-hover);
    transform: scale(1.08);
    border-radius: 12px;
}
.app-sidebar.collapsed .sb-item.active {
    background: rgba(255,255,255,0.20);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.28), 0 2px 10px rgba(0,0,0,.20);
    transform: none;
    border-radius: 12px;
}

/* Icon */
.sb-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    opacity: .70;
    transition: opacity .2s ease, transform .2s ease;
}
.sb-item:hover i      { opacity: .92; transform: scale(1.05); }
.sb-item.active i     { opacity: 1; transform: none; }
.app-sidebar.collapsed .sb-item i     { width: auto; opacity: .78; font-size: 17px; }
.app-sidebar.collapsed .sb-item:hover i  { opacity: .92; transform: scale(1.1); }
.app-sidebar.collapsed .sb-item.active i { opacity: 1; filter: drop-shadow(0 0 4px rgba(255,255,255,.40)); }

/* Item text — fades out and collapses on narrow */
.sb-item-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 1;
    max-width: 180px;
    transition: opacity .2s ease, max-width .28s ease;
}
.app-sidebar.collapsed .sb-item-text { opacity: 0; max-width: 0; }

/* Badge */
.sb-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #EF4444;
    color: #fff;
    font-size: 9.5px;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 1;
    transition: opacity .2s ease;
}
.sb-badge-urgent {
    box-shadow: 0 0 0 2px rgba(239,68,68,.35);
    animation: sbBadgeUrgentPulse 1.5s ease-in-out infinite;
}
@keyframes sbBadgeUrgentPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 2px rgba(239,68,68,.35); }
    50%      { transform: scale(1.18); box-shadow: 0 0 0 4px rgba(239,68,68,.15); }
}
.sb-item.active .sb-badge {
    background: rgba(255,255,255,0.88);
    color: #2B7A48;
}
/* display:none (not just opacity:0) — a hidden badge that still reserves
   flex space throws off the icon's centering vs. badge-less items. */
.app-sidebar.collapsed .sb-badge { display: none; }

/* Tooltip is JS-rendered (appended to body) — no CSS ::after needed */

/* ── Section separator line ── */
.sb-section-divider {
    height: 1px;
    background: #D0E5D8;
    margin: 8px 4px;
    border-radius: 1px;
    transition: background .28s ease, margin .28s ease;
}
.app-sidebar.collapsed .sb-section-divider {
    background: rgba(255,255,255,0.08);
    margin: 8px 10px;
}

/* ── Footer: user + sign out ── */
.sb-footer {
    padding: 10px 12px 16px;
    border-top: 1px solid #D0E5D8;
    flex-shrink: 0;
    overflow: hidden;
    transition: border-color .28s ease, padding .28s ease;
}
.app-sidebar.collapsed .sb-footer {
    border-top-color: rgba(255,255,255,0.07);
    padding: 8px 0 14px;
}

/* User row */
.sb-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 12px;
    text-decoration: none;
    margin-bottom: 4px;
    overflow: hidden;
    transition: background .18s ease;
}
.sb-user:hover { background: var(--sb-hover-bg); }
.app-sidebar.collapsed .sb-user {
    justify-content: center;
    padding: 7px 0;
    background: transparent !important;
}

/* User avatar circle */
.sb-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: -.02em;
    transition: background .28s ease, transform .18s cubic-bezier(.34,1.56,.64,1);
}
.app-sidebar.collapsed .sb-user-avatar {
    background: rgba(255,255,255,0.15);
}
.app-sidebar.collapsed .sb-user:hover .sb-user-avatar {
    background: rgba(255,255,255,0.22);
    transform: scale(1.08);
}

/* User text info */
.sb-user-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    opacity: 1;
    transition: opacity .2s ease;
}
.app-sidebar.collapsed .sb-user-info { opacity: 0; width: 0; }
.sb-user-name {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--sb-text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sb-user-role {
    display: block;
    font-size: 11px;
    color: var(--sb-label-color);
    white-space: nowrap;
    font-weight: 500;
}

/* Sign Out */
.sb-signout {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 16px;
    border-radius: 12px;
    color: #EF4444;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    transition: background .18s ease, transform .2s ease;
}
.sb-signout:hover { background: #FEF2F2; transform: translateX(2px); }
.app-sidebar.collapsed .sb-signout {
    justify-content: center;
    padding: 10px 0;
    transform: none !important;
    background: transparent !important;
}
.sb-signout i { font-size: 14px; flex-shrink: 0; transition: color .2s; }
.app-sidebar.collapsed .sb-signout i { color: rgba(255,255,255,0.45); font-size: 15px; }
.app-sidebar.collapsed .sb-signout:hover i { color: rgba(255,255,255,0.85); }

/* Sign out text */
.sb-signout-text {
    opacity: 1;
    max-width: 120px;
    overflow: hidden;
    transition: opacity .2s ease, max-width .28s ease;
}
.app-sidebar.collapsed .sb-signout-text { opacity: 0; max-width: 0; }

/* Legal links — hide entirely when collapsed (there's no room to wrap
   this text at 62px). */
.sb-legal-links {
    opacity: 1;
    transition: opacity .2s ease;
}
.app-sidebar.collapsed .sb-legal-links {
    display: none;
}

/* "Powered by" stays visible when collapsed, recoloured white so it
   reads against the dark collapsed background instead of muted grey. */
.app-sidebar.collapsed .sb-powered-by a {
    color: rgba(255,255,255,.72);
}
.app-sidebar.collapsed .sb-powered-by a:hover {
    color: #fff;
}

/* ── Mobile overlay ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.48);
    z-index: 290;
    backdrop-filter: blur(3px);
}
.sidebar-overlay.active { display: block; }

/* ── Legacy selectors kept for backward compat ── */
.sidebar-item  { display: none; }
.sidebar-badge { display: none; }
.sidebar-rail  { display: none; }
.sidebar-panel { display: none; }

/* ═══════════════════════════════════════════════════════════
   TOP BAR
   ═══════════════════════════════════════════════════════════ */

.app-topbar {
    height: var(--topbar-height);
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Topbar expand button — shown only on desktop when sidebar is collapsed */
.topbar-expand-btn {
    display: none;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 10px;
    color: var(--sub);
    align-items: center;
    justify-content: center;
    font-size: 11px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .18s, color .18s, border-color .18s;
}
.topbar-expand-btn:hover { background: var(--sb-hover-bg); color: var(--primary); border-color: #B0D4BE; }
.main-content.sidebar-collapsed .topbar-expand-btn { display: flex; }

.topbar-hamburger {
    display: none;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--card-bg);
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
    cursor: pointer;
    flex-shrink: 0;
}
.topbar-hamburger:hover { background: var(--border); }

.topbar-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.02em;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-icon-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: var(--card-bg);
    border-radius: 11px;
    color: var(--sub);
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
    position: relative;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    cursor: pointer;
    text-decoration: none;
}
.topbar-icon-btn:hover { background: var(--border); color: var(--text); }

.topbar-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 7px;
    height: 7px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg);
}
.topbar-badge.count {
    width: auto;
    height: 16px;
    min-width: 16px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    top: 4px;
    right: 4px;
}

.topbar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: var(--rail-bg);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    position: relative;
    letter-spacing: -.02em;
}

/* Dropdown */
.topbar-dropdown { position: relative; }

.topbar-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,.12);
    min-width: 210px;
    z-index: 400;
    overflow: hidden;
    animation: fadeSlideDown .18s var(--ease);
}
.topbar-dropdown.open .topbar-dropdown-menu { display: block; }

.dropdown-header {
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border);
}
.dropdown-header .d-name  { font-size: 13px; font-weight: 700; color: var(--text); }
.dropdown-header .d-email { font-size: 11px; color: var(--sub); margin-top: 2px; }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text);
    transition: background .1s;
    cursor: pointer;
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-item i { width: 16px; color: var(--sub); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger i { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ═══════════════════════════════════════════════════════════
   PAGE STRUCTURE
   ═══════════════════════════════════════════════════════════ */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}
.page-header-title h1 {
    font-size: 21px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -.03em;
    line-height: 1.2;
}
.page-header-title p {
    font-size: 13px;
    color: var(--sub);
    margin-top: 3px;
}

/* ═══════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════ */

.card {
    background: var(--card-bg);
    border-radius: 18px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    transition: box-shadow .2s var(--ease), transform .2s var(--ease);
    overflow: hidden;
}
.card:hover {
    box-shadow: 0 6px 24px rgba(0,0,0,.07);
    transform: translateY(-1px);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}
.card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.01em;
}
.card-body  { padding: 20px; }
.card-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

/* Legacy Bootstrap compat card */
.card-rotary {
    background: var(--card-bg);
    border-radius: 18px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    overflow: hidden;
}
.card-rotary .card-header {
    background: var(--rail-bg);
    color: #fff;
    border-radius: 18px 18px 0 0 !important;
    font-weight: 600;
    padding: .85rem 1.25rem;
    border-bottom: none;
}
.card-rotary .card-header.gold {
    background: var(--gold);
    color: #111;
}

/* Stat card */
.stat-card {
    background: var(--card-bg);
    border-radius: 18px;
    border: 1px solid var(--border);
    padding: 22px 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: box-shadow .2s var(--ease), transform .2s var(--ease);
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.stat-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,.07); transform: translateY(-1px); }

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.stat-icon.navy   { background: rgba(23,69,143,.1);  color: var(--primary); }
.stat-icon.gold   { background: rgba(247,168,27,.15); color: var(--gold-dark); }
.stat-icon.green  { background: rgba(22,163,74,.12);  color: var(--success); }
.stat-icon.red    { background: rgba(220,38,38,.1);   color: var(--danger); }
.stat-icon.dark   { background: var(--rail-bg); color: #fff; }
.stat-icon.forest { background: rgba(26,58,46,.12); color: var(--rail-bg); }

.stat-info   { flex: 1; min-width: 0; }
.stat-number {
    font-size: 30px;
    font-weight: 900;
    color: var(--text);
    line-height: 1;
    letter-spacing: -.03em;
}
.stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--sub);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-top: 5px;
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 20px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background .15s, transform .1s, box-shadow .15s;
    white-space: nowrap;
    font-family: inherit;
    text-decoration: none;
    letter-spacing: -.01em;
}
.btn:active { transform: scale(.97); }

.btn-primary {
    background: var(--rail-bg);
    color: #fff;
}
.btn-primary:hover { background: #0f2419; box-shadow: 0 4px 14px rgba(26,58,46,.3); }

.btn-gold {
    background: var(--gold);
    color: #111;
    font-weight: 700;
}
.btn-gold:hover { background: var(--gold-dark); box-shadow: 0 4px 14px rgba(247,168,27,.4); }

.btn-navy, .btn-outline-navy:hover {
    background: var(--primary);
    color: #fff;
    border-radius: 50px;
}
.btn-navy:hover { background: var(--primary-dark); }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text);
    border-radius: 50px;
}
.btn-outline:hover { background: var(--bg); border-color: var(--sub); }

.btn-outline-navy {
    background: transparent;
    border: 1.5px solid var(--primary);
    color: var(--primary);
    border-radius: 50px;
}
.btn-outline-navy:hover { background: var(--primary); color: #fff; }

.btn-danger  { background: var(--danger);  color: #fff; border-radius: 50px; }
.btn-success { background: var(--success); color: #fff; border-radius: 50px; }
.btn-forest  { background: var(--rail-bg); color: #fff; border-radius: 50px; }
.btn-forest:hover { background: #0f2419; }

.btn-sm  { padding: 6px 14px;  font-size: 12px; border-radius: 50px; }
.btn-lg  { padding: 12px 26px; font-size: 15px; border-radius: 50px; }
.btn-xl  { padding: 14px 30px; font-size: 15px; font-weight: 700; border-radius: 50px; }
.btn-block { width: 100%; }
.btn-icon  { width: 36px; height: 36px; padding: 0; border-radius: 50%; }

/* ═══════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════ */

.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--sub);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.form-control,
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="tel"], input[type="date"],
select, textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: var(--card-bg);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
    -webkit-appearance: none;
}
.form-control:focus,
input:focus, select:focus, textarea:focus {
    border-color: var(--rail-bg);
    box-shadow: 0 0 0 3px rgba(26,58,46,.1);
}
.form-control::placeholder { color: var(--muted); }

.input-group {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color .15s, box-shadow .15s;
}
.input-group:focus-within { border-color: var(--rail-bg); box-shadow: 0 0 0 3px rgba(26,58,46,.1); }
.input-group input {
    flex: 1; border: none; border-radius: 0; padding: 10px 14px;
    outline: none; box-shadow: none; background: transparent;
}
.input-group-text {
    padding: 10px 14px; background: var(--bg); color: var(--sub);
    font-size: 13px; border-right: 1px solid var(--border); white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════ */

.table-wrap { overflow-x: auto; border-radius: 14px; }

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

thead th {
    background: var(--bg);
    color: var(--sub);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f9fbf9; }

.table-rotary thead th {
    background: var(--bg); color: var(--sub);
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .07em;
    border-bottom: 1px solid var(--border);
}
.table-rotary tbody tr:hover { background: #f9fbf9; }

/* ═══════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-member     { background: rgba(23,69,143,.1);   color: var(--primary); }
.badge-rotarian   { background: rgba(37,99,235,.1);   color: #1d4ed8; }
.badge-rotaractor { background: rgba(247,168,27,.18); color: var(--gold-dark); }
.badge-guest      { background: rgba(107,114,128,.1); color: var(--sub); }
.badge-success    { background: var(--success-light); color: var(--success); }
.badge-danger     { background: var(--danger-light);  color: var(--danger); }
.badge-warning    { background: var(--warning-light); color: var(--warning); }
.badge-info       { background: var(--info-light);    color: var(--info); }
.badge-gold       { background: var(--gold-light);    color: var(--gold-dark); }
.badge-dark       { background: var(--rail-bg); color: #fff; }
.badge-forest     { background: rgba(26,58,46,.12); color: var(--rail-bg); }

/* Legacy Bootstrap compat */
.bg-navy  { background-color: var(--primary) !important; color: #fff; }
.bg-gold  { background-color: var(--gold) !important; }
.text-navy { color: var(--primary) !important; }
.text-gold { color: var(--gold) !important; }
.border-navy { border-color: var(--primary) !important; }
.border-gold { border-color: var(--gold) !important; }
.bg-rotary-light { background-color: rgba(23,69,143,.07) !important; }
.alert-rotary {
    background: rgba(23,69,143,.07);
    border-left: 3px solid var(--primary);
    color: var(--primary);
    padding: 12px 16px;
    border-radius: 12px;
}

/* ═══════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════ */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 14px;
    font-size: 13px;
    margin-bottom: 16px;
}
.alert i { flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-light); color: #15803d; border: 1px solid #bbf7d0; }
.alert-danger  { background: var(--danger-light);  color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: var(--info-light);    color: #1e40af; border: 1px solid #bfdbfe; }

/* ═══════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════ */

.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.w-full { width: 100%; }
.text-sm    { font-size: 12px; }
.text-xs    { font-size: 11px; }
.text-muted { color: var(--sub) !important; }
.font-bold  { font-weight: 700; }
.font-black { font-weight: 900; }
.truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.p-4  { padding: 16px; }
.p-5  { padding: 20px; }
.p-6  { padding: 24px; }

/* ═══════════════════════════════════════════════════════════
   GRID
   ═══════════════════════════════════════════════════════════ */

.grid   { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ═══════════════════════════════════════════════════════════
   MISC COMPONENTS
   ═══════════════════════════════════════════════════════════ */

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: 14px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    color: var(--sub);
    transition: border-color .2s, background .2s;
}
.upload-zone:hover { border-color: var(--rail-bg); background: rgba(26,58,46,.03); }

.qr-frame {
    display: inline-block;
    border: 4px solid var(--rail-bg);
    border-radius: 18px;
    padding: 14px;
    background: #fff;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,.12);
}
.qr-frame img { display: block; width: 260px; height: 260px; }

.rotary-gear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--gold);
    border-radius: 50%;
    font-size: 1.4rem;
    color: var(--primary-dark);
    font-weight: 900;
    flex-shrink: 0;
}

.fellowship-header {
    background: var(--rail-bg);
    padding: 1.25rem 1.5rem;
    color: #fff;
}

.winner-card {
    background: var(--gold);
    border-radius: 18px;
    padding: 1.5rem;
    text-align: center;
    animation: winnerPulse 2.2s infinite;
}
@keyframes winnerPulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(247,168,27,.5); }
    50%      { box-shadow: 0 0 0 14px rgba(247,168,27,0); }
}

.checkin-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: 2rem 1rem;
    border-radius: 20px;
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
    transition: transform .15s, box-shadow .15s;
    text-decoration: none;
    cursor: pointer;
}
.checkin-btn:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(0,0,0,.15); }
.checkin-btn.navy  { background: var(--rail-bg); color: #fff; }
.checkin-btn.gold  { background: var(--gold); color: #111; }
.checkin-btn i { font-size: 2.2rem; }

.status-dot {
    width: 7px; height: 7px; border-radius: 50%;
    display: inline-block; flex-shrink: 0;
}
.status-dot.green { background: var(--success); }
.status-dot.gold  { background: var(--gold); }
.status-dot.red   { background: var(--danger); }
.status-dot.grey  { background: var(--muted); }

/* ═══════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════ */

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(.9); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
    0%,100% { opacity: 1; }
    50%      { opacity: .5; }
}

.anim-fadein  { animation: fadeSlideUp .3s var(--ease) both; }
.anim-scalein { animation: scaleIn .3s var(--ease-spring) both; }

.spinner {
    width: 20px; height: 20px;
    border: 2.5px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .65s linear infinite;
    display: inline-block;
}
.spinner-dark {
    border-color: rgba(0,0,0,.1);
    border-top-color: var(--rail-bg);
}

/* ── Live badge ── */
.live-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--rail-bg); color: #fff;
    border-radius: 50px; padding: 5px 14px;
    font-size: .75rem; font-weight: 700;
}
.live-badge .dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--rail-icon-active); animation: pulse 1.5s infinite;
}

/* ═══════════════════════════════════════════════════════════
   MOBILE & RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .app-sidebar {
        transform: translateX(calc(-1 * (var(--sidebar-expanded) + 16px)));
        width: var(--sidebar-expanded) !important;
        background: var(--sb-expanded-bg) !important;  /* always white on mobile */
        border-right: 1.5px solid var(--sb-expanded-border) !important;
        transition: transform .3s cubic-bezier(.4,0,.2,1);
        box-shadow: none;
    }
    .app-sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 6px 0 40px rgba(0,0,0,.2);
    }
    /* Restore expanded-state colours when mobile overlay is open */
    .app-sidebar.mobile-open .sb-item {
        color: var(--sb-text) !important;
        justify-content: flex-start !important;
        padding: 12px 16px !important;
        border-radius: 12px !important;
    }
    .app-sidebar.mobile-open .sb-item.active {
        background: var(--sb-active-bg) !important;
        color: var(--sb-active-color) !important;
    }
    .app-sidebar.mobile-open .sb-item-text { opacity: 1 !important; max-width: 180px !important; }
    .app-sidebar.mobile-open .sb-badge     { opacity: 1 !important; }
    .app-sidebar.mobile-open .sb-section-label { opacity: 1 !important; height: auto !important; padding: 18px 8px 14px !important; }
    .app-sidebar.mobile-open .sb-logo  { background: transparent !important; color: var(--primary) !important; }
    .app-sidebar.mobile-open .sb-brand { opacity: 1 !important; transform: none !important; pointer-events: auto !important; }
    .app-sidebar.mobile-open .sb-pin   { opacity: 1 !important; pointer-events: auto !important; }
    .app-sidebar.mobile-open .sb-user  { justify-content: flex-start !important; padding: 8px 8px !important; }
    .app-sidebar.mobile-open .sb-user-avatar { background: var(--primary) !important; }
    .app-sidebar.mobile-open .sb-user-info { opacity: 1 !important; width: auto !important; }
    .app-sidebar.mobile-open .sb-signout { justify-content: flex-start !important; padding: 10px 16px !important; color: #EF4444 !important; }
    .app-sidebar.mobile-open .sb-signout i { color: #EF4444 !important; font-size: 14px !important; }
    .app-sidebar.mobile-open .sb-signout-text { opacity: 1 !important; max-width: 120px !important; }
    .app-sidebar.mobile-open .sb-section-divider { background: #D0E5D8 !important; margin: 8px 4px !important; }

    .main-content { margin-left: 0 !important; height: 100vh; overflow-y: auto; }
    .topbar-hamburger { display: flex; }
    .page-body { padding: 16px 16px 80px; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

    /* ── Mobile: page header stack ── */
    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }

    /* ── Mobile: table horizontal scroll ── */
    .table-wrap { -webkit-overflow-scrolling: touch; }
    .table-wrap table { min-width: 480px; }

    /* ── Mobile: topbar tightening ── */
    .app-topbar { padding: 0 14px; }
}

@media (max-width: 480px) {
    .page-body  { padding: 12px 12px 80px; }
    .topbar-title { font-size: 15px; }
    /* Remove min-width on very small screens for simple tables */
    .table-responsive-xs table { min-width: 0; }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE GRID UTILITIES (mobile-first helpers)
   ═══════════════════════════════════════════════════════════ */

/* Two-column split with fixed right panel → single column on mobile */
.split-row {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 16px;
    align-items: start;
}
@media (max-width: 1024px) { .split-row { grid-template-columns: 1fr 300px; } }
@media (max-width: 768px)  { .split-row { grid-template-columns: 1fr; } }

/* 3-col stat grid → 1 col on mobile */
.stat-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
@media (max-width: 768px) { .stat-grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .stat-grid-3 { grid-template-columns: 1fr; } }

/* Filter bars that overflow horizontally on mobile */
.filter-bar-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
}
.filter-bar-scroll::-webkit-scrollbar { height: 3px; }
.filter-bar-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Mobile-friendly action button rows */
@media (max-width: 768px) {
    .mobile-stack { flex-direction: column !important; align-items: stretch !important; }
    .mobile-stack .btn { width: 100%; justify-content: center; }
    .mobile-w-full { width: 100% !important; }
}

/* ═══════════════════════════════════════════════════════════
   PRINT
   ═══════════════════════════════════════════════════════════ */

@media print {
    .app-sidebar, .app-topbar, .sidebar-overlay { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .page-body { padding: 0; }
    body * { visibility: hidden; }
    .print-area, .print-area * { visibility: visible; }
    .print-area { position: absolute; left: 0; top: 0; width: 100%; text-align: center; }
}
