/* ============================================
   Ma Tribu - Styles v2.0
   Design: Moderne, épuré, chaleureux
   ============================================ */

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

/* --- Variables --- */
:root {
    --primary: #4A90A4;
    --primary-dark: #3A7A8E;
    --primary-light: #E8F4F8;
    --primary-glow: rgba(74, 144, 164, 0.15);
    --accent: #E8845C;
    --accent-light: #FFF0EB;
    --success: #22C55E;
    --success-light: #DCFCE7;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;

    --text: #0F172A;
    --text-secondary: #475569;
    --text-light: #64748B;
    --text-muted: #94A3B8;
    --bg: #F8FAFC;
    --bg-warm: #FAFAF8;
    --white: #FFFFFF;
    --border: #E2E8F0;
    --border-light: #F1F5F9;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

    --radius: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --nav-height: 68px;
    --header-height: 60px;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    display: block;
}

/* --- Auth Pages --- */
.auth-page {
    background: linear-gradient(160deg, #0F172A 0%, #1E293B 40%, #334155 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(74, 144, 164, 0.15), transparent 70%);
    border-radius: 50%;
}

.auth-page::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(232, 132, 92, 0.1), transparent 70%);
    border-radius: 50%;
}

.auth-page main {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

.auth-container {
    background: var(--white);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo h1 {
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: -1px;
}

.auth-subtitle {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 0.35rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-link {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

/* --- Formulaires --- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font);
    color: var(--text);
    background: var(--white);
    transition: all 0.2s ease;
    -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

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

/* --- Boutons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(74, 144, 164, 0.25);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(74, 144, 164, 0.35);
    transform: translateY(-1px);
}

.btn-accent {
    background: var(--accent);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(232, 132, 92, 0.25);
}

.btn-accent:hover {
    background: #d4743f;
    transform: translateY(-1px);
}

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

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.btn-sm {
    padding: 0.45rem 0.9rem;
    font-size: 0.8rem;
    border-radius: var(--radius-xs);
}

.btn-full {
    width: 100%;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-sm);
}

.btn-fab {
    position: fixed;
    bottom: calc(var(--nav-height) + 1.25rem);
    right: 1.25rem;
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: var(--accent);
    color: var(--white);
    box-shadow: 0 8px 24px rgba(232, 132, 92, 0.4);
    z-index: 50;
    font-size: 1.5rem;
}

.btn-fab:hover {
    box-shadow: 0 12px 32px rgba(232, 132, 92, 0.5);
    transform: translateY(-2px) scale(1.02);
}

/* --- Alertes --- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-error {
    background: var(--danger-light);
    color: #B91C1C;
}

.alert-success {
    background: var(--success-light);
    color: #166534;
}

/* --- App Layout --- */
.app-page {
    background: var(--bg);
}

.app-page main {
    padding: 0;
    animation: pageIn 0.25s ease;
}

@keyframes pageIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

main.has-nav {
    padding-bottom: var(--nav-height);
}

/* Conteneur centré pour desktop */
.page-header,
.stats-grid,
.list-section,
.setup-container {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Page Header --- */
.page-header {
    background: var(--white);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.9);
}

.page-header h1 {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.3px;
}

.page-header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* --- Bottom Navigation --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 600;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    letter-spacing: 0.02em;
}

.nav-item svg {
    width: 22px;
    height: 22px;
    transition: transform 0.2s;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item.active svg {
    transform: scale(1.1);
}

/* --- Cards --- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
    box-shadow: var(--shadow);
}

.card + .card {
    margin-top: 0.75rem;
}

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

.card-header h2 {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.card-stat {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 500;
}

/* --- Avatar --- */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    color: var(--white);
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
}

.avatar-sm {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
    border-radius: 8px;
}

.avatar-lg {
    width: 48px;
    height: 48px;
    font-size: 1.1rem;
    border-radius: 14px;
}

/* --- Lists --- */
.list-section {
    padding: 1rem 1.5rem;
}

.list-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.15s;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:active {
    background: var(--bg);
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.1px;
}

.list-item-subtitle {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.1rem;
}

/* --- Checkbox custom --- */
.checkbox {
    position: relative;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.checkbox input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 1;
}

.checkbox .checkmark {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.checkbox input:checked + .checkmark {
    background: var(--success);
    border-color: var(--success);
    animation: checkBounce 0.35s ease;
}

@keyframes checkBounce {
    0% { transform: scale(1); }
    40% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.checkbox input:checked + .checkmark::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid var(--white);
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}

.checked-item .list-item-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* --- Priority badges --- */
.priority {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 100px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.priority-high { background: var(--danger-light); color: var(--danger); }
.priority-medium { background: var(--warning-light); color: #B45309; }
.priority-low { background: var(--primary-light); color: var(--primary); }

/* --- Stats grid (dashboard) --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    padding: 1rem 1.5rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.1rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: -1px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.2rem;
    font-weight: 500;
}

/* --- Modal / Bottom Sheet --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
    animation: fadeOverlay 0.2s ease;
}

@keyframes fadeOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--white);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 90dvh;
    overflow-y: auto;
    padding: 1.75rem 1.5rem;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.3px;
}

.modal-close {
    background: var(--bg);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--border-light);
    color: var(--text);
}

/* --- Invite code --- */
.invite-code {
    background: linear-gradient(135deg, var(--primary-light), #dceef4);
    border-radius: var(--radius-md);
    padding: 1.1rem;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 4px;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.invite-code:hover {
    border-color: var(--primary);
}

.invite-code:active {
    transform: scale(0.98);
}

/* --- Empty state --- */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state p {
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* --- Household setup --- */
.setup-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.setup-container h1 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.setup-container p {
    color: var(--text-light);
    margin-bottom: 2rem;
}

.setup-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.setup-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1.5px solid var(--border-light);
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
}

.setup-option:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow), 0 0 0 3px var(--primary-glow);
}

.setup-option:active {
    transform: scale(0.99);
}

.setup-option-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.setup-option-text h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
}

.setup-option-text p {
    font-size: 0.8rem;
    color: var(--text-light);
    margin: 0;
}

/* --- Members list --- */
.members-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* --- Qui fait quoi ? --- */
.whodoswhat-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-light);
    transition: box-shadow 0.2s;
}

.whodoswhat-card:hover {
    box-shadow: var(--shadow-sm);
}

.whodoswhat-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

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

.whodoswhat-name {
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: -0.1px;
}

.whodoswhat-sub {
    font-size: 0.75rem;
    color: var(--text-light);
}

.whodoswhat-percent {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--primary);
    min-width: 50px;
    text-align: right;
    letter-spacing: -0.5px;
}

.progress-bar {
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 2px;
}

.whodoswhat-pending {
    font-size: 0.73rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

.overdue-badge {
    display: inline-flex;
    align-items: center;
    background: var(--danger-light);
    color: var(--danger);
    padding: 0.1rem 0.45rem;
    border-radius: 100px;
    font-size: 0.65rem;
    font-weight: 700;
    margin-left: 0.25rem;
}

/* --- Delete button inline --- */
.btn-delete-item {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-xs);
    opacity: 0;
    transition: all 0.2s;
}

.list-item:hover .btn-delete-item {
    opacity: 1;
}

.btn-delete-item:hover {
    color: var(--danger);
    background: var(--danger-light);
}

@media (hover: none) {
    .btn-delete-item {
        opacity: 0.5;
    }
}

/* --- Photo grid --- */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    padding: 3px;
}

@media (min-width: 768px) {
    .photo-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
        padding: 1rem;
        max-width: 900px;
        margin: 0 auto;
    }
}

