/* ============================================
   KingdomConnect Web - Responsive Stylesheet
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    /* Primary palette - teal theme matching iOS */
    --bg-primary: #1A5F5A;
    --bg-secondary: #14504B;
    --bg-card: #1E6B65;
    --bg-hover: #237570;
    --bg-input: #1a6660;
    --accent: #4ECDC4;
    --accent-light: #7EDDD6;
    --accent-dim: rgba(78, 205, 196, 0.15);
    --gold: #D4A84B;
    --gold-light: #E8C97D;

    /* Text */
    --text-primary: #FFFFFF;
    --text-secondary: #A8D5D1;
    --text-muted: #7BB5B0;
    --text-on-accent: #0D3330;

    /* UI */
    --divider: #2A7A74;
    --pill-bg: #2A7A74;
    --pill-selected: #4ECDC4;
    --sidebar-width: 260px;
    --topbar-height: 56px;
    --bottombar-height: 64px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;

    /* Status */
    --success: #4CAF50;
    --warning: #FFC107;
    --error: #E57373;
    --pinned: #FF6B6B;

    /* Button branding (overridden by org colors) */
    --btn-primary-bg: var(--accent);
    --btn-primary-text: var(--text-on-accent);
    --btn-secondary-text: #000000;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.3);

    /* Transitions */
    --transition: 0.2s ease;
}

/* Dark mode (same palette mostly, but could be adjusted) */
.dark {
    --bg-primary: #0F3A37;
    --bg-secondary: #0A2A28;
    --bg-card: #13453F;
    --bg-hover: #1A5F5A;
    --bg-input: #13453F;
    --divider: #1E5551;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-light); }

img { max-width: 100%; display: block; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--divider); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* --- Typography --- */
h1 { font-size: 2rem; font-weight: 800; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }

.text-muted { color: var(--text-muted); font-size: 0.8125rem; }
.text-secondary { color: var(--text-secondary); }
.text-error { color: var(--error); font-size: 0.875rem; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn--primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
}
.btn--primary:hover { background: var(--accent-light); }
.btn--primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--outline {
    background: transparent;
    border: 1.5px solid var(--divider);
    color: var(--text-primary);
}
.btn--outline:hover { border-color: var(--accent); color: var(--accent); }

.btn--text {
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 10px;
}
.btn--text:hover { color: var(--accent); }

.btn--sm { padding: 6px 14px; font-size: 0.8125rem; }
.btn--lg { padding: 14px 28px; font-size: 1rem; }
.btn--full { width: 100%; }

.btn--create {
    border-radius: var(--border-radius);
    font-size: 0.9375rem;
}

/* --- Form elements --- */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="datetime-local"], input[type="search"],
textarea, select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1.5px solid var(--divider);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: border-color var(--transition);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
}

::placeholder { color: var(--text-muted); }

textarea { resize: vertical; min-height: 80px; }

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237BB5B0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.input-with-toggle { position: relative; }
.input-with-toggle input { padding-right: 60px; }
.input-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
}

.input--center { text-align: center; }
.input--lg { font-size: 1.25rem; padding: 16px; letter-spacing: 4px; }

.form-error {
    color: var(--error);
    font-size: 0.8125rem;
    min-height: 20px;
    margin-bottom: 8px;
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
}

/* --- Avatar --- */
.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 700;
    font-size: 0.875rem;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--xs { width: 28px; height: 28px; font-size: 0.6875rem; }
.avatar--sm { width: 36px; height: 36px; font-size: 0.8125rem; }
.avatar--lg { width: 56px; height: 56px; font-size: 1.125rem; }
.avatar--xl { width: 80px; height: 80px; font-size: 1.5rem; }

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

/* --- Empty state --- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    color: var(--text-muted);
    text-align: center;
}

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: calc(var(--bottombar-height) + 20px);
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}
.toast--visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--error { border-left: 4px solid var(--error); }
.toast--success { border-left: 4px solid var(--success); }

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal--lg { max-width: 600px; }

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--divider);
}
.modal__header h3 { margin: 0; }
.modal__close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}
.modal__close:hover { color: var(--text-primary); }
.modal__body { padding: 24px; }

/* --- Toggle switch --- */
.toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle__slider {
    position: absolute;
    inset: 0;
    background: var(--divider);
    border-radius: 13px;
    cursor: pointer;
    transition: background var(--transition);
}
.toggle__slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    top: 3px;
    left: 3px;
    transition: transform var(--transition);
}
.toggle input:checked + .toggle__slider { background: var(--accent); }
.toggle input:checked + .toggle__slider::before { transform: translateX(22px); }

