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

/* Utility: desktop/mobile visibility */
.mobile-only { display: none; }
.desktop-only { display: block; }

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --secondary: #0f172a;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: rgba(37, 99, 235, 0.15);
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --surface: #ffffff;
    --bg: #f1f5f9;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --text: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --success: #059669;
    --success-light: #ecfdf5;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --info: #0284c7;
    --info-light: #f0f9ff;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--bg); color: var(--text); line-height: 1.65; font-size: 15px; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ======================== SCROLLBAR ======================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ======================== LOGIN PAGE ======================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--secondary);
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    top: -40%; right: -20%;
    width: 700px; height: 700px;
    background: radial-gradient(circle, rgba(37,99,235,0.15) 0%, transparent 70%);
    border-radius: 50%;
}
.login-page::after {
    content: '';
    position: absolute;
    bottom: -30%; left: -10%;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(5,150,105,0.1) 0%, transparent 70%);
    border-radius: 50%;
}
.login-container { position: relative; z-index: 1; width: 100%; max-width: 420px; padding: 20px; }
.login-card {
    background: rgba(255,255,255,0.03);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 48px 40px;
}
.login-logo { text-align: center; margin-bottom: 36px; }
.login-logo h1 { font-size: 28px; font-weight: 800; color: #ffffff; letter-spacing: -0.5px; }
.login-logo p { color: var(--sidebar-text); font-size: 14px; margin-top: 6px; }
.login-card .form-group { margin-bottom: 20px; }
.login-card label { display: block; color: #cbd5e1; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.login-card input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: #ffffff;
    font-size: 14px;
    transition: var(--transition);
    outline: none;
}
.login-card input::placeholder { color: #475569; }
.login-card input:focus { border-color: var(--primary); background: rgba(37,99,235,0.08); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
.login-btn {
    width: 100%;
    padding: 13px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    transition: var(--transition);
    margin-top: 8px;
}
.login-btn:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,0.35); }
.login-footer { text-align: center; margin-top: 24px; color: var(--sidebar-text); font-size: 13px; }
.login-footer a { color: var(--primary); font-weight: 500; }
.login-footer a:hover { text-decoration: underline; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 20px;
    font-weight: 500;
}
.alert.alert-success { background: rgba(5,150,105,0.12); color: #34d399; border: 1px solid rgba(5,150,105,0.2); }
.alert.alert-error { background: rgba(220,38,38,0.12); color: #f87171; border: 1px solid rgba(220,38,38,0.2); }

/* ======================== LAYOUT ======================== */
.dashboard { display: flex; min-height: 100vh; }
.main-content { flex: 1; margin-left: 260px; padding: 28px 32px; min-height: 100vh; }

/* ======================== SIDEBAR ======================== */
.sidebar {
    position: fixed;
    left: 0; top: 0;
    width: 260px;
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 100;
    border-right: 1px solid rgba(255,255,255,0.06);
}
.sidebar-header {
    padding: 24px 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sidebar-header h2 { color: #ffffff; font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; min-height: 0; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 16px;
    border-radius: 8px;
    color: var(--sidebar-text);
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    text-decoration: none;
}
.nav-item:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.nav-item.active { background: var(--sidebar-active); color: var(--primary); font-weight: 600; }
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; opacity: 0.7; }
.nav-item.active svg { opacity: 1; }
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}
.user-avatar {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.user-name { color: #e2e8f0; font-weight: 600; font-size: 13px; line-height: 1.3; }
.user-email { color: var(--sidebar-text); font-size: 11px; }
.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: var(--sidebar-text);
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    margin-top: 10px;
}
.logout-btn:hover { background: rgba(220,38,38,0.1); color: #f87171; border-color: rgba(220,38,38,0.2); }
.logout-btn svg { width: 16px; height: 16px; }

/* ======================== PAGE HEADER ======================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; color: var(--text); }
.page-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ======================== BUTTONS ======================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,0.3); }
.btn-secondary { background: var(--surface); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); border-color: #cbd5e1; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #047857; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: none; color: var(--text-secondary); padding: 8px 12px; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-icon { padding: 8px; border-radius: 8px; background: none; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-icon:hover { background: var(--bg); color: var(--text); }

/* ======================== CARDS ======================== */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
}
.card-title { font-size: 16px; font-weight: 600; color: var(--text); }
.card-body { padding: 20px 24px; }

/* ======================== STATS GRID ======================== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
}
.stat-card.stat-blue::before { background: var(--primary); }
.stat-card.stat-green::before { background: var(--success); }
.stat-card.stat-amber::before { background: var(--warning); }
.stat-card.stat-purple::before { background: #7c3aed; }
.stat-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.stat-label { font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.stat-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.icon-blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.icon-green { background: var(--success-light); color: var(--success); }
.stat-icon.icon-amber { background: var(--warning-light); color: var(--warning); }
.stat-icon.icon-purple { background: #f5f3ff; color: #7c3aed; }
.stat-value { font-size: 30px; font-weight: 800; letter-spacing: -1px; color: var(--text); line-height: 1.1; }
.stat-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ======================== CHARTS ======================== */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.chart-container { position: relative; padding: 8px; }
.chart-container canvas { max-height: 260px; }

/* ======================== SEARCH ======================== */
.search-bar { display: flex; align-items: center; gap: 10px; }
.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.search-input-wrapper svg { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
.search-input-wrapper input,
#search-input {
    padding: 10px 14px 10px 38px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    font-size: 14px;
    width: 260px;
    transition: var(--transition);
    outline: none;
    color: var(--text);
}
.search-input-wrapper input:focus,
#search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.filter-select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    font-size: 14px;
    color: var(--text);
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}
.filter-select:focus { border-color: var(--primary); }

/* ======================== TABLE ======================== */
.table { width: 100%; border-collapse: collapse; }
.table thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    color: var(--text);
    vertical-align: middle;
}
.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

/* ======================== BADGES ======================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-amber { background: var(--warning-light); color: var(--warning); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-gray { background: #f1f5f9; color: var(--text-secondary); }
.badge-purple { background: #f5f3ff; color: #7c3aed; }

/* ======================== PROGRESS BAR ======================== */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: height 0.2s;
}
.progress-bar:hover {
    height: 12px;
    box-shadow: 0 0 0 2px var(--primary-light);
}
.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
    background: var(--primary);
}
.progress-fill.progress-low { background: var(--danger); }
.progress-fill.progress-mid { background: var(--warning); }
.progress-fill.progress-high { background: var(--success); }
.progress-text { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-top: 4px; }

