.dashboard {
    --accent: var(--primary-color);
    --accent-light: #f6ebe7;
    --warm: #f8f6f3;
    --text: var(--dark-color);
    --text-muted: var(--secondary-color);
    --success: var(--color-success);
    --warning: var(--color-warning);
    --border: var(--border-color);

    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.dashboard-welcome h1 {
    font-family: 'DM Serif Display', serif;
    font-size: 2rem;
    font-weight: 400;
    color: var(--text);
    margin: 0 0 0.25rem 0;
}

.dashboard-date {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.dashboard-actions {
    display: flex;
    gap: 0.75rem;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-action.primary {
    background: var(--accent);
    color: white;
}

.btn-action.primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-action.secondary {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-action.secondary:hover {
    background: var(--warm);
    border-color: var(--color-border-subtle);
}

.btn-icon-only {
    padding: 0.5rem;
    min-width: 36px;
    justify-content: center;
}

/* Dropdown menu */
.dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.25rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 180px;
    z-index: 100;
    padding: 0.25rem 0;
}

.dropdown.open .dropdown-menu {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}

.dropdown-item:hover {
    background: var(--warm);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.25rem 0;
}

/* Main Layout */
.dashboard-main {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.5rem;
    min-width: 0;
}

.dashboard {
    max-width: 100%;
    overflow-x: hidden;
}

/* Calendar Card */
.calendar-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    overflow: hidden;
    min-width: 0;
}

#calendar {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    height: 580px;
}

/* Calendar in sidebar: compact */
[data-zone="sidebar"] .calendar-card {
    padding: 1rem;
}
[data-zone="sidebar"] #calendar {
    height: 400px;
}
[data-zone="sidebar"] .calendar-card .fc-toolbar-title {
    font-size: 0.9rem !important;
}
[data-zone="sidebar"] .calendar-card .fc-button {
    padding: 0.25rem 0.4rem !important;
    font-size: 0.75rem !important;
}

.calendar-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.calendar-card-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

/* Sidebar */
.dashboard-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.sidebar-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    border: 1px solid var(--border);
}

.sidebar-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-card-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.sidebar-card-header a {
    font-size: 0.8rem;
    color: var(--accent);
    text-decoration: none;
}

.sidebar-card-header a:hover {
    text-decoration: underline;
}

/* Today's Activities */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-bg-subtle);
}

.activity-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.activity-time {
    background: var(--warm);
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

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

.activity-name {
    font-weight: 500;
    color: var(--text);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.activity-badge {
    width: 4px;
    height: 100%;
    min-height: 40px;
    border-radius: 2px;
    flex-shrink: 0;
}


/* Birthdays */
.birthday-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
}

.birthday-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: #92400e;
}

.birthday-info {
    flex: 1;
}

.birthday-name {
    font-weight: 500;
    color: var(--text);
    font-size: 0.9rem;
}

.birthday-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.birthday-days {
    background: #fef3c7;
    color: #92400e;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-lg);
    font-size: 0.75rem;
    font-weight: 600;
}

