/* =============================================================
   el.mouchon.net — Feuille de styles principale
   Dark mode, responsive, zéro dépendance externe
   ============================================================= */

/* --- Variables --- */
:root {
    --bg-base:      #0d0d14;
    --bg-surface:   #16161f;
    --bg-elevated:  #1e1e2a;
    --bg-hover:     #252534;
    --border:       #2a2a3d;
    --border-light: #1f1f30;

    --text:         #e2e8f0;
    --text-muted:   #94a3b8;
    --text-dim:     #64748b;

    --accent:       #7c6fdf;
    --accent-hover: #6c5fcf;
    --accent-dim:   rgba(124,111,223,.15);

    --success:      #22c55e;
    --success-dim:  rgba(34,197,94,.15);
    --warning:      #f59e0b;
    --warning-dim:  rgba(245,158,11,.15);
    --danger:       #ef4444;
    --danger-dim:   rgba(239,68,68,.15);
    --info:         #3b82f6;
    --info-dim:     rgba(59,130,246,.15);

    --radius:       8px;
    --radius-lg:    12px;
    --shadow:       0 4px 12px rgba(0,0,0,.4);
    --font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono:    'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg-base);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; }

/* --- Navbar --- */
.navbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .75rem 1.5rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -.02em;
    text-decoration: none;
    white-space: nowrap;
}
.brand-el   { color: var(--accent); }
.brand-dot  { color: var(--text-dim); }
.brand-name { color: var(--text); }

.nav-links {
    display: flex;
    list-style: none;
    gap: .25rem;
    flex: 1;
    margin-left: 1rem;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .75rem;
    border-radius: var(--radius);
    font-size: .875rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: background .15s, color .15s;
}
.nav-link:hover, .nav-link.active {
    background: var(--bg-elevated);
    color: var(--text);
    text-decoration: none;
}
.nav-link.active { color: var(--accent); }

.nav-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-left: auto;
}
.nav-username { font-size: .85rem; color: var(--text-muted); }
.btn-logout {
    display: flex;
    align-items: center;
    color: var(--text-dim);
    padding: .35rem;
    border-radius: var(--radius);
    transition: color .15s, background .15s;
}
.btn-logout:hover { color: var(--danger); background: var(--danger-dim); text-decoration: none; }

/* --- Main content --- */
.main-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* --- Footer --- */
.footer {
    padding: .75rem 1.5rem;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    font-size: .8rem;
    color: var(--text-dim);
    display: flex;
    gap: .5rem;
}
.footer-sep { opacity: .4; }

/* --- Cards --- */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}
.card-title {
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-dim);
    margin-bottom: 1rem;
}
.card-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* --- Grid layouts --- */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 800px)  { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1rem;
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background .15s, border-color .15s, opacity .15s;
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; opacity: .9; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); opacity: 1; }
.btn-secondary { background: var(--bg-elevated); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-danger { background: var(--danger-dim); color: var(--danger); border-color: rgba(239,68,68,.3); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; }
.btn-icon { padding: .4rem; }

/* --- Forms --- */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: .85rem;
    color: var(--text-muted);
    margin-bottom: .35rem;
    font-weight: 500;
}
.form-control {
    width: 100%;
    padding: .6rem .85rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: .95rem;
    font-family: var(--font);
    transition: border-color .15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-control::placeholder { color: var(--text-dim); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.form-actions { display: flex; gap: .5rem; margin-top: 1.25rem; flex-wrap: wrap; }

.form-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.form-card h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
}

/* --- Tables --- */
.table-wrap {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--bg-elevated); }
th {
    padding: .75rem 1rem;
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-dim);
    text-align: left;
    white-space: nowrap;
}
td {
    padding: .8rem 1rem;
    font-size: .9rem;
    border-top: 1px solid var(--border-light);
    color: var(--text);
}
tr:hover td { background: var(--bg-elevated); }
.td-actions { display: flex; gap: .35rem; }

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .2rem .6rem;
    border-radius: 99px;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-ok       { background: var(--success-dim); color: var(--success); }