/* ======================== MODALS ======================== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--surface);
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}
.modal-lg { max-width: 680px; }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px 0;
}
.modal-title { font-size: 20px; font-weight: 700; }
.modal-close {
    width: 32px; height: 32px;
    border-radius: 8px;
    border: none;
    background: var(--bg);
    color: var(--text-secondary);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); }
.modal-body { padding: 24px 28px; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 28px 24px;
}

/* ======================== FORMS ======================== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: 15px;
    transition: var(--transition);
    outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ======================== KANBAN ======================== */
.kanban-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; min-height: 400px; }
.kanban-column {
    background: var(--bg);
    border-radius: var(--radius-lg);
    padding: 16px;
    min-height: 200px;
}
.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}
.kanban-column.col-todo .kanban-column-header { border-color: var(--text-muted); }
.kanban-column.col-progress .kanban-column-header { border-color: var(--primary); }
.kanban-column.col-blocked .kanban-column-header { border-color: var(--danger); }
.kanban-column.col-done .kanban-column-header { border-color: var(--success); }
.kanban-column-title { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.kanban-count {
    font-size: 11px;
    font-weight: 700;
    background: var(--border);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 10px;
}
.kanban-cards { display: flex; flex-direction: column; gap: 10px; min-height: 100px; }
.kanban-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    cursor: grab;
    transition: var(--transition);
}
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kanban-card.dragging { opacity: 0.5; transform: rotate(2deg); }
.kanban-card-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.kanban-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kanban-card-date { font-size: 11px; color: var(--text-muted); }
.kanban-column.drag-over { background: var(--primary-light); border: 2px dashed var(--primary); }

/* ======================== TABS ======================== */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border-light); margin-bottom: 24px; }
.tab-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); }
.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0; right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ======================== TIMELINE ======================== */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
    content: '';
    position: absolute;
    left: 8px; top: 4px; bottom: 4px;
    width: 2px;
    background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 20px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
    position: absolute;
    left: -24px; top: 4px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--surface);
    box-shadow: 0 0 0 2px var(--primary-light);
}
.timeline-dot.dot-green { background: var(--success); box-shadow: 0 0 0 2px var(--success-light); }
.timeline-dot.dot-amber { background: var(--warning); box-shadow: 0 0 0 2px var(--warning-light); }
.timeline-dot.dot-red { background: var(--danger); box-shadow: 0 0 0 2px var(--danger-light); }
.timeline-content { font-size: 14px; color: var(--text); }
.timeline-date { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ======================== COMMENTS ======================== */
.comment-box { display: flex; gap: 12px; margin-bottom: 24px; }
.comment-box textarea {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    resize: none;
    height: 44px;
    font-size: 13px;
    transition: var(--transition);
    outline: none;
}
.comment-box textarea:focus { border-color: var(--primary); height: 80px; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.comment-list { display: flex; flex-direction: column; gap: 16px; }
.comment-item { display: flex; gap: 12px; }
.comment-avatar {
    width: 34px; height: 34px;
    border-radius: 8px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}
.comment-body { flex: 1; }
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-author { font-size: 14px; font-weight: 600; color: var(--text); }
.comment-time { font-size: 12px; color: var(--text-muted); }
.comment-text { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }
.comment-delete {
    background: none; border: none;
    color: var(--text-muted); font-size: 12px;
    padding: 2px 6px; border-radius: 4px;
    transition: var(--transition);
}
.comment-delete:hover { background: var(--danger-light); color: var(--danger); }

/* ======================== CHANTIER DETAIL ======================== */
.chantier-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
}
.chantier-info { flex: 1; }
.chantier-name { font-size: 24px; font-weight: 700; letter-spacing: -0.3px; margin-bottom: 8px; }
.chantier-meta { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.chantier-meta-item { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-secondary); }
.chantier-meta-item svg { width: 14px; height: 14px; opacity: 0.6; }
.chantier-sidebar-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    min-width: 220px;
}
.sidebar-stat { margin-bottom: 16px; }
.sidebar-stat:last-child { margin-bottom: 0; }
.sidebar-stat-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 4px; }
.sidebar-stat-value { font-size: 22px; font-weight: 700; color: var(--text); }

/* ======================== TASK LIST ======================== */
.task-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    margin-bottom: 8px;
    transition: var(--transition);
    background: var(--surface);
}
.task-item:hover { border-color: var(--border); box-shadow: var(--shadow-sm); }
.task-checkbox {
    width: 20px; height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}
.task-checkbox:hover { border-color: var(--primary); }
.task-checkbox.checked { background: var(--success); border-color: var(--success); }
.task-content { flex: 1; min-width: 0; }
.task-title { font-size: 15px; font-weight: 500; color: var(--text); }
.task-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.task-actions { display: flex; gap: 6px; }

/* ======================== EQUIPES ======================== */
.teams-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.team-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
}
.team-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.team-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-light);
}
.team-name { font-size: 16px; font-weight: 700; }
.team-color { width: 14px; height: 14px; border-radius: 4px; }
.team-members { padding: 12px 20px; }
.member-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}
.member-item:last-child { border-bottom: none; }
.member-info { display: flex; align-items: center; gap: 10px; }
.member-avatar {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
}
.member-name { font-size: 14px; font-weight: 600; }
.member-role { font-size: 12px; color: var(--text-muted); }

