/* MaxAI Compagny — thème vert forêt / ferme, assorti au logo */

:root {
    --forest-dark: #12281a;
    --forest: #1c3a24;
    --forest-light: #2c5334;
    --green: #3f8a4a;
    --green-light: #5aa864;
    --gold: #d9a441;
    --cream: #f6f3e9;
    --white: #ffffff;
    --text-dark: #1f2a20;
    --text-muted: #6b7768;
    --danger: #b3452f;
    --border: #e2ddc9;
    --shadow: 0 4px 16px rgba(18, 40, 26, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
    background: var(--cream);
    color: var(--text-dark);
}

h1, h2, h3 { margin: 0 0 12px; color: var(--forest-dark); }
p { line-height: 1.5; }
.muted { color: var(--text-muted); }

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

/* ---------- Connexion / Installation ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(160deg, rgba(18,40,26,0.92), rgba(28,58,36,0.88)),
        radial-gradient(circle at top right, rgba(217,164,65,0.25), transparent 55%);
    padding: 24px;
}

.login-card {
    background: var(--white);
    border-radius: 16px;
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}

.login-logo {
    width: 88px;
    height: 88px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--gold);
    margin-bottom: 16px;
}

.login-card h1 { font-size: 22px; }
.login-subtitle { color: var(--text-muted); margin-bottom: 20px; font-size: 14px; }

.login-form { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.login-form label { font-size: 13px; font-weight: 600; color: var(--forest); margin-top: 8px; }
.login-form input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}
.login-form button { margin-top: 20px; }

/* ---------- Accueil (choix client / entreprise) ---------- */
.landing-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(160deg, rgba(18,40,26,0.92), rgba(28,58,36,0.88)),
        radial-gradient(circle at top right, rgba(217,164,65,0.25), transparent 55%);
    padding: 24px;
}

.landing-container { text-align: center; max-width: 640px; width: 100%; }

.landing-logo {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--gold);
    margin-bottom: 18px;
}

.landing-container h1 { color: var(--white); font-size: 28px; margin-bottom: 6px; }
.landing-subtitle { color: rgba(255,255,255,0.75); margin-bottom: 32px; font-size: 15px; }

.landing-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 560px) {
    .landing-choices { grid-template-columns: 1fr; }
}

.landing-card {
    background: var(--white);
    border-radius: 16px;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    box-shadow: 0 20px 50px rgba(0,0,0,0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.landing-card:hover {
    text-decoration: none;
    transform: translateY(-4px);
    box-shadow: 0 24px 56px rgba(0,0,0,0.4);
}

.landing-card-icon { font-size: 34px; margin-bottom: 4px; }
.landing-card-title { font-size: 18px; font-weight: 700; color: var(--forest-dark); }
.landing-card-desc { font-size: 13px; color: var(--text-muted); }
.landing-card-arrow { font-size: 20px; color: var(--green); margin-top: 10px; }

.landing-card-dark {
    background: var(--forest-dark);
}
.landing-card-dark .landing-card-title { color: var(--white); }
.landing-card-dark .landing-card-desc { color: rgba(255,255,255,0.65); }
.landing-card-dark .landing-card-arrow { color: var(--gold); }

/* ---------- Page publique (registre partagé) ---------- */
.public-page {
    min-height: 100vh;
    background: var(--cream);
    padding: 32px 16px 60px;
}

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

.public-columns {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 780px) {
    .public-columns { grid-template-columns: 1fr; }
}

.public-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.public-header img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--gold);
}

.public-header h1 { font-size: 20px; margin: 0; }
.public-header p { margin: 2px 0 0; }

.public-container-narrow { max-width: 560px; }
.public-container-order { max-width: 900px; }

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin-top: 14px;
}

.product-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    background: var(--cream);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.product-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 10px;
    background: var(--white);
}

.product-name { font-weight: 600; font-size: 14px; color: var(--forest-dark); }
.product-price { font-size: 13px; color: var(--green); font-weight: 700; }

.order-total-bar {
    margin-top: 18px;
    padding: 14px 18px;
    background: var(--forest-dark);
    color: var(--white);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 15px;
}
.order-total-bar strong { color: var(--gold); font-size: 20px; }