.badge-warning  { background: var(--warning-dim); color: var(--warning); }
.badge-danger   { background: var(--danger-dim);  color: var(--danger); }
.badge-critical { background: var(--danger);       color: #fff; animation: pulse 1.5s infinite; }
.badge-info     { background: var(--info-dim);    color: var(--info); }
.badge-neutral  { background: var(--bg-elevated); color: var(--text-muted); }

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

/* --- Alerts --- */
.alert {
    padding: .85rem 1rem;
    border-radius: var(--radius);
    font-size: .9rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}
.alert-success { background: var(--success-dim); color: var(--success); border-color: rgba(34,197,94,.3); }
.alert-error   { background: var(--danger-dim);  color: var(--danger);  border-color: rgba(239,68,68,.3); }
.alert-warning { background: var(--warning-dim); color: var(--warning); border-color: rgba(245,158,11,.3); }
.alert-info    { background: var(--info-dim);    color: var(--info);    border-color: rgba(59,130,246,.3); }

/* --- Progress bars --- */
.progress-wrap { margin: .5rem 0; }
.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: .3rem;
}
.progress-bar {
    height: 6px;
    background: var(--bg-elevated);
    border-radius: 99px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 99px;
    transition: width .4s ease;
    background: var(--success);
}
.progress-fill.warn { background: var(--warning); }
.progress-fill.over { background: var(--danger); }

/* --- Tabs --- */
.tabs { display: flex; gap: .25rem; margin-bottom: 1.5rem; background: var(--bg-elevated); padding: .25rem; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.tab-btn {
    flex: 1;
    padding: .5rem 1rem;
    background: none;
    border: none;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: .875rem;
    cursor: pointer;
    text-align: center;
    transition: background .15s, color .15s;
    text-decoration: none;
    display: block;
}
.tab-btn:hover { color: var(--text); text-decoration: none; }
.tab-btn.active { background: var(--bg-surface); color: var(--text); box-shadow: var(--shadow); }

/* --- Stats / KPI --- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
}
.kpi-label { font-size: .78rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .07em; margin-bottom: .35rem; }
.kpi-value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-sub   { font-size: .8rem; color: var(--text-muted); margin-top: .15rem; }
.trend-up   { color: var(--success); }
.trend-down { color: var(--danger); }

/* --- Account balance chip --- */
.account-chip {
    display: flex;
    align-items: center;
    gap: .6rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
}
.account-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.account-info { flex: 1; min-width: 0; }
.account-name { font-size: .9rem; font-weight: 600; }
.account-bank { font-size: .78rem; color: var(--text-muted); }
.account-balance { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* --- Login page --- */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}
.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
}
.login-logo {
    font-size: 1.4rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 1.75rem;
}

/* --- Chip color dot --- */
.color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: .4rem;
}

/* --- Empty state --- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-dim);
}
.empty-state svg { margin: 0 auto 1rem; opacity: .3; }
.empty-state p { font-size: .95rem; }

/* --- Section heading --- */
.section-title {
    font-size: .85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-dim);
    margin-bottom: 1rem;
    margin-top: 1.75rem;
}
.section-title:first-child { margin-top: 0; }

/* --- Utility --- */
.text-right   { text-align: right; }
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-mono    { font-family: var(--font-mono); }
.nowrap       { white-space: nowrap; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none; }

/* --- Form helpers --- */
.form-label { display: block; font-size: .85rem; color: var(--text-muted); margin-bottom: .35rem; font-weight: 500; }
.form-hint  { font-size: .78rem; color: var(--text-dim); margin-top: .3rem; }
.text-dim   { color: var(--text-dim); }