/* ======================== CALENDAR ======================== */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.calendar-nav { display: flex; align-items: center; gap: 16px; }
.calendar-nav button {
    width: 36px; height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.calendar-nav button:hover { background: var(--bg); }
.calendar-month { font-size: 20px; font-weight: 700; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.calendar-day-header {
    padding: 12px;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.calendar-day {
    min-height: 100px;
    padding: 8px;
    border-bottom: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
    background: var(--surface);
    transition: var(--transition);
    cursor: pointer;
}
.calendar-day:hover { background: #f8fafc; }
.calendar-day:nth-child(7n) { border-right: none; }
.calendar-day.today { background: var(--primary-light); }
.calendar-day.other-month { background: var(--bg); opacity: 0.5; }
.calendar-day .day-number { font-size: 14px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.calendar-day.today .day-number { color: var(--primary); }
.calendar-event {
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: white;
    background: var(--primary);
}
.calendar-event.event-task { background: var(--warning); }

/* ======================== PROFIL ======================== */
.profile-grid { display: grid; grid-template-columns: 1fr 380px; gap: 24px; }
.profile-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.profile-stat {
    text-align: center;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.profile-stat-value { font-size: 26px; font-weight: 800; color: var(--text); }
.profile-stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ======================== EMPTY STATE ======================== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; color: var(--border); margin-bottom: 16px; }
.empty-state h3 { font-size: 17px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 14px; margin-bottom: 20px; }

/* ======================== TOAST ======================== */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 14px 20px;
    background: var(--text);
    color: white;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}
.toast.toast-success { background: var(--success); }
.toast.toast-error { background: var(--danger); }
.toast-close { background: none; border: none; color: rgba(255,255,255,0.7); font-size: 16px; cursor: pointer; padding: 0 0 0 8px; }

/* ======================== LOADING ======================== */
.loading-container { display: flex; align-items: center; justify-content: center; padding: 40px; }
.spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ======================== ANIMATIONS ======================== */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }


/* ======================== CHANTIER CARDS (Dashboard) ======================== */
.chantiers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 14px;
}
.chantier-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 18px;
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
}
.chantier-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(37,99,235,0.08);
    transform: translateY(-1px);
}
.chantier-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}
.chantier-card-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}
.chantier-card-ref {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
.chantier-card-status {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}
.chantier-card-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.chantier-card-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}
.chantier-card-detail svg {
    color: var(--text-muted);
    flex-shrink: 0;
}
.chantier-card-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.chantier-card-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
}
.chantier-card-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
    background: var(--primary);
}
.chantier-card-progress-fill.progress-low { background: #ef4444; }
.chantier-card-progress-fill.progress-mid { background: #f59e0b; }
.chantier-card-progress-fill.progress-high { background: #10b981; }
.chantier-card-progress-text {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 32px;
    text-align: right;
}
.chantier-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
}
.chantier-card-maps {
    display: flex;
    gap: 6px;
}
.chantier-map-btn {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    text-decoration: none;
    transition: opacity 0.15s;
}
.chantier-map-btn:hover { opacity: 0.8; }
.chantier-map-google {
    color: #4285F4;
    background: rgba(66,133,244,0.08);
}
.chantier-map-waze {
    color: #33CCFF;
    background: rgba(51,204,255,0.08);
}
.chantier-card-actions {
    display: flex;
    gap: 4px;
}

@media (max-width: 768px) {
    .chantiers-grid { grid-template-columns: 1fr; gap: 10px; }
    .chantier-card { padding: 14px; }
    .chantier-card-name { font-size: 15px; }
}

/* ======================== RESPONSIVE ======================== */
/* ======================== RESPONSIVE - TABLET (768-1024px) ======================== */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
    .kanban-board { grid-template-columns: repeat(2, 1fr); }
    .profile-grid { grid-template-columns: 1fr; }
    .profile-stats { grid-template-columns: repeat(2, 1fr); }
    .main-content { padding: 24px 20px; }
    .welcome-banner { padding: 22px 24px; }
    .welcome-title { font-size: 18px; }
    .modal { max-width: 90vw; }
    .table { font-size: 13px; }
    .table th, .table td { padding: 10px 8px; }
    .fichiers-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .fields-grid { grid-template-columns: 1fr 1fr; gap: 10px 12px; }
}

/* ======================== RESPONSIVE - MOBILE (<768px) ======================== */
@media (max-width: 768px) {
    /* Sidebar mobile avec overlay */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
        width: 280px;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0,0,0,0.4);
    }
    .mobile-menu-toggle { display: none; }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99;
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
    }
    .sidebar-overlay.active { display: block; }

    /* Layout principal */
    .main-content {
        margin-left: 0;
        padding: 16px 14px;
        padding-top: 68px;
        min-height: 100vh;
    }
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 18px;
    }
    .page-title { font-size: 22px; }
    .page-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Stats cards - more compact on mobile */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 14px; border-radius: 12px; }
    .stat-value { font-size: 22px; }
    .stat-label { font-size: 12px; }
    .stat-sub { font-size: 11px; }
    .stat-icon { width: 32px; height: 32px; border-radius: 8px; }
    .stat-icon svg { width: 15px; height: 15px; }

    /* Charts more compact */
    .charts-grid { grid-template-columns: 1fr; gap: 12px; }
    .chart-container canvas { max-height: 180px; }

    /* Cards more compact */
    .card { border-radius: 12px; margin-bottom: 12px; }
    .card-header {
        padding: 14px 16px;
        flex-direction: row;
        gap: 8px;
        align-items: center;
    }
    .card-body { padding: 14px 16px; }
    .card-title { font-size: 15px; }

    /* Kanban */
    .kanban-board { grid-template-columns: 1fr; gap: 12px; }
    .kanban-column { min-height: 100px; }

    /* Forms */
    .form-row, .form-row-3 { grid-template-columns: 1fr; gap: 10px; }
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 12px 14px;
        font-size: 16px; /* empêche le zoom iOS */
    }
    .form-group label { font-size: 14px; margin-bottom: 6px; }

    /* Buttons - taille tactile */
    .btn {
        font-size: 14px;
        padding: 11px 16px;
        min-height: 44px;
        border-radius: 10px;
    }
    .btn-sm { font-size: 13px; padding: 9px 14px; min-height: 40px; }
    .btn-icon { width: 40px; height: 40px; min-width: 40px; }

    /* Search bar */
    .search-bar {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }
    .search-input-wrapper { width: 100%; }
    .search-input-wrapper input, #search-input {
        width: 100%;
        padding: 12px 14px 12px 38px;
        font-size: 16px;
    }
    .filter-select {
        width: 100%;
        padding: 12px 14px;
        font-size: 16px;
        min-height: 44px;
    }

    /* Dashboard toolbar */
    .dash-toolbar { flex-direction: column; gap: 8px; }
    .hide-mobile { display: none !important; }

    /* Table: hide columns on mobile */
    .table th.hide-mobile, .table td.hide-mobile { display: none; }

    /* Desktop/Mobile visibility */
    .desktop-only { display: none !important; }
    .mobile-only { display: block !important; }

    /* Document mobile cards */
    .doc-mobile-card {
        display: block;
        background: var(--card-bg, white);
        border: 1px solid var(--border, #e2e8f0);
        border-radius: 12px;
        padding: 14px 16px;
        margin-bottom: 10px;
        transition: all 0.2s;
    }
    .doc-mobile-card:active {
        transform: scale(0.98);
        background: var(--hover-bg, #f8fafc);
    }
    .doc-mobile-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 8px;
    }
    .doc-mobile-num {
        font-size: 15px;
        font-weight: 700;
        color: var(--text, #0f172a);
        margin-bottom: 4px;
    }
    .doc-mobile-info {
        display: flex;
        justify-content: space-between;
        font-size: 12px;
        color: var(--text-muted, #64748b);
    }

    /* Welcome banner */
    .welcome-banner {
        flex-direction: column;
        gap: 14px;
        text-align: center;
        padding: 20px 18px;
        border-radius: 14px;
    }
    .welcome-title { font-size: 17px; }
    .welcome-subtitle { font-size: 12px; }
    .welcome-actions {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    /* KPIs - compact */

    /* Table - responsive */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -14px;
        padding: 0 14px;
    }
    .table { min-width: 400px; font-size: 12px; }
    .table th, .table td { padding: 10px 8px; white-space: nowrap; }
    .table th.hide-mobile, .table td.hide-mobile { display: none; }
    .task-actions { gap: 4px; }

    /* KPIs */
    .kpi-grid { flex-wrap: wrap; gap: 12px; justify-content: center; }
    .kpi-circle { width: 70px; height: 70px; }
    .kpi-svg { width: 70px; height: 70px; }
    .kpi-value { font-size: 14px; }
    .kpi-label { font-size: 10px; }

    /* Modals - plein écran mobile */
    .modal-overlay { padding: 0; align-items: flex-end; }
    .modal {
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        max-height: 92vh;
        animation: slideUpMobile 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }
    @keyframes slideUpMobile {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
    .modal-header { padding: 20px 20px 0; }
    .modal-body { padding: 18px 20px; max-height: 65vh; overflow-y: auto; }
    .modal-footer {
        padding: 14px 20px 24px;
        flex-direction: column;
        gap: 8px;
    }
    .modal-footer .btn { width: 100%; justify-content: center; }
    .modal-close { width: 36px; height: 36px; }

    /* Tabs responsive */
    .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; gap: 0; }
    .tab-btn { white-space: nowrap; font-size: 12px; padding: 10px 16px; flex-shrink: 0; }

    /* Profile page */
    .profile-grid { grid-template-columns: 1fr; }
    .profile-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .profile-stat { padding: 14px; }

    /* Customize panel mobile */
    .customize-panel { padding: 12px; }
    .customize-item { padding: 8px 10px; }
    .customize-label { font-size: 12px; }

    /* Activity grid on mobile */
    .charts-grid[style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }

    /* Widget blocks compact */
    .widget-block { margin-bottom: 12px; }

    /* Notifications panel */
    .notif-panel { width: 100vw; right: -14px; top: 48px; max-height: 70vh; }

    /* Entreprise page */
    .fields-grid { grid-template-columns: 1fr; gap: 10px; }
    .logo-zone { flex-direction: column; text-align: center; padding: 16px; }
    .logo-preview { width: 100px; height: 100px; margin: 0 auto; }
    .save-bar { padding: 12px 0; }
    .save-bar .btn { width: 100%; justify-content: center; }

    /* Gantt */
    .gantt-row-label { min-width: 90px; max-width: 90px; font-size: 10px; padding: 6px 8px; }

    /* Fichiers */
    .fichiers-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
    .fichier-preview { height: 80px; }

    /* Weather widget */
    #weather-widget { padding: 8px 12px; min-width: 110px; }
    #weather-widget #weather-icon { font-size: 22px; }
    #weather-widget #weather-temp { font-size: 16px; }

    /* Filter advanced */
    .filter-bar, #advanced-filters { flex-direction: column; gap: 8px; }
    .filter-bar .form-group, #advanced-filters .form-group { width: 100%; }

    /* Chantier header */
    .chantier-header { flex-direction: column; gap: 12px; }
    .chantier-header .page-actions { width: 100%; }
    .chantier-header .btn { flex: 1; justify-content: center; }

    /* Detail grids */
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }

    /* Toast positioning */
    .toast-container {
        bottom: 12px;
        right: 12px;
        left: 12px;
        max-width: none;
    }
    .toast { width: 100%; }
}

/* ======================== RESPONSIVE - SMALL PHONE (<480px) ======================== */
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; gap: 8px; }
    .stat-card {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 14px;
        padding: 14px 16px;
    }
    .stat-header { flex-direction: row-reverse; width: auto; margin-bottom: 0; flex-shrink: 0; }
    .stat-icon { width: 36px; height: 36px; }
    .stat-value { font-size: 22px; }
    .main-content { padding: 12px 10px; padding-top: 62px; }
    .welcome-banner { padding: 16px 14px; }
    .welcome-title { font-size: 17px; }
    .btn { font-size: 13px; padding: 10px 14px; }
    .table { min-width: 480px; }
    .kpi-grid { gap: 8px; }
    .kpi-circle { width: 60px; height: 60px; }
    .kpi-svg { width: 60px; height: 60px; }
    .kpi-value { font-size: 12px; }
    .don-amounts { grid-template-columns: 1fr 1fr; gap: 8px; }
    .don-amount-btn { padding: 14px 12px; font-size: 18px; }
}