/* ============================================
   APP SHELL LAYOUT
   ============================================ */

.app-shell {
    display: grid;
    grid-template-areas: "sidebar main";
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

/* --- Sidebar (Desktop) --- */
.sidebar {
    grid-area: sidebar;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    border-right: 1px solid var(--divider);
    z-index: 100;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid var(--divider);
}

.sidebar__logo {
    width: 40px;
    height: 40px;
    background: var(--accent);
    color: var(--text-on-accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.875rem;
}

.sidebar__title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar__logo-img {
    max-height: 44px;
    max-width: 100%;
    object-fit: contain;
}

.sidebar__brand-fallback {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-topbar__logo {
    max-height: 32px;
    object-fit: contain;
}

.sidebar__nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.sidebar__footer {
    padding: 12px 10px;
    border-top: 1px solid var(--divider);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9375rem;
    transition: all var(--transition);
    cursor: pointer;
    position: relative;
    text-decoration: none;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item--active {
    background: var(--accent-dim);
    color: var(--accent);
}

.nav-item__icon { font-size: 1.25rem; width: 24px; text-align: center; }
.nav-item__label { flex: 1; }

.nav-badge {
    background: var(--error);
    color: white;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* --- Mobile Top Bar --- */
.mobile-topbar {
    display: none;
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    padding: 12px 16px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--divider);
    z-index: 100;
}

.mobile-topbar__title {
    font-weight: 700;
    font-size: 1.125rem;
}

.mobile-topbar__actions { display: flex; gap: 4px; }

.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    padding: 8px;
    cursor: pointer;
    position: relative;
    border-radius: var(--border-radius-sm);
}
.icon-btn:hover { background: var(--bg-hover); }
.icon-btn--badge::after {
    content: attr(data-count);
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--error);
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
}

/* --- Bottom Bar (Mobile) --- */
.bottom-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--divider);
    padding: 6px 0 env(safe-area-inset-bottom, 6px);
    z-index: 100;
}

.bottom-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 0;
    color: var(--text-muted);
    font-size: 0.625rem;
    font-weight: 500;
    text-decoration: none;
    transition: color var(--transition);
}
.bottom-item span:first-child { font-size: 1.25rem; }
.bottom-item--active { color: var(--accent); }

/* --- Main Content --- */
.main-content {
    grid-area: main;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    border-bottom: 1px solid var(--divider);
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 50;
}

.main-header__title { font-size: 1.375rem; }

.view-container {
    flex: 1;
    padding: 24px 32px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* ============================================
   AUTH PAGES
   ============================================ */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 50%, #1E6B65 100%);
}

.auth-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
}
.auth-card--welcome { text-align: center; }
.auth-card--wide { max-width: 560px; }
.auth-card--center { text-align: center; }

.auth-back {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.875rem;
    margin-bottom: 20px;
    padding: 0;
}
.auth-back:hover { color: var(--accent); }

.auth-logo { margin-bottom: 32px; }
.auth-logo__icon { width: 64px; height: 64px; margin: 0 auto 16px; }
.auth-logo__icon svg { width: 100%; height: 100%; }
.auth-logo__title { font-size: 2rem; font-weight: 800; margin-bottom: 4px; }
.auth-logo__subtitle { color: var(--text-secondary); font-size: 1rem; }

.auth-title { font-size: 1.5rem; margin-bottom: 4px; }
.auth-subtitle { color: var(--text-secondary); margin-bottom: 24px; }

.auth-actions { display: flex; flex-direction: column; gap: 12px; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-muted);
    font-size: 0.8125rem;
    margin: 4px 0;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--divider);
}

.auth-form { margin-top: 8px; }

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

/* Church search */
.church-results { margin-top: 16px; }

.church-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: background var(--transition);
    margin-bottom: 8px;
}
.church-card:hover { background: var(--bg-hover); }
.church-card__info h3 { font-size: 1rem; margin-bottom: 2px; }
.church-card__info p { color: var(--text-muted); font-size: 0.8125rem; }
.church-card__arrow { color: var(--accent); font-size: 1.25rem; }

.church-confirm { text-align: center; margin-bottom: 24px; }
.church-confirm__logo { width: 80px; height: 80px; border-radius: 16px; margin: 0 auto 16px; object-fit: cover; }
.church-confirm__desc { color: var(--text-secondary); margin-top: 12px; font-size: 0.875rem; }