.qty-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.qty-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--forest);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
}
.qty-btn:hover { background: var(--green); color: var(--white); border-color: var(--green); }

.qty-stepper input {
    width: 48px;
    text-align: center;
    padding: 6px 4px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
}

.public-footer-link { text-align: center; margin-top: 18px; }
.public-footer-link a { font-size: 13px; color: var(--text-muted); }

.phone-input {
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 11px;
    background: var(--white);
}
.phone-input span { color: var(--text-muted); font-weight: 600; }
.phone-input input {
    border: none;
    padding: 9px 0;
    font-size: 14px;
    width: 100%;
}
.phone-input input:focus { outline: none; }

/* ---------- Structure de l'application ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--forest-dark), var(--forest));
    color: var(--white);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    margin-bottom: 16px;
}

.sidebar-brand img {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--gold);
}

.sidebar-brand strong { display: block; font-size: 14px; }
.sidebar-brand span { display: block; font-size: 11px; color: rgba(255,255,255,0.6); }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.sidebar-nav a {
    color: rgba(255,255,255,0.82);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    text-decoration: none;
}

.sidebar-nav a:hover { background: rgba(255,255,255,0.08); }
.sidebar-nav a.active { background: var(--green); color: var(--white); font-weight: 600; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-title { font-size: 19px; margin: 0; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.topbar-name { font-size: 14px; font-weight: 600; }

.content { padding: 24px 28px 40px; }

/* ---------- Cartes / grilles ---------- */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px;
    margin-bottom: 22px;
    box-shadow: var(--shadow);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card { display: flex; flex-direction: column; gap: 6px; }
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.stat-value { font-size: 26px; font-weight: 700; color: var(--forest-dark); }
.stat-positive { color: var(--green); }
.stat-negative { color: var(--danger); }

/* ---------- Formulaires ---------- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    align-items: end;
}

.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field-wide { grid-column: 1 / -1; }
.checkbox-field { flex-direction: row; align-items: center; gap: 8px; }

.form-grid label { font-size: 13px; font-weight: 600; color: var(--forest); }

.form-grid input,
.form-grid select {
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--white);
}

.form-grid button { grid-column: -2 / -1; justify-self: start; }

.share-link-box { display: flex; gap: 8px; align-items: center; }
.share-link-box input {
    flex: 1;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    background: var(--cream);
    color: var(--text-dark);
}

.inline-form { display: inline-block; margin-right: 6px; }
.inline-percent { display: flex; align-items: center; gap: 6px; }
.produit-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.inline-percent input { width: 80px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; }
.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }
.produits-cell { font-size: 13px; line-height: 1.6; white-space: nowrap; }

/* ---------- Boutons ---------- */
.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary { background: var(--green); color: var(--white); }
.btn-primary:hover { background: var(--forest); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--forest); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--cream); text-decoration: none; }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #8f3524; text-decoration: none; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.table tbody tr:hover { background: var(--cream); }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--white);
    background: var(--text-muted);
}

.badge-pdg, .badge-co_pdg { background: var(--gold); color: var(--forest-dark); }
.badge-drh { background: var(--forest); }
.badge-chef { background: var(--green); }
.badge-cdi { background: #3d6fa8; }
.badge-cdd { background: #7b7f6f; }
.badge-stagiaire { background: #b7ab7e; color: var(--forest-dark); }
.badge-recette { background: var(--green); }
.badge-depense { background: var(--danger); }
.badge-default { background: var(--text-muted); }

/* ---------- Alertes ---------- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; }
.alert-success { background: #e4f3e5; color: #245c2b; border: 1px solid #bfe3c2; }
.alert-error { background: #fbe6e1; color: #8f3524; border: 1px solid #f0c3b7; }

/* ---------- Responsive ---------- */
@media (max-width: 780px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; }
    .sidebar-brand { border-bottom: none; margin-bottom: 0; padding: 0 12px 0 0; }
    .sidebar-nav { flex-direction: row; }
    .content { padding: 18px; }
    .form-grid button { grid-column: 1 / -1; }
}