/* ======================== DARK MODE ======================== */
body.dark-mode {
    --surface: #1e293b;
    --bg: #0f172a;
    --border: #334155;
    --border-light: #1e293b;
    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --primary-light: rgba(37,99,235,0.15);
    --success-light: rgba(5,150,105,0.15);
    --warning-light: rgba(217,119,6,0.15);
    --danger-light: rgba(220,38,38,0.15);
}
body.dark-mode .card { background: var(--surface); border-color: var(--border); }
body.dark-mode .modal { background: var(--surface); color: var(--text); }
body.dark-mode .modal-header { border-color: var(--border); }
body.dark-mode .modal-footer { border-color: var(--border); }
body.dark-mode input, body.dark-mode select, body.dark-mode textarea { background: #0f172a; color: var(--text); border-color: var(--border); }
body.dark-mode input::placeholder, body.dark-mode textarea::placeholder { color: var(--text-muted); }
body.dark-mode .filter-select { background: #0f172a; color: var(--text); border-color: var(--border); }
body.dark-mode .btn-secondary { background: #334155; color: var(--text); border-color: var(--border); }
body.dark-mode .btn-icon { color: var(--text-secondary); }
body.dark-mode .team-card { background: var(--surface); border-color: var(--border); }
body.dark-mode .member-item { border-color: var(--border); }
body.dark-mode .fichier-card { background: var(--surface); border-color: var(--border); }
body.dark-mode .upload-dropzone { background: #0f172a; border-color: var(--border); }
body.dark-mode .empty-state { color: var(--text-muted); }
body.dark-mode .badge-gray { background: #334155; color: #94a3b8; }
body.dark-mode .stat-icon.icon-blue { background: rgba(37,99,235,0.15); }
body.dark-mode .stat-icon.icon-green { background: rgba(5,150,105,0.15); }
body.dark-mode .stat-icon.icon-amber { background: rgba(217,119,6,0.15); }
body.dark-mode .stat-icon.icon-purple { background: rgba(124,58,237,0.15); }
body.dark-mode .table thead th { background: #1e293b; color: #94a3b8; }
body.dark-mode .table tbody tr:hover { background: #1e293b; }
body.dark-mode .kanban-column { background: #1e293b; }
body.dark-mode .calendar-day { background: #1e293b; }
body.dark-mode .calendar-day.today { background: rgba(37,99,235,0.15); }
body.dark-mode .calendar-day.other-month { background: #0f172a; }
body.dark-mode .calendar-day-header { background: #1e293b; }

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
    background: none;
    color: var(--sidebar-text);
    font-size: 13px;
    width: 100%;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 8px;
}
.theme-toggle:hover { background: var(--sidebar-hover); }
.theme-toggle svg { width: 16px; height: 16px; }

/* ======================== FILTER BAR ======================== */
.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
}
.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 140px; }
.filter-bar label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 4px; display: block; }
.filter-bar input, .filter-bar select { width: 100%; padding: 8px 12px; font-size: 13px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); }

/* ======================== SUBTASKS ======================== */
.subtask-list { padding-left: 32px; }
.subtask-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
}
.subtask-checkbox {
    width: 16px; height: 16px;
    border-radius: 4px;
    border: 2px solid var(--border);
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
}
.subtask-checkbox.checked { background: var(--success); border-color: var(--success); }
.subtask-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    background: var(--surface);
    color: var(--text);
}

/* ======================== TIME TRACKING ======================== */
.time-entry {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13px;
}
.time-duration {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    min-width: 60px;
}
.time-total {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
}

/* ======================== CLIENT LINK ======================== */
.client-link-box {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.client-link-box input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    background: var(--surface);
    color: var(--text);
}

/* ======================== WIDGET CONTROLS ======================== */
.widget-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.widget-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}
.widget-toggle.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ======================== NOTIFICATIONS ======================== */
.notif-bell {
    position: relative;
    cursor: pointer;
    width: 36px; height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.notif-bell:hover { background: var(--sidebar-hover); }
.notif-bell svg { width: 20px; height: 20px; color: var(--sidebar-text); }
.notif-badge {
    position: absolute;
    top: 2px; right: 2px;
    min-width: 18px; height: 18px;
    border-radius: 9px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    animation: notifPulse 2s ease infinite;
}
@keyframes notifPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}
.notif-panel {
    display: none;
    position: absolute;
    top: 64px; left: 12px; right: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    max-height: 400px;
    overflow: hidden;
    animation: slideUp 0.2s ease;
}
.notif-panel.active { display: block; }
.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.notif-panel-title { font-size: 14px; font-weight: 700; color: var(--text); }
.notif-mark-all {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.notif-mark-all:hover { text-decoration: underline; }
.notif-panel-body {
    max-height: 320px;
    overflow-y: auto;
}
.notif-item {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
    cursor: pointer;
}
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: var(--primary-light); }
.notif-item.unread:hover { background: rgba(37,99,235,0.1); }
.notif-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}
.notif-icon.notif-warning { background: var(--warning-light); color: var(--warning); }
.notif-icon.notif-danger { background: var(--danger-light); color: var(--danger); }
.notif-icon.notif-info { background: var(--primary-light); color: var(--primary); }
.notif-icon.notif-success { background: var(--success-light); color: var(--success); }
.notif-content { flex: 1; min-width: 0; }
.notif-title { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.notif-message { font-size: 11px; color: var(--text-muted); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-time { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* ======================== GANTT CHART ======================== */
.gantt-wrapper { overflow-x: auto; overflow-y: auto; max-height: 600px; }
.gantt-container { display: flex; flex-direction: column; min-width: 100%; }
.gantt-header-area { display: flex; position: sticky; top: 0; z-index: 10; background: var(--surface); }
.gantt-label-header {
    min-width: 220px;
    max-width: 220px;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-end;
}
.gantt-timeline-header { overflow: hidden; }
.gantt-month-row { display: flex; background: var(--bg); }
.gantt-month-cell {
    padding: 6px 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: center;
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
    overflow: hidden;
}
.gantt-day-row { display: flex; border-bottom: 1px solid var(--border); }
.gantt-day-cell {
    padding: 4px 0;
    font-size: 10px;
    text-align: center;
    color: var(--text-muted);
    border-right: 1px solid var(--border-light);
    box-sizing: border-box;
}
.gantt-day-cell.gantt-today { background: var(--primary-light); color: var(--primary); font-weight: 700; }
.gantt-day-cell.gantt-weekend { background: rgba(0,0,0,0.02); }
.gantt-body-area { }
.gantt-row {
    display: flex;
    border-bottom: 1px solid var(--border-light);
    min-height: 36px;
}
.gantt-row-chantier { background: var(--bg); }
.gantt-row-label {
    min-width: 220px;
    max-width: 220px;
    padding: 8px 16px;
    font-size: 12px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    border-right: 1px solid var(--border);
    position: sticky;
    left: 0;
    background: inherit;
    z-index: 5;
}
.gantt-row-chantier .gantt-row-label { background: var(--bg); }
.gantt-row-bars { position: relative; flex: 1; }
.gantt-grid-row { display: flex; height: 100%; }
.gantt-grid-cell { border-right: 1px solid var(--border-light); box-sizing: border-box; }
.gantt-grid-cell.gantt-weekend { background: rgba(0,0,0,0.015); }
.gantt-grid-cell.gantt-today-col { background: rgba(37,99,235,0.04); }
.gantt-bar-chantier {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 8px;
    border-radius: 4px;
    opacity: 0.5;
    overflow: hidden;
}
.gantt-bar-progress {
    height: 100%;
    background: rgba(255,255,255,0.5);
    border-radius: 4px;
}
.gantt-bar-tache {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 22px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: opacity 0.2s;
    cursor: pointer;
}
.gantt-bar-tache:hover { opacity: 0.85; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.gantt-legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    display: inline-block;
}

/* ======================== MOBILE MENU ======================== */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 12px; left: 12px;
    z-index: 150;
    width: 44px; height: 44px;
    border-radius: 10px;
    border: none;
    background: var(--primary);
    color: white;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    cursor: pointer;
}
.mobile-menu-toggle svg { width: 22px; height: 22px; }

/* ======================== ENTRANCE ANIMATIONS ======================== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-12px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.main-content { animation: fadeInUp 0.35s ease both; }
.stat-card { animation: fadeInUp 0.4s ease both; }
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }
.card { animation: fadeInUp 0.4s ease both; animation-delay: 0.1s; }
.nav-item { animation: fadeInLeft 0.3s ease both; }
.nav-item:nth-child(1) { animation-delay: 0.05s; }
.nav-item:nth-child(2) { animation-delay: 0.08s; }
.nav-item:nth-child(3) { animation-delay: 0.11s; }
.nav-item:nth-child(4) { animation-delay: 0.14s; }
.nav-item:nth-child(5) { animation-delay: 0.17s; }
.nav-item:nth-child(6) { animation-delay: 0.20s; }
.nav-item:nth-child(7) { animation-delay: 0.23s; }
.task-item { animation: fadeInUp 0.3s ease both; }
.team-card { animation: scaleIn 0.3s ease both; }
.kanban-card { animation: scaleIn 0.25s ease both; }

/* ======================== IMPROVED HOVER EFFECTS ======================== */
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-secondary:active { transform: scale(0.98); }
.nav-item { position: relative; overflow: hidden; }
.nav-item::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--primary);
    transform: scaleY(0);
    transition: transform 0.2s ease;
    border-radius: 0 2px 2px 0;
}
.nav-item.active::before,
.nav-item:hover::before { transform: scaleY(1); }

/* Table row hover animation */
.table tbody tr { transition: background 0.15s ease, transform 0.15s ease; }
.table tbody tr:hover { transform: translateX(2px); }

/* ======================== SKELETON LOADING ======================== */
.skeleton {
    background: linear-gradient(90deg, var(--border-light) 25%, var(--bg) 50%, var(--border-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ======================== SCROLLBAR DARK MODE ======================== */
body.dark-mode ::-webkit-scrollbar-thumb { background: #475569; }
body.dark-mode .gantt-grid-cell.gantt-weekend { background: rgba(255,255,255,0.02); }
body.dark-mode .gantt-grid-cell.gantt-today-col { background: rgba(37,99,235,0.08); }
body.dark-mode .gantt-bar-chantier { opacity: 0.4; }
body.dark-mode .mobile-menu-toggle { background: var(--primary-dark); }
body.dark-mode .notif-panel { background: var(--surface); border-color: var(--border); }
body.dark-mode .notif-item.unread { background: rgba(37,99,235,0.1); }

/* ======================== WELCOME BANNER ======================== */
.welcome-banner {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    animation: fadeInUp 0.4s ease both;
    position: relative;
    overflow: hidden;
}
.welcome-banner::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 200px;
    height: 200px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}
.welcome-banner::after {
    content: '';
    position: absolute;
    bottom: -60px;
    right: 100px;
    width: 160px;
    height: 160px;
    background: rgba(255,255,255,0.03);
    border-radius: 50%;
}
.welcome-title { font-size: 24px; font-weight: 800; color: white; letter-spacing: -0.5px; }
.welcome-subtitle { font-size: 14px; color: rgba(255,255,255,0.7); margin-top: 4px; }
.welcome-actions { display: flex; gap: 8px; z-index: 1; }
.welcome-actions .btn-primary { background: white; color: #1e3a5f; }
.welcome-actions .btn-primary:hover { background: #f1f5f9; }
.welcome-actions .btn-secondary { background: rgba(255,255,255,0.15); color: white; border: 1px solid rgba(255,255,255,0.2); }
.welcome-actions .btn-secondary:hover { background: rgba(255,255,255,0.25); }

/* ======================== KPI CIRCLES ======================== */
.kpi-grid { display: flex; justify-content: space-around; gap: 16px; padding: 12px 0; }
.kpi-item { text-align: center; }
.kpi-circle { position: relative; width: 80px; height: 80px; margin: 0 auto 8px; }
.kpi-svg { width: 80px; height: 80px; transform: rotate(-90deg); }
.kpi-bg { fill: none; stroke: var(--border); stroke-width: 3; }
.kpi-fill { fill: none; stroke: var(--primary); stroke-width: 3; stroke-linecap: round; transition: stroke-dasharray 1s ease; }
.kpi-fill-green { stroke: #22c55e; }
.kpi-fill-amber { stroke: #f59e0b; }
.kpi-value {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}
.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }

/* ======================== UPLOAD DROPZONE ======================== */
.upload-dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg);
}
.upload-dropzone:hover, .upload-dropzone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.upload-dropzone.dragover { transform: scale(1.01); }

/* ======================== FICHIERS GALLERY ======================== */
.fichiers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.fichier-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    background: var(--surface);
}
.fichier-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.fichier-preview {
    height: 120px;
    background-size: cover;
    background-position: center;
    background-color: var(--bg);
}
.fichier-preview.fichier-icon { display: flex; align-items: center; justify-content: center; }
.fichier-info { padding: 10px 12px 6px; }
.fichier-name { font-size: 12px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fichier-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.fichier-actions { display: flex; gap: 4px; padding: 4px 12px 10px; }

/* ======================== ACTIVITY TIMELINE ======================== */
.activity-timeline { }
.activity-date-sep {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 16px 0 8px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 4px;
}
.activity-date-sep:first-child { padding-top: 0; }
.activity-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    animation: fadeInUp 0.25s ease both;
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.activity-body { flex: 1; min-width: 0; }
.activity-text { font-size: 13px; color: var(--text); line-height: 1.4; }
.activity-text strong { font-weight: 600; }
.activity-meta-row { display: flex; gap: 10px; align-items: center; margin-top: 3px; }
.activity-chantier-link { font-size: 11px; color: var(--primary); text-decoration: none; font-weight: 600; }
.activity-chantier-link:hover { text-decoration: underline; }
.activity-time { font-size: 11px; color: var(--text-muted); }

/* ======================== DASHBOARD TOOLBAR ======================== */
.dash-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.hide-mobile { display: inline; }

/* ======================== WIDGET CUSTOMIZATION ======================== */
.widget-block { margin-bottom: 16px; }
.widget-ghost { opacity: 0.3; }
.widget-dragging { box-shadow: 0 12px 40px rgba(0,0,0,0.15); transform: rotate(1deg); }

.customize-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}
.customize-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 6px;
}
.customize-header strong { font-size: 14px; color: var(--text); }
.customize-header small { font-size: 11px; color: var(--text-muted); }
.customize-list { display: flex; flex-direction: column; gap: 6px; }
.customize-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: default;
    transition: background 0.15s;
}
.customize-item:hover { background: var(--surface); }
.customize-drag {
    cursor: grab;
    color: var(--text-muted);
    font-size: 16px;
    user-select: none;
    padding: 2px 4px;
}
.customize-label { flex: 1; font-size: 13px; font-weight: 500; }
.customize-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary);
    padding: 4px;
    border-radius: 6px;
    transition: color 0.15s;
}
.customize-toggle.off { color: var(--text-muted); opacity: 0.5; }
.customize-toggle:hover { background: var(--bg); }

/* Print */
@media print {
    .sidebar, .sidebar-overlay, .page-actions, .btn, .toast-container, .mobile-menu-toggle, .notif-panel { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .card { break-inside: avoid; }
}

/* ======================== NOTES ======================== */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.note-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: transform 0.15s, box-shadow 0.15s;
}
.note-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.note-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}
.note-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}
.note-card-body {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
    max-height: 120px;
    overflow: hidden;
}
.note-card-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.note-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: auto;
}
.note-rappel {
    font-size: 11px;
    color: var(--warning);
    font-weight: 600;
}