/* --- Search bar --- */
.search-bar {
    position: relative;
}
.search-bar input {
    padding-left: 16px;
}
.search-bar--full { position: relative; }
.search-bar--full .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    z-index: 1;
}
.search-bar--full input { padding-left: 40px; }

/* ============================================
   TEAM FILTER BAR
   ============================================ */

.team-filter-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 16px;
    margin-bottom: 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.team-filter-bar::-webkit-scrollbar { display: none; }

.team-pill {
    flex-shrink: 0;
    padding: 8px 18px;
    border-radius: 20px;
    background: var(--pill-bg);
    color: var(--text-secondary);
    border: none;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.team-pill:hover { background: var(--bg-hover); color: var(--text-primary); }
.team-pill--active {
    background: var(--accent);
    color: var(--text-on-accent);
}

/* ============================================
   HOME FEED
   ============================================ */

.feed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 20px;
}

.post-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
}
.post-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.post-card__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.post-card__meta { flex: 1; min-width: 0; }
.post-card__author { font-weight: 600; font-size: 0.9375rem; display: block; }
.post-card__team { color: var(--text-muted); font-size: 0.75rem; }

.post-card__title {
    font-size: 1rem;
    margin-bottom: 8px;
}

.post-card__content p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.post-card__text-bg {
    border-radius: var(--border-radius-sm);
    padding: 40px 24px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
}
.post-card__text-bg p {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.post-card__actions {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--divider);
}
.post-card__actions button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
    transition: color var(--transition);
}
.post-card__actions button:hover { color: var(--text-primary); }

.post-card__like--active { color: var(--error) !important; }

.pin-badge {
    background: rgba(255, 107, 107, 0.15);
    color: var(--pinned);
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
}

.post-type-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    background: var(--accent-dim);
    color: var(--accent);
}
.post-type-badge--announcement { background: rgba(255,193,7,0.15); color: var(--warning); }
.post-type-badge--prayer_request { background: rgba(156,39,176,0.15); color: #CE93D8; }
.post-type-badge--testimony { background: rgba(76,175,80,0.15); color: var(--success); }

/* ============================================
   CALENDAR
   ============================================ */

.calendar-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 32px;
    align-items: start;
}

.calendar-panel {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 24px;
    position: sticky;
    top: 100px;
}

.cal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.cal-header h3 { flex: 1; text-align: center; }

.cal-nav {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--border-radius-sm);
}
.cal-nav:hover { background: var(--bg-hover); }

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    transition: background var(--transition);
    position: relative;
}
.cal-day:hover { background: var(--bg-hover); }
.cal-day--empty { cursor: default; }
.cal-day--today { font-weight: 700; color: var(--accent); }
.cal-day--selected { background: var(--accent); color: var(--text-on-accent); }
.cal-day--selected.cal-day--today { color: var(--text-on-accent); }

.cal-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    position: absolute;
    bottom: 4px;
}
.cal-day--selected .cal-dot { background: var(--text-on-accent); }

.events-panel { min-width: 0; }

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

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

.event-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 16px 20px;
    display: flex;
    gap: 16px;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
}
.event-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.event-card__date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    background: var(--accent-dim);
    border-radius: var(--border-radius-sm);
    padding: 8px;
}
.event-card__month { font-size: 0.6875rem; font-weight: 600; color: var(--accent); text-transform: uppercase; }
.event-card__day { font-size: 1.25rem; font-weight: 800; color: var(--accent); }

.event-card__info { flex: 1; min-width: 0; }
.event-card__info h4 { margin-bottom: 4px; }
.event-card__info p { margin-top: 2px; }

/* ============================================
   TASKS / KANBAN
   ============================================ */

.view-tasks { }

.tasks-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.tasks-count { color: var(--text-muted); font-size: 0.875rem; }

.view-toggle {
    display: flex;
    background: var(--pill-bg);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}
.view-toggle__btn {
    padding: 8px 18px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all var(--transition);
}
.view-toggle__btn:hover { color: var(--text-primary); }
.view-toggle__btn--active {
    background: var(--accent);
    color: var(--text-on-accent);
}

/* Kanban board */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    align-items: start;
}

.kanban-col {
    background: rgba(0,0,0,0.12);
    border-radius: var(--border-radius);
    padding: 16px;
    min-height: 200px;
}

.kanban-col__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--divider);
}
.kanban-col--todo .kanban-col__header { border-bottom-color: var(--text-muted); }
.kanban-col--progress .kanban-col__header { border-bottom-color: var(--warning); }
.kanban-col--done .kanban-col__header { border-bottom-color: var(--success); }

