/* === RESET === */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f6f7f9;
    color: #1f2937;
    line-height: 1.5;
}

/* === LAYOUT === */
.app-container { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    padding: 20px 0;
}
.sidebar .logo {
    padding: 0 20px 24px;
    font-size: 18px;
    font-weight: 600;
}
.sidebar nav a {
    display: block;
    padding: 10px 20px;
    color: #4b5563;
    text-decoration: none;
    font-size: 14px;
}
.sidebar nav a:hover { background: #f3f4f6; color: #1f2937; }
.sidebar nav a.active { background: #eff6ff; color: #2563eb; font-weight: 500; border-left: 3px solid #2563eb; padding-left: 17px; }

.main { flex: 1; padding: 24px 32px; }

/* === HEADER PAGE === */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}
.page-header h1 { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.page-header p { color: #6b7280; font-size: 13px; }

/* === BOUTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-primary { background: #1f2937; color: white; }
.btn-primary:hover { background: #111827; }
.btn-secondary { background: white; color: #1f2937; border-color: #e5e7eb; }
.btn-secondary:hover { background: #f9fafb; }

/* === FILTRES === */
.filters {
    background: white;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    border: 1px solid #e5e7eb;
}
.filters label { font-size: 12px; color: #6b7280; }
.filter-chip {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    background: white;
    color: #4b5563;
    text-decoration: none;
    cursor: pointer;
}
.filter-chip.active { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
.filters select { padding: 4px 8px; font-size: 12px; border: 1px solid #e5e7eb; border-radius: 4px; background: white; }

/* === TABLEAU === */
.data-table {
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}
.data-table table { width: 100%; border-collapse: collapse; }
.data-table thead {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}
.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}
.data-table td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid #f3f4f6;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafafa; }

/* === BADGES TEMPÉRATURE === */
.temp-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}
.temp-ok { background: #dcfce7; color: #166534; }
.temp-warning { background: #fef3c7; color: #92400e; }
.temp-danger { background: #fee2e2; color: #991b1b; }

/* === AVATAR === */
.avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #dbeafe;
    color: #1e40af;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 500;
    margin-right: 6px;
    vertical-align: middle;
}

/* === FORMULAIRE === */
.form-card {
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    padding: 24px;
    max-width: 520px;
}
.form-field { margin-bottom: 16px; }
.form-field label {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 6px;
    font-weight: 500;
}
.form-field input[type=text],
.form-field input[type=date],
.form-field input[type=number],
.form-field input[type=file],
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
.form-field input:focus, .form-field select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-field .helptext { font-size: 11px; color: #9ca3af; margin-top: 4px; }
.form-field .errors { color: #dc2626; font-size: 12px; margin-top: 4px; }
.form-readonly {
    background: #f9fafb;
    color: #6b7280;
    cursor: not-allowed;
}
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* === MESSAGES FLASH === */
.messages { margin-bottom: 16px; }
.message {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 13px;
}
.message.success { background: #dcfce7; color: #166534; }
.message.error { background: #fee2e2; color: #991b1b; }
.message.warning { background: #fef3c7; color: #92400e; }

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}
.empty-state h3 { font-size: 16px; color: #4b5563; margin-bottom: 8px; }

/* === GRILLE ÉQUIPEMENTS === */
.equipement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.equipement-card {
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    padding: 14px;
    text-decoration: none;
    color: inherit;
    transition: all 0.15s;
    display: block;
}
.equipement-card:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
.equipement-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 12px;
}
.equipement-icon-refrigerateur { background: #dbeafe; }
.equipement-icon-congelateur { background: #e0e7ff; }
.equipement-icon-cuisson { background: #fef3c7; }
.equipement-info h3 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}
.equipement-type {
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 8px;
}
.equipement-meta {
    font-size: 11px;
    color: #9ca3af;
    line-height: 1.6;
}
/* === FOURNISSEURS === */
.fournisseur-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.fournisseur-card {
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    padding: 16px;
    text-decoration: none;
    color: inherit;
    transition: all 0.15s;
    display: block;
}
.fournisseur-card:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
.fournisseur-header {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}
.fournisseur-logo {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
}
.fournisseur-logo-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #dbeafe;
    color: #1e40af;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}
.fournisseur-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
}
.fournisseur-meta {
    margin: 0;
    font-size: 11px;
    color: #6b7280;
}
.fournisseur-info p {
    margin: 4px 0;
    font-size: 12px;
    color: #4b5563;
}
.fournisseur-footer {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #f3f4f6;
}
.badge-info {
    font-size: 11px;
    padding: 2px 8px;
    background: #eff6ff;
    color: #2563eb;
    border-radius: 10px;
}

/* === CONTACTS === */
.contact-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
}
.contact-row:last-child { border-bottom: none; }
.contact-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #dbeafe;
    color: #1e40af;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}
.badge-type-commercial {
    font-size: 11px;
    padding: 3px 10px;
    background: #eff6ff;
    color: #1e40af;
    border-radius: 10px;
}
.badge-type-comptabilite {
    font-size: 11px;
    padding: 3px 10px;
    background: #dcfce7;
    color: #166534;
    border-radius: 10px;
}
.badge-type-televente {
    font-size: 11px;
    padding: 3px 10px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 10px;
}
.badge-type-autre {
    font-size: 11px;
    padding: 3px 10px;
    background: #f3f4f6;
    color: #4b5563;
    border-radius: 10px;
}
/* === PERSONNEL === */
.employe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}
.employe-card {
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    padding: 16px;
    text-decoration: none;
    color: inherit;
    transition: all 0.15s;
    display: block;
    position: relative;
}
.employe-card:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
.employe-card.inactif {
    opacity: 0.6;
}
.employe-header {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}
.employe-photo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}
.employe-photo-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #dbeafe;
    color: #1e40af;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    text-transform: uppercase;
}
.employe-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
}
.employe-matricule {
    margin: 0;
    font-size: 11px;
    color: #6b7280;
}
.employe-info p {
    margin: 4px 0;
    font-size: 12px;
    color: #4b5563;
}
.employe-footer {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f3f4f6;
}
.badge-inactif {
    font-size: 11px;
    padding: 3px 10px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 10px;
}
/* === BADGES RÔLES === */
.badge-role-admin {
    font-size: 11px;
    padding: 3px 10px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 10px;
    font-weight: 500;
}
.badge-role-responsable {
    font-size: 11px;
    padding: 3px 10px;
    background: #dbeafe;
    color: #1e40af;
    border-radius: 10px;
    font-weight: 500;
}
.badge-role-employe {
    font-size: 11px;
    padding: 3px 10px;
    background: #dcfce7;
    color: #166534;
    border-radius: 10px;
    font-weight: 500;
}
/* === SIDEBAR FOOTER USER === */
.sidebar {
    display: flex;
    flex-direction: column;
    height: 100vh;
}
.sidebar nav {
    flex: 1;
    overflow-y: auto;
}
.sidebar-section-title {
    margin: 16px 0 4px 20px;
    font-size: 11px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sidebar-footer {
    border-top: 1px solid #e5e7eb;
    padding: 12px;
    margin-top: auto;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    margin-bottom: 8px;
}
.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #dbeafe;
    color: #1e40af;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    flex-shrink: 0;
}
.sidebar-user-info {
    min-width: 0;
    flex: 1;
}
.sidebar-user-name {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-user-role {
    margin: 0;
    font-size: 11px;
    color: #6b7280;
}
.sidebar-logout-btn {
    width: 100%;
    padding: 8px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    color: #4b5563;
    font-size: 13px;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
}
.sidebar-logout-btn:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

/* === PAGE DE LOGIN === */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #f6f7f9;
}
.login-card {
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    padding: 32px 28px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}
.login-header {
    text-align: center;
    margin-bottom: 24px;
}
.login-logo {
    font-size: 40px;
    margin-bottom: 8px;
}
.login-header h1 {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 600;
}
.login-header p {
    margin: 0;
    color: #6b7280;
    font-size: 13px;
}
.login-footer {
    margin-top: 20px;
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid #f3f4f6;
}
.login-footer p {
    margin: 0;
    font-size: 12px;
    color: #9ca3af;
}
.login-footer a {
    color: #2563eb;
    text-decoration: none;
}
.login-footer a:hover {
    text-decoration: underline;
}

/* === BADGE INACTIF (parti) === */
.badge-inactif {
    font-size: 11px;
    padding: 3px 10px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 10px;
    font-weight: 500;
}