@media (max-width: 768px) {
    .notes-grid { grid-template-columns: 1fr; gap: 10px; }
    .note-card { padding: 14px; }
}



/* ======================== MOBILE BOTTOM NAV & TOP BAR ======================== */
/* Hidden on desktop */
.mobile-topbar,
.mobile-bottom-nav,
.mob-menu-overlay,
.mob-menu-sheet { display: none; }

@media (max-width: 768px) {
    /* ---- HIDE DESKTOP SIDEBAR & HAMBURGER ON MOBILE ---- */
    .sidebar { display: none !important; }
    .sidebar-overlay { display: none !important; }
    .mobile-menu-toggle { display: none !important; }

    /* ---- MOBILE TOP BAR ---- */
    .mobile-topbar {
        display: flex;
        position: fixed;
        top: 0; left: 0; right: 0;
        height: 56px;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        align-items: center;
        justify-content: space-between;
        padding: 0 16px;
        z-index: 200;
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
    }
    body.dark-mode .mobile-topbar {
        background: rgba(15,23,42,0.92);
        border-color: rgba(51,65,85,0.5);
    }
    .mobile-topbar-logo {
        display: flex;
        align-items: center;
        gap: 10px;
        text-decoration: none;
        color: var(--text);
        font-weight: 800;
        font-size: 17px;
        letter-spacing: -0.5px;
    }
    .mobile-topbar-logo img {
        border-radius: 6px;
    }
    .mobile-topbar-actions {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .mobile-topbar-bell {
        position: relative;
        width: 40px; height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        cursor: pointer;
        color: var(--text-secondary);
        transition: background 0.15s;
    }
    .mobile-topbar-bell:active { background: var(--bg); }
    .mobile-topbar-badge {
        position: absolute;
        top: 6px; right: 6px;
        min-width: 16px; height: 16px;
        background: var(--danger);
        color: white;
        font-size: 9px;
        font-weight: 700;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 4px;
    }
    .mobile-topbar-theme {
        width: 40px; height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        border: none;
        background: none;
        color: var(--text-secondary);
        cursor: pointer;
        transition: background 0.15s;
    }
    .mobile-topbar-theme:active { background: var(--bg); }

    /* ---- MOBILE BOTTOM NAVIGATION ---- */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        height: 64px;
        background: var(--surface);
        border-top: 1px solid var(--border);
        align-items: stretch;
        z-index: 200;
        padding-bottom: env(safe-area-inset-bottom, 0);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
    }
    body.dark-mode .mobile-bottom-nav {
        background: rgba(15,23,42,0.95);
        border-color: rgba(51,65,85,0.5);
    }
    .mob-nav-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        text-decoration: none;
        color: var(--text-muted);
        font-size: 10px;
        font-weight: 500;
        border: none;
        background: none;
        cursor: pointer;
        transition: color 0.15s;
        position: relative;
        -webkit-tap-highlight-color: transparent;
    }
    .mob-nav-tab svg {
        width: 22px; height: 22px;
        transition: transform 0.15s;
    }
    .mob-nav-tab.active {
        color: var(--primary);
        font-weight: 700;
    }
    .mob-nav-tab.active::before {
        content: '';
        position: absolute;
        top: 0; left: 50%;
        transform: translateX(-50%);
        width: 28px; height: 3px;
        background: var(--primary);
        border-radius: 0 0 3px 3px;
    }
    .mob-nav-tab:active svg {
        transform: scale(0.9);
    }

    /* ---- CONTENT PADDING ADJUSTMENTS ---- */
    .main-content {
        margin-left: 0 !important;
        padding-top: 68px !important;
        padding-bottom: 80px !important;
    }

    /* ---- MOBILE MENU OVERLAY ---- */
    .mob-menu-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 300;
        -webkit-backdrop-filter: blur(3px);
        backdrop-filter: blur(3px);
        opacity: 0;
        transition: opacity 0.25s;
    }
    .mob-menu-overlay.open {
        display: block;
        opacity: 1;
    }

    /* ---- MOBILE MENU BOTTOM SHEET ---- */
    .mob-menu-sheet {
        display: block;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        max-height: 85vh;
        background: var(--surface);
        border-radius: 20px 20px 0 0;
        z-index: 301;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: env(safe-area-inset-bottom, 0);
        box-shadow: 0 -8px 40px rgba(0,0,0,0.2);
    }
    body.dark-mode .mob-menu-sheet {
        background: #1e293b;
        box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
    }
    .mob-menu-sheet.open {
        transform: translateY(0);
    }
    .mob-menu-handle {
        display: flex;
        justify-content: center;
        padding: 12px 0 8px;
        cursor: pointer;
    }
    .mob-handle-bar {
        width: 36px; height: 4px;
        border-radius: 2px;
        background: var(--border);
    }
    body.dark-mode .mob-handle-bar {
        background: #475569;
    }

    /* ---- MOBILE MENU SEARCH ---- */
    .mob-menu-search {
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 4px 16px 12px;
        padding: 10px 14px;
        border-radius: 12px;
        background: var(--bg);
        border: 1px solid var(--border);
    }
    body.dark-mode .mob-menu-search {
        background: #0f172a;
        border-color: #334155;
    }
    .mob-menu-search svg {
        color: var(--text-muted);
        flex-shrink: 0;
    }
    .mob-menu-search input {
        flex: 1;
        border: none;
        background: none;
        color: var(--text);
        font-size: 15px;
        outline: none;
    }
    .mob-menu-search input::placeholder {
        color: var(--text-muted);
    }

    /* ---- MOBILE MENU GRID ---- */
    .mob-menu-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
        padding: 0 12px 16px;
    }
    .mob-menu-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
        padding: 12px 4px;
        border-radius: 14px;
        text-decoration: none;
        color: var(--text);
        font-size: 11px;
        font-weight: 500;
        transition: background 0.15s;
        -webkit-tap-highlight-color: transparent;
        text-align: center;
    }
    .mob-menu-item:active {
        background: var(--bg);
    }
    body.dark-mode .mob-menu-item:active {
        background: rgba(255,255,255,0.05);
    }
    .mob-menu-icon {
        width: 46px; height: 46px;
        border-radius: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .mob-menu-icon svg {
        width: 22px; height: 22px;
    }

    /* ---- MOBILE MENU FOOTER ---- */
    .mob-menu-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px;
        border-top: 1px solid var(--border);
        margin-top: 4px;
    }
    body.dark-mode .mob-menu-footer {
        border-color: #334155;
    }
    .mob-menu-user {
        display: flex;
        align-items: center;
        gap: 10px;
    }
    .mob-menu-avatar {
        width: 34px; height: 34px;
        border-radius: 10px;
        background: var(--primary);
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-weight: 700;
        font-size: 13px;
        flex-shrink: 0;
    }
    .mob-menu-user-name {
        font-weight: 600;
        font-size: 13px;
        color: var(--text);
    }
    .mob-menu-user-email {
        font-size: 11px;
        color: var(--text-muted);
    }
    .mob-menu-logout {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 8px 14px;
        border-radius: 10px;
        font-size: 12px;
        font-weight: 600;
        color: var(--danger);
        text-decoration: none;
        border: 1px solid rgba(220,38,38,0.2);
        transition: background 0.15s;
    }
    .mob-menu-logout:active {
        background: rgba(220,38,38,0.08);
    }

    /* ---- NOTIFICATIONS on mobile: show over topbar ---- */
    .notif-panel {
        position: fixed !important;
        top: 56px !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-height: 60vh !important;
        border-radius: 0 0 16px 16px !important;
        z-index: 250 !important;
    }

    /* ---- Toast positioning adjusted for bottom nav ---- */
    .toast-container {
        bottom: 76px !important;
    }

    /* ---- PWA install banner adjusted ---- */
    #pwa-install-banner {
        bottom: 76px !important;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .mob-menu-grid { grid-template-columns: repeat(3, 1fr); }
    .mobile-topbar-logo span { font-size: 15px; }
}

/* ======= Email Editor Styles ======= */
.email-tpl-btn {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.email-tpl-btn:hover { border-color: var(--primary); color: var(--primary); }
.email-tpl-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.email-mode-btn {
    padding: 7px 16px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}
.email-mode-btn:hover { color: var(--text); background: var(--bg); }
.email-mode-btn.active { color: var(--primary); background: rgba(37,99,235,0.08); }

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 30px;
    height: 30px;
    padding: 0 6px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}
.toolbar-btn:hover { background: var(--surface); border-color: var(--border); color: var(--text); }

#email-editor-visual:focus { box-shadow: 0 0 0 2px rgba(37,99,235,0.15); }
#email-editor-visual h2 { font-size: 22px; font-weight: 800; color: #0f172a; margin: 16px 0 8px; }
#email-editor-visual h3 { font-size: 18px; font-weight: 700; color: #1e40af; margin: 12px 0 6px; }
#email-editor-visual a { color: #2563eb; }
#email-editor-visual img { max-width: 100%; border-radius: 8px; }

.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn.active { background: var(--primary); color: white; }