.kanban-col__count {
    background: var(--pill-bg);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.kanban-col__cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 50px;
    transition: background var(--transition);
    border-radius: var(--border-radius-sm);
    padding: 4px;
}
.kanban-col__cards--dragover { background: var(--accent-dim); }

.kanban-empty {
    color: var(--text-muted);
    font-size: 0.8125rem;
    text-align: center;
    padding: 24px 0;
}

/* Task card */
.task-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-sm);
    padding: 14px;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
}
.task-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.task-card--dragging { opacity: 0.5; }

.task-card__top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.priority-dot { font-size: 1.5rem; line-height: 1; }
.priority--low { color: var(--text-muted); }
.priority--medium { color: var(--warning); }
.priority--high { color: #FF9800; }
.priority--urgent { color: var(--error); }

.task-card__team { color: var(--text-muted); font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; }

.task-card__title { font-size: 0.9375rem; margin-bottom: 4px; }
.task-card__title--done { text-decoration: line-through; opacity: 0.6; }

.task-card__desc { color: var(--text-muted); font-size: 0.8125rem; margin-bottom: 8px; }

.task-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}

.task-card__due {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.task-card__due--overdue { color: var(--error); font-weight: 600; }

.task-card__assignee {
    font-size: 0.75rem;
    color: var(--accent);
}

/* Task list view */
.task-list { display: flex; flex-direction: column; gap: 4px; }

.task-card--list {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--border-radius-sm);
}

.task-card__status-btn {
    background: none;
    border: 2px solid var(--divider);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    flex-shrink: 0;
    transition: all var(--transition);
}
.task-card__status-btn:hover { border-color: var(--accent); color: var(--accent); }

.task-card__check {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--success);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.task-card__info { flex: 1; min-width: 0; }

.status--todo { color: var(--text-muted); }
.status--progress { color: var(--warning); }
.status--done { color: var(--success); }

/* Task detail */
.task-detail-header {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.status-badge--todo { background: rgba(123,181,176,0.15); color: var(--text-muted); }
.status-badge--in_progress { background: rgba(255,193,7,0.15); color: var(--warning); }
.status-badge--done { background: rgba(76,175,80,0.15); color: var(--success); }

.priority-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--pill-bg);
    color: var(--text-secondary);
}

.task-status-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--divider);
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ============================================
   SEARCH
   ============================================ */

.view-search { }

.search-header { margin-bottom: 24px; }

.search-categories {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.category-pill {
    padding: 8px 18px;
    border-radius: 20px;
    background: var(--pill-bg);
    color: var(--text-secondary);
    border: none;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}
.category-pill:hover { background: var(--bg-hover); }
.category-pill--active { background: var(--accent); color: var(--text-on-accent); }

.search-results { }

.search-result {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: background var(--transition);
}
.search-result:hover { background: var(--bg-card); }

.search-result__icon {
    width: 40px;
    height: 40px;
    background: var(--accent-dim);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.search-result__info { flex: 1; min-width: 0; }
.search-result__info h4 { font-size: 0.9375rem; margin-bottom: 2px; }

/* ============================================
   MESSAGES
   ============================================ */

.messages-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 0;
    height: calc(100vh - 160px);
    background: var(--bg-card);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.threads-panel {
    border-right: 1px solid var(--divider);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.threads-header {
    padding: 20px;
    border-bottom: 1px solid var(--divider);
}

.threads-list {
    flex: 1;
    overflow-y: auto;
}

.thread-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid rgba(42,122,116,0.3);
}
.thread-item:hover { background: var(--bg-hover); }
.thread-item--active { background: var(--accent-dim); }
.thread-item--unread .thread-item__name { font-weight: 700; }

.thread-item__info { flex: 1; min-width: 0; }
.thread-item__top { display: flex; justify-content: space-between; align-items: center; }
.thread-item__name { font-size: 0.9375rem; font-weight: 600; }
.thread-item__time { font-size: 0.6875rem; color: var(--text-muted); }
.thread-item__preview { color: var(--text-muted); font-size: 0.8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.unread-badge {
    background: var(--accent);
    color: var(--text-on-accent);
    font-size: 0.625rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    flex-shrink: 0;
}

.conversation-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.conversation-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.conversation-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--divider);
}
.conversation-header h4 { font-size: 1rem; }

.back-btn-mobile {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 4px;
}

.messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 75%;
}
.message--mine {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message__bubble {
    background: var(--bg-primary);
    padding: 10px 14px;
    border-radius: 16px 16px 16px 4px;
    max-width: 100%;
}
.message--mine .message__bubble {
    background: var(--accent);
    color: var(--text-on-accent);
    border-radius: 16px 16px 4px 16px;
}

.message__sender {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--accent);
    display: block;
    margin-bottom: 2px;
}
.message__bubble p { font-size: 0.9375rem; line-height: 1.4; word-break: break-word; }
.message__time {
    font-size: 0.625rem;
    color: var(--text-muted);
    display: block;
    margin-top: 4px;
}
.message--mine .message__time { color: rgba(13,51,48,0.6); }