.birthday-days.today {
    background: #fde68a;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Calendar event content */
.fc-event-content {
    padding: 2px;
    overflow: hidden;
    height: 100%;
}

.fc-event-title {
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fc-event-participants {
    font-size: 0.7rem;
    opacity: 0.9;
    margin-top: 1px;
}

.fc-event-birthday {
    padding: 2px 4px;
    font-size: 0.85em;
}

/* FullCalendar overrides */
.fc {
    max-width: 100%;
}

.fc-toolbar-title {
    font-size: 1.15rem !important;
    font-weight: 600 !important;
}

.fc-button-primary {
    background-color: transparent !important;
    border-color: var(--accent) !important;
    color: var(--accent) !important;
    font-weight: 500 !important;
    font-size: 0.85rem !important;
}

.fc-button-primary:hover {
    background-color: rgba(var(--primary-rgb), 0.1) !important;
}

.fc-button-primary.fc-button-active,
.fc-button-primary:active {
    background-color: var(--accent) !important;
    color: white !important;
}

.fc-today-button,
.fc-prev-button,
.fc-next-button {
    background-color: var(--accent) !important;
    color: white !important;
}

.fc-event {
    border-radius: 4px !important;
    border: none !important;
    padding: 2px 4px !important;
    overflow: hidden !important;
}

.fc-timegrid-event .fc-event-main {
    overflow: hidden !important;
}

.fc-daygrid-event {
    padding: 2px 6px !important;
}

.fc-col-header-cell {
    background: var(--warm) !important;
    font-weight: 600 !important;
    font-size: 0.85rem !important;
}

.fc-timegrid-now-indicator-line {
    border-color: var(--color-danger) !important;
    border-width: 2px !important;
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-main {
        grid-template-columns: 1fr;
    }

    .dashboard-sidebar {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }

    .dashboard {
        display: flex;
        flex-direction: column;
    }

    .dashboard-header {
        order: 1;
        flex-direction: column;
        gap: 1rem;
    }

    .dashboard-actions {
        width: 100%;
    }

    .btn-action {
        flex: 1;
        justify-content: center;
    }

    /* A venir en haut */
    .dashboard-sidebar {
        display: contents;
    }

    .sidebar-upcoming {
        order: 2;
        margin-bottom: 1rem;
    }

    .sidebar-today {
        order: 5;
    }

    .sidebar-card:not(.sidebar-upcoming):not(.sidebar-today) {
        order: 6;
    }

    /* Calendar */
    .dashboard-main {
        display: contents;
    }

    .calendar-card {
        order: 3;
        margin-bottom: 1rem;
    }

    /* FullCalendar mobile fixes */
    .fc .fc-toolbar {
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
    }

    .fc .fc-toolbar-chunk {
        display: flex;
    }

    .fc .fc-toolbar-title {
        font-size: 0.95rem !important;
        width: 100%;
        text-align: center;
        order: -1;
        margin: 0 0 0.25rem 0 !important;
    }

    .fc-button {
        padding: 0.35rem 0.5rem !important;
        font-size: 0.75rem !important;
    }

    .fc-today-button {
        display: none !important;
    }

    .calendar-card {
        padding: 1rem;
    }

    /* Let the JS `height: 'auto'` govern: forcing 450px squeezed a 12-hour
       day grid into ~35px/hour, making 30-min events unreadable/untappable. */
    #calendar {
        height: auto;
    }
}

@media (max-width: 480px) {
    .fc .fc-toolbar-title {
        font-size: 0.85rem !important;
    }

    .fc-button {
        padding: 0.25rem 0.4rem !important;
        font-size: 0.7rem !important;
    }

    #calendar {
        height: 400px;
    }
}

/* Quick Stats */
.quick-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.quick-stat {
    text-align: center;
    padding: 0.75rem;
    background: var(--warm);
    border-radius: var(--radius-md);
}
.quick-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}
.quick-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Weekly Stats Widget */
.dashboard-main-zone {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Pending members card */
.pending-members-card {
    background: white;
    border-radius: var(--radius-lg, 12px);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-card, 0 1px 3px rgba(0,0,0,0.08));
}

.pending-members-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.pending-members-header h3 {
    margin: 0;
    font-size: 0.95rem;
}

.pending-members-count {
    background: #fef3c7;
    color: #92400e;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
}

.pending-member {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    transition: opacity 0.3s;
}

.pending-member:last-child { border-bottom: none; }

.pending-member-info a {
    font-weight: 500;
    color: var(--text, var(--color-text));
    text-decoration: none;
}

.pending-member-info a:hover { color: var(--accent, var(--primary-color)); }

.pending-member-date {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted, var(--color-text-muted));
}

.weekly-stats-card {
    background: white;
    border-radius: var(--radius-lg, 12px);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-card, 0 1px 3px rgba(0,0,0,0.08));
}

.weekly-stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.weekly-stats-header h3 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text, var(--color-text));
}