/* --- Task priority badges --- */
.priority-haute   { background: var(--danger-dim);  color: var(--danger); }
.priority-normale { background: var(--info-dim);    color: var(--info); }
.priority-basse   { background: var(--bg-elevated); color: var(--text-dim); }
.status-todo        { background: var(--bg-elevated); color: var(--text-muted); }
.status-in_progress { background: var(--warning-dim); color: var(--warning); }
.status-done        { background: var(--success-dim); color: var(--success); }

/* --- Note cards grid --- */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.note-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.1rem;
    position: relative;
    transition: border-color .15s;
    display: flex;
    flex-direction: column;
}
.note-card:hover { border-color: var(--accent); }
.note-card-actions { position: relative; z-index: 2; }
.note-card-title { font-weight: 600; margin-bottom: .5rem; font-size: .95rem; }
.note-card-body  { font-size: .85rem; color: var(--text-muted); white-space: pre-wrap; word-break: break-word; }
.note-card-actions { display: flex; gap: .35rem; margin-top: .75rem; }
.note-pin { position: absolute; top: .75rem; right: .75rem; font-size: .85rem; }

/* --- Bookmark list --- */
.bookmark-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color .15s;
}
.bookmark-item:hover { border-color: var(--accent); }
.bookmark-favicon { width: 20px; height: 20px; border-radius: 4px; flex-shrink: 0; }
.bookmark-title   { font-size: .9rem; font-weight: 500; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bookmark-url     { font-size: .75rem; color: var(--text-dim); }

/* --- Weather widget --- */
.weather-widget {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.weather-icon   { font-size: 2.2rem; line-height: 1; }
.weather-temp   { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.weather-desc   { font-size: .82rem; color: var(--text-muted); }
.weather-city   { font-size: .78rem; color: var(--text-dim); }

/* --- Countdown cards --- */
.countdown-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.countdown-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.1rem;
    text-align: center;
    position: relative;
}
.countdown-icon  { font-size: 1.8rem; margin-bottom: .4rem; }
.countdown-name  { font-size: .88rem; font-weight: 600; margin-bottom: .5rem; }
.countdown-days  { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.countdown-label { font-size: .75rem; color: var(--text-dim); margin-top: .1rem; }
.countdown-date  { font-size: .75rem; color: var(--text-muted); margin-top: .4rem; }
.countdown-actions { display: flex; gap: .35rem; justify-content: center; margin-top: .75rem; }

/* --- Goal progress --- */
.goal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.25rem;
    margin-bottom: .75rem;
}
.goal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .6rem; gap: .5rem; }
.goal-title  { font-weight: 600; font-size: .95rem; }
.goal-meta   { font-size: .78rem; color: var(--text-dim); margin-top: .15rem; }
.goal-value  { font-size: .9rem; font-weight: 600; white-space: nowrap; }

/* --- Journal mood --- */
.mood-btn {
    padding: .4rem .7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    transition: background .15s, border-color .15s;
}
.mood-btn.selected, .mood-btn:hover { background: var(--accent-dim); border-color: var(--accent); }
.mood-1 { color: #ef4444; }
.mood-2 { color: #f97316; }
.mood-3 { color: #f59e0b; }
.mood-4 { color: #84cc16; }
.mood-5 { color: #22c55e; }

/* --- Health metric charts --- */
.health-stat { display: flex; align-items: center; gap: .6rem; padding: .6rem 0; border-bottom: 1px solid var(--border-light); }
.health-stat:last-child { border-bottom: none; }
.health-stat-label { font-size: .85rem; color: var(--text-muted); flex: 1; }
.health-stat-value { font-size: .95rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* --- Dashboard widget row --- */
.dashboard-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
@media (max-width: 900px) { .dashboard-row { grid-template-columns: 1fr; } }

/* --- Responsive nav --- */
@media (max-width: 640px) {
    .navbar { flex-wrap: wrap; }
    .nav-links { flex-wrap: wrap; margin-left: 0; }
    .nav-username { display: none; }
    .main-content { padding: 1rem; }
}
