:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --secondary: #764ba2;
    --accent: #FF9800;
    --bg-color: #f0f2f5;
    --text-main: #2d3748;
    --text-light: #718096;
    --white: #ffffff;
    --success: #48bb78;
    --danger: #f56565;
    --radius: 16px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding-bottom: 80px; /* Espace pour le footer mobile si besoin */
}

/* --- Layout Principal --- */
.container {
    max-width: 1600px; /* Largeur max étendue pour Desktop */
    margin: 0 auto;
    padding: 20px;
}

/* --- Header --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 15px;
}
.app-title {
    font-size: 24px;
    font-weight: 800;
    margin: 0;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- Responsive Grid System (Bento Layout) --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

/* --- Cartes Spécifiques --- */
.card-hero {
    grid-column: span 12;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    position: relative;
    overflow: hidden;
    min-height: 180px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.card-hero::after {
    content: "🏊";
    position: absolute;
    right: -20px;
    bottom: -30px;
    font-size: 140px;
    opacity: 0.15;
    transform: rotate(-15deg);
    pointer-events: none;
}

.card-stats-global {
    grid-column: span 12;
    background: white;
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
}

/* Sur Desktop (> 1024px), on met Hero et Stats côte à côte */
@media (min-width: 1024px) {
    .card-hero { grid-column: span 6; }
    .card-stats-global { grid-column: span 6; }
}

/* --- Boutons d'Action --- */
.action-btn {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}
.action-btn:hover { background: #f7fafc; transform: translateY(-1px); }
.action-btn.primary { background: var(--text-main); color: white; border: none; }
.action-btn.primary:hover { background: #1a202c; }

/* --- Stats Cards Colorées (Mois) --- */
.stats-months-grid {
    grid-column: span 12;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}
.stat-box {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    transition: transform 0.2s;
    border-top: 4px solid transparent;
}
.stat-box:hover { transform: translateY(-3px); }
.stat-box.green { border-color: var(--success); }
.stat-box.blue { border-color: var(--primary); }
.stat-box-val { font-size: 32px; font-weight: 800; color: var(--text-main); line-height: 1; margin-bottom: 4px; }
.stat-box-label { font-size: 11px; text-transform: uppercase; color: var(--text-light); letter-spacing: 0.5px; font-weight: 700; }
.stat-box-sub { font-size: 12px; color: #a0aec0; margin-top: 10px; }

/* --- Tableau Activités --- */
.activity-table-card {
    grid-column: span 12;
    background: white;
    border-radius: var(--radius);
    padding: 0;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.table-header {
    background: #f8f9fa;
    padding: 15px 25px;
    font-weight: 700;
    color: var(--text-light);
    font-size: 12px;
    text-transform: uppercase;
    display: grid;
    grid-template-columns: 60px 2fr 1fr 1fr 100px; /* Layout Desktop */
    align-items: center;
    border-bottom: 1px solid #edf2f7;
}
.table-row {
    padding: 15px 25px;
    border-bottom: 1px solid #edf2f7;
    display: grid;
    grid-template-columns: 60px 2fr 1fr 1fr 100px; /* Layout Desktop */
    align-items: center;
    transition: background 0.1s;
}
.table-row:hover { background: #fcfcfc; }
.table-row:last-child { border-bottom: none; }

/* Badges */
.status-pill {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 0.5px;
}
.pill-manual { background: #fffaf0; color: #dd6b20; border: 1px solid #fbd38d; }
.pill-badge { background: #f0fff4; color: #276749; border: 1px solid #9ae6b4; }

/* --- Responsive Mobile (< 768px) --- */
@media (max-width: 768px) {
    .table-header { display: none; }
    .col-desktop-only { display: none; }
    .table-row {
        grid-template-columns: 50px 1fr auto; /* Icone | Info | Badge */
        gap: 15px;
        padding: 15px;
    }
    .mobile-date { display: block !important; }
    .app-header { justify-content: center; text-align: center; }
}

/* --- Console Debug --- */
#debug-console {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 35vh;
    background: #1a202c;
    color: #48bb78;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    padding: 15px;
    overflow-y: auto;
    z-index: 9999;
    border-top: 3px solid #48bb78;
    box-shadow: 0 -5px 25px rgba(0,0,0,0.5);
}
.debug-entry { margin-bottom: 6px; border-bottom: 1px solid #2d3748; padding-bottom: 4px; word-wrap: break-word; }
.debug-time { color: #718096; margin-right: 8px; font-weight: bold; }
.close-debug { position: absolute; top: 10px; right: 15px; background: #e53e3e; color: white; border: none; padding: 5px 10px; border-radius: 4px; cursor: pointer; font-weight: bold; }

/* --- Login Screen --- */
.login-screen {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    background: white;
}
