/* ===========================================================
   MoneyDeal — Feuille de style principale
   Design : sobre, financier, rassurant
   =========================================================== */

:root {
    --bg:           #f5f6f8;
    --surface:      #ffffff;
    --surface-2:    #f9fafb;
    --border:       #e5e7eb;
    --border-2:     #d1d5db;
    --text:         #111827;
    --text-muted:   #6b7280;
    --text-light:   #9ca3af;
    --primary:      #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #eff6ff;
    --success:      #16a34a;
    --success-soft: #dcfce7;
    --warning:      #d97706;
    --warning-soft: #fef3c7;
    --danger:       #dc2626;
    --danger-soft:  #fee2e2;
    --grey-soft:    #f3f4f6;
    --shadow:       0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-lg:    0 10px 30px -10px rgba(0,0,0,.15);
    --radius:       10px;
    --radius-sm:    6px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --------- Navbar --------- */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}
.brand {
    display: flex; align-items: center; gap: 10px;
    color: var(--text); font-weight: 700; font-size: 18px;
}
.brand:hover { text-decoration: none; }
.logo {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800;
}
.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-links a {
    color: var(--text); padding: 8px 14px; border-radius: var(--radius-sm);
    font-weight: 500;
}
.nav-links a:hover { background: var(--grey-soft); text-decoration: none; }

/* --------- Main / Flash --------- */
.main { padding: 32px 20px 60px; min-height: calc(100vh - 64px - 200px); }

.flash {
    padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 20px;
    font-weight: 500; border: 1px solid transparent;
}
.flash-success { background: var(--success-soft); color: #166534; border-color: #bbf7d0; }
.flash-error   { background: var(--danger-soft);  color: #991b1b; border-color: #fecaca; }
.flash-info    { background: var(--primary-soft); color: #1e40af; border-color: #bfdbfe; }

/* --------- Buttons --------- */
.btn, .btn-primary, .btn-ghost, .btn-danger, .btn-secondary {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: var(--radius-sm); font-weight: 600;
    font-size: 14px; border: 1px solid transparent; cursor: pointer;
    transition: all .15s ease;
    text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--grey-soft); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--grey-soft); color: var(--text); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; text-decoration: none; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* --------- Cards --------- */
.card {
    background: var(--surface); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 24px; border: 1px solid var(--border);
}
.card + .card { margin-top: 20px; }
.card h2, .card h3 { margin-top: 0; }

/* --------- Forms --------- */
.form-row { margin-bottom: 18px; }
.form-row label {
    display: block; font-weight: 600; font-size: 13px;
    color: var(--text); margin-bottom: 6px;
}
.form-row .hint {
    font-size: 12px; color: var(--text-muted); margin-top: 4px;
}
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=tel], select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border-2);
    border-radius: var(--radius-sm); font-size: 14px; font-family: inherit;
    background: var(--surface); color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
textarea { min-height: 80px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.form-actions {
    display: flex; gap: 10px; justify-content: flex-end;
    border-top: 1px solid var(--border); padding-top: 18px; margin-top: 8px;
}

/* --------- Tables --------- */
.table {
    width: 100%; border-collapse: collapse; background: var(--surface);
    border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow);
}
.table th, .table td {
    text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.table th {
    background: var(--surface-2); font-size: 12px; text-transform: uppercase;
    letter-spacing: .04em; color: var(--text-muted); font-weight: 600;
}
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }

/* --------- Badges --------- */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .03em; white-space: nowrap;
}
.badge-grey   { background: var(--grey-soft);    color: #4b5563; }
.badge-blue   { background: var(--primary-soft); color: #1e40af; }
.badge-green  { background: var(--success-soft); color: #166534; }
.badge-orange { background: var(--warning-soft); color: #92400e; }
.badge-red    { background: var(--danger-soft);  color: #991b1b; }

/* --------- Stats / dashboard --------- */
.stat-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
    margin-bottom: 28px;
}
@media (max-width: 760px) { .stat-grid { grid-template-columns: 1fr; } }
.stat {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--text-muted); font-weight: 600; }
.stat-value { font-size: 28px; font-weight: 700; margin-top: 8px; }
.stat-value.up   { color: var(--success); }
.stat-value.down { color: var(--danger); }

/* --------- Page header --------- */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
}
.page-header h1 { margin: 0; font-size: 26px; }
.page-header .subtitle { color: var(--text-muted); margin: 4px 0 0; }

/* --------- Hero (homepage) --------- */
.hero {
    text-align: center; padding: 60px 20px 40px;
}
.hero h1 { font-size: 42px; margin: 0 0 16px; letter-spacing: -.02em; }
.hero p.lead { font-size: 18px; color: var(--text-muted); max-width: 640px; margin: 0 auto 28px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.features {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
    margin: 40px 0;
}
@media (max-width: 800px) { .features { grid-template-columns: 1fr; } }
.feature {
    background: var(--surface); border-radius: var(--radius);
    padding: 24px; border: 1px solid var(--border);
}
.feature h3 { margin: 0 0 8px; font-size: 16px; }
.feature p { margin: 0; color: var(--text-muted); font-size: 14px; }

/* --------- Auth pages --------- */
.auth-box {
    max-width: 420px; margin: 40px auto;
}
.auth-box h1 { text-align: center; margin: 0 0 8px; font-size: 24px; }
.auth-box .subtitle { text-align: center; color: var(--text-muted); margin: 0 0 24px; }

/* --------- Detail layout --------- */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.kv-list { list-style: none; padding: 0; margin: 0; }
.kv-list li {
    display: flex; justify-content: space-between; padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.kv-list li:last-child { border-bottom: 0; }
.kv-list .k { color: var(--text-muted); font-size: 13px; }
.kv-list .v { font-weight: 600; }

/* --------- Footer --------- */
.footer {
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 32px 0; margin-top: 40px;
}
.footer-inner {
    display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px;
    align-items: start;
}
.footer p { margin: 4px 0; color: var(--text-muted); font-size: 13px; }
.footer a { display: block; color: var(--text-muted); padding: 2px 0; font-size: 14px; }
.footer .copyright { text-align: right; color: var(--text-light); font-size: 13px; }
@media (max-width: 640px) {
    .footer-inner { grid-template-columns: 1fr; }
    .footer .copyright { text-align: left; }
}

/* --------- Misc --------- */
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.empty-state {
    text-align: center; padding: 50px 20px; color: var(--text-muted);
}
.empty-state h3 { color: var(--text); margin: 0 0 8px; }

.alert-tax {
    background: var(--warning-soft); border: 1px solid #fde68a;
    border-radius: var(--radius-sm); padding: 12px 16px; margin: 16px 0;
    color: #92400e; font-size: 14px;
}

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
    padding: 12px 0 12px 22px; border-left: 2px solid var(--border);
    margin-left: 8px; position: relative;
}
.timeline li::before {
    content: ''; position: absolute; left: -7px; top: 16px;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--primary); border: 2px solid var(--surface);
}
.timeline .when { font-size: 12px; color: var(--text-muted); }
.timeline .what { font-weight: 500; }