@media (min-width: 1200px) {
    .photo-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.photo-grid-item {
    aspect-ratio: 1;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: 4px;
}

.photo-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.photo-grid-item:hover img {
    transform: scale(1.08);
}

/* --- Lightbox --- */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.96);
    z-index: 300;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.lightbox.active {
    display: flex;
    animation: fadeOverlay 0.2s ease;
}

.lightbox-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
    z-index: 2;
}

.lightbox-info {
    color: var(--white);
    font-size: 0.85rem;
    font-weight: 500;
}

.lightbox-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--white);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    opacity: 0.8;
    transition: all 0.2s;
}

.lightbox-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

.lightbox img {
    max-width: 95%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 1rem 0.75rem;
    opacity: 0.6;
    z-index: 2;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.lightbox-nav:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev { left: 0.5rem; }
.lightbox-next { right: 0.5rem; }

/* --- Upload progress --- */
.upload-progress {
    position: fixed;
    bottom: calc(var(--nav-height) + 0.75rem);
    left: 1rem;
    right: 1rem;
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    box-shadow: var(--shadow-lg);
    z-index: 150;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.upload-progress-bar {
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s;
    position: absolute;
    bottom: 0;
    left: 0;
}

/* --- Calendar day active --- */
.cal-day {
    transition: background 0.15s;
}

.cal-day:hover {
    background: var(--bg) !important;
}

.cal-day.selected {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
    font-weight: 700 !important;
}

/* --- Toast notification --- */
.toast {
    position: fixed;
    bottom: calc(var(--nav-height) + 1rem);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text);
    color: var(--white);
    padding: 0.7rem 1.5rem;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 500;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    box-shadow: var(--shadow-lg);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* --- Skeleton loading --- */
.skeleton {
    background: linear-gradient(90deg, var(--border-light) 25%, #eef2f6 50%, var(--border-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* --- Utilities --- */
.text-center { text-align: center; }
.text-muted { color: var(--text-light); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.px { padding-left: 1.5rem; padding-right: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.hidden { display: none !important; }

/* --- Responsive tablet+ --- */
@media (min-width: 768px) {
    .bottom-nav {
        top: 0;
        bottom: auto;
        border-top: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        justify-content: center;
        gap: 0.5rem;
        height: var(--header-height);
        padding-bottom: 0;
        background: rgba(255, 255, 255, 0.92);
    }

    .nav-item {
        flex-direction: row;
        gap: 0.5rem;
        font-size: 0.8rem;
        padding: 0.6rem 1rem;
        border-radius: var(--radius-sm);
    }

    .nav-item:hover {
        color: var(--primary);
        background: var(--primary-light);
    }

    .nav-item.active {
        background: var(--primary-light);
    }

    main.has-nav {
        padding-bottom: 0;
        padding-top: var(--header-height);
    }

    .btn-fab {
        bottom: 2rem;
        right: 2rem;
    }

    .modal {
        border-radius: 20px;
        margin-bottom: auto;
        margin-top: 10vh;
        max-width: 480px;
        box-shadow: var(--shadow-lg);
    }

    .modal-overlay {
        align-items: flex-start;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .page-header {
        border-bottom: 1px solid var(--border-light);
    }
}

/* --- Safe area iOS --- */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(var(--nav-height) + env(safe-area-inset-bottom));
    }

    main.has-nav {
        padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
    }
}
