:root {
    --primary: #1f2937;
    --accent: #2563eb;
    --bg: #f7f8fa;
    --border: #e2e5ea;
    --text-muted: #6b7280;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--primary);
}

.topnav {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
}
.nav-brand { font-weight: 700; }
.nav-links { display: flex; gap: 14px; flex-wrap: wrap; }
.nav-links a { color: var(--primary); text-decoration: none; font-size: 0.95rem; }
.nav-links a:hover { color: var(--accent); }

.container { max-width: 760px; margin: 0 auto; padding: 20px 16px 60px; }

h1 { font-size: 1.5rem; margin: 8px 0 16px; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; margin-top: 24px; }

.muted { color: var(--text-muted); font-size: 0.9rem; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 0.9rem; }
.flash-error { background: #fee2e2; color: var(--danger); }
.flash-success { background: #dcfce7; color: var(--success); }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.btn-primary, .btn-secondary {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}
.btn-primary { background: var(--accent); color: white; }
.btn-secondary { background: white; color: var(--primary); border: 1px solid var(--border); }
.btn-link-danger { background: none; border: none; color: var(--danger); cursor: pointer; padding: 0; font-size: 0.9rem; text-decoration: underline; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 28px; }
.card { background: white; border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.card-label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; }
.card-value { font-size: 1.3rem; font-weight: 700; }

.list-cards { list-style: none; padding: 0; margin: 0; }
.list-cards li { margin-bottom: 8px; }
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    text-decoration: none;
    color: var(--primary);
}
.list-item-right { display: flex; align-items: center; gap: 10px; }

.list-plain { list-style: none; padding: 0; }
.list-plain li { padding: 8px 0; border-bottom: 1px solid var(--border); }

.badge { font-size: 0.75rem; padding: 3px 8px; border-radius: 999px; text-transform: capitalize; }
.badge-brouillon { background: #f3f4f6; color: #4b5563; }
.badge-envoyee { background: #dbeafe; color: #1d4ed8; }
.badge-payee { background: #dcfce7; color: var(--success); }
.badge-envoye { background: #dbeafe; color: #1d4ed8; }
.badge-accepte { background: #dcfce7; color: var(--success); }
.badge-refuse { background: #fee2e2; color: var(--danger); }
.badge-converti { background: #ede9fe; color: #6d28d9; }

.form-grid { display: flex; flex-direction: column; gap: 14px; max-width: 480px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; color: var(--primary); }
.form-grid input, .form-grid select, .form-grid textarea {
    padding: 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; font-family: inherit;
}

.ligne-row { display: flex; gap: 8px; margin-bottom: 8px; }
.ligne-designation { flex: 3; }
.ligne-qte { flex: 1; }
.ligne-prix { flex: 1.5; }

.inline-form { display: flex; gap: 10px; align-items: center; }

.total-line { font-size: 1.1rem; text-align: right; margin-top: 12px; }

.auth-box { max-width: 360px; margin: 60px auto; background: white; padding: 24px; border-radius: 12px; border: 1px solid var(--border); }
.auth-box form { display: flex; flex-direction: column; gap: 14px; }
.auth-box label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; }
.auth-box input { padding: 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; }

@media (max-width: 480px) {
    .ligne-row { flex-direction: column; }
    .list-item { flex-direction: column; align-items: flex-start; }
}