.message-form {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--divider);
}
.message-form input { flex: 1; }

/* ============================================
   NOTIFICATIONS
   ============================================ */

.view-notifications { }

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

.notif-list { display: flex; flex-direction: column; }

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    border-radius: var(--border-radius-sm);
    transition: background var(--transition);
    cursor: pointer;
    position: relative;
}
.notif-item:hover { background: var(--bg-card); }
.notif-item--unread { background: rgba(78,205,196,0.06); }

.notif-item__icon {
    width: 40px;
    height: 40px;
    background: var(--accent-dim);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.notif-item__info { flex: 1; min-width: 0; }
.notif-item__title { font-weight: 600; font-size: 0.9375rem; margin-bottom: 2px; }
.notif-item__message { color: var(--text-secondary); font-size: 0.8125rem; }
.notif-item__time { color: var(--text-muted); font-size: 0.75rem; margin-top: 4px; display: block; }

.notif-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    position: absolute;
    top: 20px;
    right: 16px;
}

/* ============================================
   PROFILE
   ============================================ */

.profile-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 32px;
    align-items: start;
}

.profile-sidebar {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 28px;
    text-align: center;
    position: sticky;
    top: 100px;
}

.profile-header { margin-bottom: 20px; }
.profile-header .avatar { margin: 0 auto 12px; }
.profile-header h2 { font-size: 1.25rem; margin-bottom: 4px; }

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    padding: 16px 0;
    border-top: 1px solid var(--divider);
    border-bottom: 1px solid var(--divider);
    margin-bottom: 20px;
}

.stat { text-align: center; }
.stat__value { display: block; font-size: 1.25rem; font-weight: 800; }
.stat__label { font-size: 0.75rem; color: var(--text-muted); }

.profile-teams {
    text-align: left;
}
.profile-teams h3 { font-size: 0.875rem; margin-bottom: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.team-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}
.team-item__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.profile-content { }

.profile-section {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 20px;
}
.profile-section h3 { margin-bottom: 16px; }

.settings-list { display: flex; flex-direction: column; }

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--divider);
    cursor: pointer;
    transition: color var(--transition);
}
.settings-item:last-child { border-bottom: none; }
.settings-item:hover { color: var(--accent); }
.settings-item--danger:hover { color: var(--error); }

.mini-post {
    padding: 12px 0;
    border-bottom: 1px solid var(--divider);
    cursor: pointer;
    transition: opacity var(--transition);
}
.mini-post:hover { opacity: 0.8; }
.mini-post:last-child { border-bottom: none; }
.mini-post p { font-size: 0.9375rem; margin-bottom: 4px; }

/* Share codes */
.share-section { margin-bottom: 20px; }
.share-section h4 { margin-bottom: 10px; }

.share-link {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.share-link input {
    flex: 1;
    font-size: 0.8125rem;
    padding: 8px 12px;
}
.share-link__label {
    font-size: 0.875rem;
    font-weight: 600;
    min-width: 100px;
}

/* ============================================
   DETAIL / BACK PAGES
   ============================================ */

.view-detail { max-width: 720px; }

.back-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.875rem;
    padding: 0;
    margin-bottom: 20px;
    display: inline-block;
}
.back-btn:hover { color: var(--accent); }

.detail-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 28px;
    margin-bottom: 24px;
}

.detail-card__title { margin: 16px 0 12px; }
.detail-card__content { margin: 16px 0; }
.detail-card__content p {
    color: var(--text-secondary);
    line-height: 1.7;
    white-space: pre-wrap;
}

.detail-meta { margin-bottom: 16px; }
.detail-meta p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 6px;
}

.rsvp-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--divider);
    font-size: 0.875rem;
    color: var(--text-muted);
}
.rsvp-buttons { display: flex; gap: 8px; }

/* --- Comments --- */
.comments-section { max-width: 720px; }
.comments-section h3 { margin-bottom: 16px; }