.weekly-stats-link {
    font-size: 0.8rem;
    color: var(--accent, var(--primary-color));
    text-decoration: none;
}

.weekly-stats-link:hover { text-decoration: underline; }

.weekly-stats-grid {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.weekly-stat {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 140px;
    padding: 0.75rem;
    background: var(--warm, #f9fafb);
    border-radius: 10px;
}

.weekly-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.weekly-stat-content {
    min-width: 0;
}

.weekly-stat-value {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--dark-color);
    line-height: 1.2;
}

.weekly-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted, var(--color-text-muted));
}

@media (max-width: 768px) {
    .weekly-stats-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

/* Quick Links */
.quick-links-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}
.quick-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem;
    background: var(--warm);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    transition: all 0.15s;
}
.quick-link:hover {
    background: var(--accent-light);
    color: var(--accent);
}

/* Edit Mode */
/* Activity Modal */
.act-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    transition: background 0.2s ease;
}

.act-modal.is-open {
    background: rgba(0, 0, 0, 0.5);
}

.act-modal-card {
    background: white;
    border-radius: 16px;
    max-width: 480px;
    width: 92%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: translateY(20px) scale(0.97);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

.act-modal.is-open .act-modal-card {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Banner */
.act-modal-banner {
    position: relative;
    min-height: 80px;
    background-size: cover;
    background-position: center;
    background-color: var(--cat-color, var(--primary-color));
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
}

.act-modal-banner.has-image {
    min-height: 180px;
}

.act-modal-banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0, 0, 0, 0.15) 40%,
        rgba(0, 0, 0, 0.55) 100%
    );
    pointer-events: none;
}

.act-modal-banner:not(.has-image) .act-modal-banner-overlay {
    background: linear-gradient(
        135deg,
        var(--cat-color, var(--primary-color)) 0%,
        color-mix(in srgb, var(--cat-color, var(--primary-color)) 70%, #000) 100%
    );
}

.act-modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 2;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    line-height: 1;
}

.act-modal-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

.act-modal-banner-content {
    position: relative;
    z-index: 1;
    padding: 1rem 1.25rem;
}

.act-modal-cat-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    color: white;
    margin-bottom: 0.4rem;
}

.act-modal-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: white;
    line-height: 1.25;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Body */
.act-modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}

.act-modal-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.act-modal-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.65rem;
    background: var(--light-color);
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    color: var(--dark-color, #343a40);
    font-weight: 500;
}

.act-modal-desc {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    line-height: 1.65;
    white-space: pre-line;
    margin-bottom: 1rem;
}

.act-modal-gallery {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.act-modal-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s, transform 0.15s;
}

.act-modal-thumb:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.act-modal-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.act-modal-actions a {
    flex: 1;
    text-align: center;
}

@media (max-width: 480px) {
    .act-modal-card {
        width: 96%;
        max-height: 90vh;
    }

    .act-modal-banner.has-image {
        min-height: 140px;
    }

    .act-modal-title {
        font-size: 1.15rem;
    }
}

/* Members-to-confirm widget (dashboard) */
.members-to-confirm-card {
    background: white;
    border-radius: var(--radius-lg, 12px);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.members-to-confirm-sub {
    margin: 0.5rem 0 1rem;
    font-size: 0.85rem;
    color: var(--secondary-color);
}

.members-to-confirm-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.members-to-confirm-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0.9rem;
    background: #fefce8;
    border-left: 3px solid #f59e0b;
    border-radius: var(--radius-sm, 6px);
    transition: opacity 0.3s ease;
}

.members-to-confirm-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.members-to-confirm-name {
    color: var(--dark-color);
    font-weight: 600;
    font-size: 0.92rem;
    text-decoration: none;
}

.members-to-confirm-name:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.members-to-confirm-date {
    font-size: 0.78rem;
    color: #92400e;
}

.members-to-confirm-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .members-to-confirm-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .members-to-confirm-actions {
        width: 100%;
        justify-content: flex-end;
    }
}
