/* CRM Onibat — charte graphique reprise de onibat.fr
   Orange principal #FC7E4C / accent #EB7749 / gris foncé #414447 / gris texte #8D9194 */

:root {
    --orange: #FC7E4C;
    --orange-dark: #EB7749;
    --dark: #414447;
    --gray: #8D9194;
    --bg: #F5F6F7;
    --border: #E2E5E8;
    --white: #FFFFFF;
    --danger: #C53030;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: var(--dark);
    background: var(--bg);
}

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

/* ---------- Bandeau haut ---------- */
.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(65, 68, 71, .08);
}
.topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 32px;
    min-height: 64px;
    flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand img { height: 36px; display: block; }
.brand-app {
    font-weight: 700;
    color: var(--orange);
    font-size: 15px;
    letter-spacing: 2px;
    align-self: flex-end;
    padding-bottom: 4px;
}
.tabs { display: flex; gap: 4px; flex: 1; }
.tab {
    padding: 21px 16px 18px;
    color: var(--dark);
    font-weight: 600;
    border-bottom: 3px solid transparent;
}
.tab:hover { color: var(--orange-dark); text-decoration: none; }
.tab.active { color: var(--orange-dark); border-bottom-color: var(--orange); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.toplink { color: var(--gray); font-size: 13px; }
.toplink.active { color: var(--orange-dark); }
.username { color: var(--dark); font-weight: 600; font-size: 13px; }

/* ---------- Structure ---------- */
.container { max-width: 1280px; margin: 24px auto; padding: 0 24px; }
.footer {
    max-width: 1280px;
    margin: 40px auto 24px;
    padding: 0 24px;
    color: var(--gray);
    font-size: 12px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }

.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

/* ---------- Boutons ---------- */
.btn {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: var(--orange);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}
.btn:hover { background: var(--orange-dark); text-decoration: none; }
.btn-secondary { background: var(--white); color: var(--dark); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #9B2C2C; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--white); }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--gray);
    background: #FAFBFC;
    white-space: nowrap;
}
tbody tr:hover { background: #FFF8F4; }
td.num, th.num { text-align: right; white-space: nowrap; }
.row-link { font-weight: 600; color: var(--dark); }
.row-link:hover { color: var(--orange-dark); }

/* ---------- Badges statut ---------- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-late {
    background: var(--danger);
    color: #fff;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 700;
}

/* ---------- Formulaires ---------- */
label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=tel], select, textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: var(--dark);
    background: var(--white);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(252, 126, 76, .15);
}
textarea { resize: vertical; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px 20px;
}
.form-grid .full { grid-column: 1 / -1; }
.form-actions { margin-top: 20px; display: flex; gap: 12px; align-items: center; }
.hint { color: var(--gray); font-size: 12px; margin-top: 3px; }

/* ---------- Filtres ---------- */
.filters {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.filters .field { min-width: 160px; }
.filters input, .filters select { min-width: 160px; }

/* ---------- Tableau de bord ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.stat-tile {
    background: var(--white);
    border: 1px solid var(--border);
    border-left: 4px solid var(--orange);
    border-radius: 8px;
    padding: 14px 16px;
    display: block;
    color: var(--dark);
}
.stat-tile:hover { text-decoration: none; border-color: var(--orange); }
.stat-tile .num { font-size: 26px; font-weight: 700; display: block; }
.stat-tile .lbl { color: var(--gray); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }

/* ---------- Divers ---------- */
.alert {
    background: #F0FFF4;
    border: 1px solid #9AE6B4;
    color: #276749;
    padding: 10px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
}
.alert-error {
    background: #FFF5F5;
    border-color: #FEB2B2;
    color: var(--danger);
}
.muted { color: var(--gray); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
    padding: 10px 0 10px 20px;
    border-left: 2px solid var(--border);
    position: relative;
}
.timeline li::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 16px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--orange);
}
.timeline .meta { color: var(--gray); font-size: 12px; }

/* ---------- Login ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dark);
}
.login-box {
    background: var(--white);
    border-radius: 10px;
    padding: 36px;
    width: 360px;
}
.login-box img { height: 44px; display: block; margin: 0 auto 24px; }
.login-box .btn { width: 100%; margin-top: 8px; }
.login-box p.err { color: var(--danger); font-size: 13px; }
.login-box .field { margin-bottom: 14px; }