.comments-list { margin-bottom: 16px; }

.comment {
    display: flex;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(42,122,116,0.3);
}
.comment:last-child { border-bottom: none; }

.comment__body { flex: 1; }
.comment__author { font-weight: 600; font-size: 0.8125rem; margin-right: 8px; }
.comment__time { font-size: 0.75rem; color: var(--text-muted); }
.comment__body p { margin-top: 4px; font-size: 0.9375rem; color: var(--text-secondary); }

.comment-form {
    display: flex;
    gap: 10px;
}
.comment-form input { flex: 1; }

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Tablet & below: hide sidebar, show bottom bar & top bar */
@media (max-width: 1024px) {
    .app-shell {
        grid-template-areas: "main";
        grid-template-columns: 1fr;
    }

    .sidebar { display: none; }
    .mobile-topbar { display: flex; }
    .bottom-bar {
        display: flex;
        justify-content: space-around;
    }

    .main-content {
        padding-bottom: var(--bottombar-height);
    }

    .main-header {
        padding: 16px 20px;
    }

    .view-container {
        padding: 16px 20px;
    }

    /* Calendar: stack vertically */
    .calendar-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .calendar-panel {
        position: static;
    }

    /* Profile: stack */
    .profile-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .profile-sidebar {
        position: static;
    }

    /* Messages: full width thread panel, hide conversation on mobile */
    .messages-layout {
        grid-template-columns: 1fr;
        height: calc(100vh - 200px);
    }
    .threads-panel--hidden-mobile { display: none; }
    .conversation-panel--hidden-mobile { display: none; }
    .back-btn-mobile { display: block; }

    /* Kanban: scroll horizontally */
    .kanban-board {
        grid-template-columns: repeat(3, minmax(260px, 1fr));
        overflow-x: auto;
        padding-bottom: 8px;
    }

    /* Feed: single column */
    .feed-grid {
        grid-template-columns: 1fr;
    }

    .toast {
        bottom: calc(var(--bottombar-height) + 20px);
    }
}

/* Phone */
@media (max-width: 640px) {
    .view-container { padding: 12px 16px; }
    .main-header { padding: 12px 16px; }

    .auth-card { padding: 28px 20px; }
    .auth-logo__title { font-size: 1.5rem; }

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

    .post-card { padding: 16px; }
    .post-card__text-bg { padding: 28px 16px; min-height: 120px; }
    .post-card__text-bg p { font-size: 1rem; }

    .kanban-board {
        grid-template-columns: repeat(3, 85vw);
    }

    .calendar-panel { padding: 16px; }
    .cal-day { font-size: 0.75rem; }

    .detail-card { padding: 20px; }

    .messages-layout { height: calc(100vh - 180px); }
    .messages-list { padding: 12px; }
    .message { max-width: 85%; }
}

/* Wide desktop: increase feed columns */
@media (min-width: 1400px) {
    .feed-grid {
        grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    }
}

@media (min-width: 1800px) {
    .feed-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .kanban-board {
        gap: 28px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== Projects ===== */
.project-filter-bar {
    display: flex;
    gap: 6px;
    padding: 0 16px 8px;
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
}
.project-filter-bar::-webkit-scrollbar { display: none; }

.project-pill {
    flex-shrink: 0;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--divider);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.project-pill:hover { background: var(--bg-hover); color: var(--text-primary); }
.project-pill--active {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: var(--accent);
    font-weight: 600;
}
.project-pill--manage {
    border-style: dashed;
    color: var(--text-muted);
    margin-left: auto;
}
.project-pill--manage:hover { color: var(--text-primary); }
.project-pill__count {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Manage projects modal */
.project-manage-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--divider);
}
.project-manage-row:last-child { border-bottom: none; }
.project-manage-row__info { flex: 1; min-width: 0; font-size: 0.9rem; }
.project-manage-row__actions { display: flex; gap: 6px; flex-shrink: 0; }
.project-task-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 6px;
}

/* Private team indicator */
.team-pill [data-private] {
    font-style: normal;
}

/* Status badge colors in task detail */
.status-badge--todo { background: var(--bg-secondary); color: var(--text-secondary); }
.status-badge--in_progress { background: rgba(59,130,246,0.15); color: #60a5fa; }
.status-badge--done { background: rgba(34,197,94,0.15); color: #4ade80; }
.priority-badge { padding: 2px 8px; border-radius: 4px; font-size: 0.78rem; font-weight: 600; }
.btn--danger { background: rgba(239,68,68,0.12); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
