/* Evtar — Evlyana Services
   Feuille de style unique : application cliente, administration, devis imprimable.
   Mobile d'abord : une seule colonne par defaut, le multi-colonnes commence a 768px. */

:root {
    --green-900: #0B3B24;
    --green-800: #12543A;
    --green-700: #17704A;
    --green-600: #1E8A5B;
    --green-500: #27A368;
    --green-050: #EAF6EF;
    --blue-900: #0E2F52;
    --blue-700: #154C82;
    --blue-600: #1B62A5;
    --blue-050: #E8F1FA;
    --ink: #0F1B14;
    --ink-soft: #33473F;
    --muted: #6B7F78;
    --line: #DCE7E1;
    --bg: #F2F7F4;
    --card: #FFFFFF;
    --danger: #B3261E;
    --danger-050: #FDECEA;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 4px 16px rgba(15, 59, 36, .07);
    --shadow-lg: 0 14px 40px rgba(15, 59, 36, .14);
    --nav-h: 66px;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    padding: 0 0 calc(var(--nav-h) + 22px + env(safe-area-inset-bottom, 0px));
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--green-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 8px; line-height: 1.22; letter-spacing: -.01em; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }
p { margin: 0 0 10px; }
ul { margin: 0; padding: 0; list-style: none; }
strong { font-weight: 700; }
.mt-16 { margin-top: 16px; }

/* ------------------------------------------------------------------ Topbar */

.topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
    background: rgba(255, 255, 255, .92);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.topbar__brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar__brand img { border-radius: 10px; }
.topbar__brand strong { display: block; font-size: 1rem; color: var(--green-800); }
.topbar__brand span { display: block; font-size: .78rem; color: var(--muted); }
.topbar__actions { display: flex; align-items: center; gap: 8px; }
.topbar--admin { background: rgba(14, 47, 82, .94); border-bottom-color: rgba(255, 255, 255, .12); }
.topbar--admin .topbar__brand strong { color: #fff; }
.topbar--admin .topbar__brand span { color: rgba(255, 255, 255, .72); }
.topbar__logout {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 12px; border-radius: 999px;
    background: rgba(255, 255, 255, .14); color: #fff;
    font-size: .85rem; font-weight: 600; text-decoration: none;
    transition: transform .12s ease, background .2s ease;
}
.topbar__logout:hover { background: rgba(255, 255, 255, .24); text-decoration: none; }
.topbar__logout:active { transform: scale(.97); }

/* ------------------------------------------------------------------- Layout */

.app-main { padding: 16px 14px 30px; max-width: 1180px; margin: 0 auto; }
.section { margin-bottom: 26px; }
.section__head {
    display: flex; flex-wrap: wrap; gap: 12px;
    align-items: flex-end; justify-content: space-between;
    margin-bottom: 16px;
}
.section__sub { color: var(--muted); font-size: .92rem; margin: 0; max-width: 62ch; }
.section__actions { display: flex; flex-wrap: wrap; gap: 8px; }

.page-head { padding: 6px 0 4px; }
.page-head__text { color: var(--ink-soft); max-width: 66ch; }

/* --------------------------------------------------------------------- Card */

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 16px;
}
.card:last-child { margin-bottom: 0; }
.card__head { margin-bottom: 14px; }
.card__head h2, .card__head h3 { margin-bottom: 4px; }
.card__head p { margin: 0; color: var(--muted); font-size: .88rem; }
.card__head--row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; justify-content: space-between; }
.card--info { background: linear-gradient(180deg, #fff 0%, var(--green-050) 100%); }
.card--chart { display: flex; flex-direction: column; }
.card--danger { border: 1px solid #F2C9C5; background: linear-gradient(180deg, #fff 0%, var(--danger-050) 100%); }
.card--sticky { position: static; }
.note { color: var(--muted); font-size: .82rem; margin: 10px 0 0; }
.link { font-size: .88rem; font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 16px; }

/* -------------------------------------------------------------- Statistiques */

.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { margin: 0; padding: 16px; }
.stat__label { display: block; font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat__value { display: block; font-size: 1.5rem; font-weight: 700; color: var(--ink); margin: 6px 0 2px; word-break: break-word; }
.stat__value--green { color: var(--green-700); }
.stat__value--blue { color: var(--blue-600); font-size: 2rem; }
.stat__hint { display: block; font-size: .78rem; color: var(--muted); }

.rank-list li {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .92rem;
}
.rank-list li:last-child { border-bottom: 0; }
.rank-list__count { font-weight: 700; color: var(--green-700); }
.rank-list__empty, .table__empty { color: var(--muted); font-size: .9rem; padding: 12px 0; text-align: center; }

/* ------------------------------------------------------------------- Boutons */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 18px; border-radius: 999px; border: 1px solid transparent;
    font-size: .93rem; font-weight: 600; font-family: inherit; cursor: pointer;
    transition: transform .12s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
    text-decoration: none; line-height: 1.2; background: transparent; color: var(--ink);
    min-height: 44px;
}
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--green-700); color: #fff; box-shadow: 0 6px 18px rgba(23, 112, 74, .22); }
.btn--primary:hover { background: var(--green-800); text-decoration: none; }
.btn--ghost { background: #fff; border-color: var(--line); color: var(--green-800); }
.btn--ghost:hover { border-color: var(--green-600); text-decoration: none; }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #8f1d17; text-decoration: none; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn--sm { padding: 8px 12px; font-size: .82rem; min-height: 38px; }

.install-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 14px; border-radius: 999px; border: 1px solid var(--green-600);
    background: var(--green-050); color: var(--green-800);
    font-family: inherit; font-size: .87rem; font-weight: 600; cursor: pointer;
    transition: transform .12s ease, background .2s ease;
}
.install-btn:active { transform: scale(.97); }
.install-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* -------------------------------------------------------------- Formulaires */

.field { display: block; margin-bottom: 12px; }
.field__label { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.field input, .field select, .field textarea, .select, .input-qty, textarea {
    width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: #fff; color: var(--ink);
    font-family: inherit; font-size: .95rem; min-height: 46px;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.field input:focus, .field select:focus, .field textarea:focus, .select:focus, .input-qty:focus, textarea:focus {
    outline: none; border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(30, 138, 91, .14);
}
.field textarea, textarea { min-height: 120px; resize: vertical; }
.field--full { grid-column: 1 / -1; }
.checks { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; color: var(--ink-soft); }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--green-700); flex: 0 0 auto; }
.fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 16px; background: #FCFEFD; }
.fieldset legend { font-size: .82rem; font-weight: 700; color: var(--green-800); text-transform: uppercase; letter-spacing: .04em; padding: 0 6px; }
.form-error { color: var(--danger); font-size: .88rem; font-weight: 600; margin: 6px 0; }
.form-success { color: var(--green-700); font-size: .9rem; font-weight: 600; margin: 6px 0; }
.alert { border-radius: var(--radius-sm); padding: 12px 14px; font-size: .9rem; margin-bottom: 14px; }
.alert--error { background: var(--danger-050); color: var(--danger); border: 1px solid #F2C9C5; }
.alert--info { background: var(--blue-050); color: var(--blue-700); border: 1px solid #C9DFF3; }
.counter { font-size: .82rem; font-weight: 600; color: var(--green-700); background: var(--green-050); padding: 5px 11px; border-radius: 999px; }

/* ------------------------------------------------------------------ Tableaux */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 100%; }
.table th {
    text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions-col { text-align: right; width: 1%; }
.table--compact td, .table--compact th { padding: 8px 8px; }
.table .is-green { color: var(--green-700); }
.table .is-total { font-weight: 700; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line);
    background: #fff; color: var(--ink-soft); cursor: pointer;
    transition: transform .12s ease, border-color .2s ease, color .2s ease;
}
.icon-btn:hover { border-color: var(--green-600); color: var(--green-700); }
.icon-btn:active { transform: scale(.94); }
.icon-btn--danger:hover { border-color: var(--danger); color: var(--danger); }
.tag {
    display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--green-700); background: var(--green-050);
    padding: 3px 9px; border-radius: 999px; margin-bottom: 6px;
}
.status {
    display: inline-block; padding: 4px 10px; border-radius: 999px;
    font-size: .75rem; font-weight: 700; white-space: nowrap;
}
.status--nouveau { background: var(--blue-050); color: var(--blue-700); }
.status--envoye { background: #FFF4E0; color: #97600D; }
.status--accepte { background: var(--green-050); color: var(--green-700); }
.status--refuse { background: var(--danger-050); color: var(--danger); }
.status--termine { background: #EDEAF7; color: #4B3F91; }

.toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.toolbar__search { position: relative; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 12px; background: #fff; }
.toolbar__search svg { color: var(--muted); flex: 0 0 auto; }
.toolbar__search input { border: 0; padding: 12px 0; flex: 1; min-height: 46px; font-size: .95rem; font-family: inherit; }
.toolbar__search input:focus { outline: none; }
.select { min-width: 0; }

.pager { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; margin-top: 14px; }
.pager button {
    min-width: 40px; min-height: 40px; border-radius: 12px; border: 1px solid var(--line);
    background: #fff; font-family: inherit; font-size: .88rem; cursor: pointer;
}
.pager button.is-active { background: var(--green-700); border-color: var(--green-700); color: #fff; font-weight: 700; }
.pager span { font-size: .84rem; color: var(--muted); }

/* ------------------------------------------------------------------ Onglets */

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tabs__item {
    padding: 10px 16px; border-radius: 999px; background: #fff; border: 1px solid var(--line);
    font-size: .9rem; font-weight: 600; color: var(--ink-soft); text-decoration: none;
}
.tabs__item.is-active { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.tabs__item:hover { text-decoration: none; }

/* --------------------------------------------------------------------- Hero */

.hero {
    display: grid; grid-template-columns: 1fr; gap: 20px;
    background: linear-gradient(160deg, #fff 0%, var(--green-050) 60%, var(--blue-050) 100%);
    border-radius: 22px; padding: 22px 18px; margin-bottom: 26px; box-shadow: var(--shadow);
}
.hero__content h1 { font-size: 1.85rem; color: var(--green-900); }
.hero__text { color: var(--ink-soft); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.hero__stats { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 0; }
.hero__stats div { background: rgba(255, 255, 255, .75); border-radius: var(--radius-sm); padding: 12px; }
.hero__stats dt { font-size: 1.3rem; font-weight: 700; color: var(--green-700); }
.hero__stats dd { margin: 2px 0 0; font-size: .82rem; color: var(--ink-soft); }
.hero__media { position: relative; }
.hero__media img { border-radius: var(--radius); width: 100%; height: 260px; object-fit: cover; }
.hero__badge {
    position: static; margin-top: 12px; background: #fff; border-radius: var(--radius-sm);
    padding: 12px 14px; box-shadow: var(--shadow);
}
.hero__badge strong { display: block; font-size: 1.35rem; color: var(--green-700); }
.hero__badge span { font-size: .8rem; color: var(--muted); }
.pill {
    display: inline-block; background: var(--green-700); color: #fff;
    font-size: .76rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    padding: 6px 12px; border-radius: 999px; margin-bottom: 12px;
}

/* --------------------------------------------------------------- Simulateur */

.sim__layout { display: grid; grid-template-columns: 1fr; gap: 16px; }
.sim__col { min-width: 0; }
.service-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.service-card {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; display: flex; flex-direction: column; margin: 0;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.service-card img { width: 100%; height: 150px; object-fit: cover; }
.service-card__body { padding: 14px; display: flex; flex-direction: column; flex: 1; }
.service-card__body h4 { margin-bottom: 6px; }
.service-card__body p { color: var(--muted); font-size: .86rem; flex: 1; }
.service-card__price { margin: 10px 0 12px; }
.service-card__price strong { font-size: 1.2rem; color: var(--green-800); }
.service-card__price > span { display: block; font-size: .8rem; color: var(--muted); }
.badge-credit {
    display: inline-block; margin-top: 6px; font-size: .76rem; font-weight: 600;
    color: var(--green-700); background: var(--green-050); padding: 4px 9px; border-radius: 999px;
}
.badge-credit--off { background: #F1F1F1; color: var(--muted); }
.service-card.is-selected { border-color: var(--green-600); box-shadow: 0 8px 22px rgba(30, 138, 91, .16); }

.basket { margin: 0 0 14px; }
.basket li {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    padding: 10px 0; border-bottom: 1px solid var(--line);
}
.basket__name { flex: 1 1 100%; font-size: .9rem; font-weight: 600; }
.basket__controls { display: flex; align-items: center; gap: 8px; flex: 1 1 100%; }
.basket .input-qty { width: 74px; min-height: 40px; padding: 8px 10px; }
.basket .select { min-height: 40px; padding: 8px 10px; font-size: .85rem; flex: 1; }
.basket__total { font-size: .85rem; font-weight: 700; color: var(--green-700); }
.basket__remove {
    width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line);
    background: #fff; color: var(--danger); cursor: pointer; flex: 0 0 auto;
}
.basket__empty { border: 0; color: var(--muted); font-size: .88rem; text-align: center; padding: 14px 0; }

.result { border-top: 1px solid var(--line); padding-top: 14px; }
.result__line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: .9rem; padding: 5px 0; color: var(--ink-soft); }
.result__line strong { font-variant-numeric: tabular-nums; }
.result__line--credit { color: var(--green-700); font-weight: 600; }
.result__total {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
    margin-top: 10px; padding: 12px 14px; border-radius: var(--radius-sm);
    background: var(--green-050); font-weight: 700; color: var(--green-800);
}
.result__total--month { background: var(--blue-050); color: var(--blue-700); margin-top: 8px; }
.result__total strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.result__cap { font-size: .78rem; color: var(--muted); margin: 10px 0 10px; }
.result__avance { font-size: .82rem; color: var(--blue-700); background: var(--blue-050); border-radius: var(--radius-sm); padding: 10px 12px; margin: 10px 0 0; }
.bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--line); margin-top: 6px; }
.bar__part { display: block; height: 100%; transition: width .35s ease; }
.bar__part--credit { background: var(--green-500); }
.bar__part--aid { background: var(--blue-600); }
.bar__part--reste { background: #C4D3CB; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: .78rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot--credit { background: var(--green-500); }
.dot--aid { background: var(--blue-600); }
.dot--reste { background: #C4D3CB; }

/* -------------------------------------------------------------- Bandeau / FAQ */

.band { background: var(--green-800); border-radius: 22px; padding: 20px 18px; margin-bottom: 26px; color: #fff; }
.band__grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.band__item h3 { color: #fff; }
.band__item p { color: rgba(255, 255, 255, .82); font-size: .88rem; margin: 0; }
.band__num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .16);
    font-weight: 700; margin-bottom: 10px;
}
.list-check li { position: relative; padding: 7px 0 7px 26px; font-size: .9rem; color: var(--ink-soft); }
.list-check li::before {
    content: ""; position: absolute; left: 4px; top: 14px; width: 7px; height: 12px;
    border-right: 2px solid var(--green-600); border-bottom: 2px solid var(--green-600);
    transform: rotate(40deg);
}
.faq details {
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 14px 16px; margin-bottom: 10px;
}
.faq summary { font-weight: 600; cursor: pointer; color: var(--green-800); }
.faq summary::marker { color: var(--green-600); }
.faq p { margin: 10px 0 0; color: var(--ink-soft); font-size: .9rem; }
.cta {
    display: grid; grid-template-columns: 1fr; gap: 16px;
    background: linear-gradient(140deg, var(--blue-700), var(--green-700));
    border-radius: 22px; padding: 22px 18px; color: #fff;
}
.cta h2 { color: #fff; }
.cta p { color: rgba(255, 255, 255, .85); margin: 0; }
.cta__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cta .btn--primary { background: #fff; color: var(--green-800); }
.cta .btn--ghost { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .4); color: #fff; }

/* ------------------------------------------------------------- Grille tarifs */

.price-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.price-card {
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
    display: flex; flex-direction: column;
}
.price-card img { width: 100%; height: 160px; object-fit: cover; }
.price-card__body { padding: 16px; display: flex; flex-direction: column; flex: 1; }
.price-card__body h2 { font-size: 1.05rem; }
.price-card__body p { color: var(--muted); font-size: .86rem; flex: 1; }
.price-card__list { margin: 10px 0 14px; }
.price-card__list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: .88rem; }
.price-card__list li.is-total { border-bottom: 0; font-weight: 700; color: var(--green-800); padding-top: 10px; }
.price-card__list li.is-green strong { color: var(--green-700); }
.contact-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.contact-list li:last-child { border-bottom: 0; }
.contact-list__icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 12px; background: var(--green-050); color: var(--green-700); flex: 0 0 auto;
}
.contact-side { display: flex; flex-direction: column; }
.card--legal h2 { color: var(--green-800); }
.card--legal p { color: var(--ink-soft); font-size: .92rem; }
.legal-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: .9rem; }
.legal-list li:last-child { border-bottom: 0; }
.legal-list span { color: var(--muted); }

/* ------------------------------------------------------------------- Footer */

.footer { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.footer__grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
.footer h3 { font-size: .95rem; }
.footer p, .footer__links li { font-size: .87rem; color: var(--muted); }
.footer__links li { padding: 3px 0; }
.footer__bottom { margin-top: 18px; font-size: .78rem; color: var(--muted); }

/* -------------------------------------------------- Barre de navigation basse */

.app-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    display: flex; align-items: stretch; justify-content: space-around;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, .88);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
}
.app-nav__item {
    flex: 1 1 0; min-width: 0;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 8px 2px; border-radius: 16px; color: var(--muted);
    font-size: .68rem; font-weight: 600; text-decoration: none;
    transition: transform .12s ease, background .2s ease, color .2s ease;
}
.app-nav__item:active { transform: scale(.94); }
.app-nav__item.is-active { color: var(--green-800); background: var(--green-050); }
.app-nav__item:hover { text-decoration: none; }
.app-nav__icon { display: inline-flex; }
.app-nav__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.page-admin .app-nav { background: rgba(14, 47, 82, .92); border-top-color: rgba(255, 255, 255, .12); }
.page-admin .app-nav__item { color: rgba(255, 255, 255, .7); }
.page-admin .app-nav__item.is-active { color: #fff; background: rgba(255, 255, 255, .18); }

/* ------------------------------------------------------------------- Modales */

.modal {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: flex-end; justify-content: center;
    background: rgba(9, 30, 20, .5); padding: 0;
}
.modal__panel {
    background: #fff; width: 100%; max-width: 620px; max-height: 92vh;
    border-radius: 22px 22px 0 0; display: flex; flex-direction: column;
    animation: sheetUp .25s ease;
}
.modal__panel--wide { max-width: 860px; }
@keyframes sheetUp { from { transform: translateY(24px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.modal__head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.modal__head h2 { margin: 0; font-size: 1.1rem; }
.modal__close {
    width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
    background: #fff; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--ink-soft);
}
.modal__body { padding: 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal__foot {
    display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end;
    padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line);
}
.modal__hint { font-size: .82rem; color: var(--muted); }
.install-steps { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 12px 0; }
.install-step { display: flex; gap: 12px; align-items: flex-start; background: var(--green-050); border-radius: var(--radius-sm); padding: 12px; }
.install-step p { margin: 4px 0 0; font-size: .85rem; color: var(--ink-soft); }
.install-step__logo { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 12px; background: #fff; color: var(--green-700); flex: 0 0 auto; }
.recap { background: var(--green-050); border-radius: var(--radius-sm); padding: 12px 14px; margin-top: 12px; font-size: .88rem; }
.recap div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.line-builder { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 12px; }
.estimate-box { background: var(--green-050); border-radius: var(--radius); padding: 14px; }
.estimate-box__row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: .88rem; padding: 4px 0; color: var(--ink-soft); }
.estimate-box__row--total { font-weight: 700; color: var(--green-800); font-size: .95rem; padding-top: 8px; }
.estimate-box__row strong { font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------------- Toasts */

.toasts { position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom, 0px)); z-index: 300; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
    background: var(--green-800); color: #fff; border-radius: var(--radius-sm);
    padding: 12px 14px; font-size: .88rem; box-shadow: var(--shadow-lg);
    animation: toastIn .2s ease;
}
.toast--error { background: var(--danger); }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ------------------------------------------------------------------ Messages */

.msg-list { display: grid; grid-template-columns: 1fr; gap: 12px; }
.msg {
    border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: #fff;
}
.msg__head { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.msg__head strong { font-size: .95rem; }
.msg__meta { font-size: .78rem; color: var(--muted); }
.msg__text { font-size: .89rem; color: var(--ink-soft); margin: 8px 0 10px; }
.msg__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chart-box { position: relative; height: 240px; }
.chart-box--round { height: 240px; }
.chart-fallback { font-size: .85rem; color: var(--muted); margin: 10px 0 0; }

/* -------------------------------------------------------------- Page connexion */

.page-login { background: linear-gradient(160deg, var(--green-800), var(--blue-900)); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px 14px; }
.login { width: 100%; max-width: 440px; }
.login__panel { background: #fff; border-radius: 24px; padding: 24px 20px; box-shadow: var(--shadow-lg); }
.login__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login__brand img { border-radius: 14px; }
.login__brand h1 { font-size: 1.15rem; margin: 0; color: var(--green-800); }
.login__brand h1 span { font-weight: 500; color: var(--muted); }
.login__brand p { margin: 2px 0 0; font-size: .82rem; color: var(--muted); }
.login__form { margin-top: 8px; }
.login__hint { font-size: .8rem; color: var(--muted); margin-top: 14px; }
.login__back { display: inline-block; margin-top: 10px; font-size: .85rem; font-weight: 600; }

/* -------------------------------------------------------------- Page devis */

.page-devis { background: #EDF1EF; padding: 16px 0 40px; }
.devis-toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 0 14px 16px; }
.devis-sheet {
    background: #fff; max-width: 820px; margin: 0 auto; padding: 24px 18px;
    border-radius: 18px; box-shadow: var(--shadow);
}
.devis-head { display: grid; grid-template-columns: 1fr; gap: 14px; border-bottom: 2px solid var(--green-700); padding-bottom: 14px; margin-bottom: 18px; }
.devis-head__brand { display: flex; align-items: center; gap: 12px; }
.devis-head__brand h1 { font-size: 1.3rem; margin: 0; color: var(--green-800); }
.devis-head__brand p { margin: 2px 0 0; font-size: .82rem; color: var(--muted); }
.devis-head__meta p { margin: 0 0 2px; font-size: .88rem; }
.devis-parties { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 18px; }
.devis-parties h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.devis-parties p { margin: 0; font-size: .9rem; }
.devis-table { width: 100%; border-collapse: collapse; font-size: .85rem; margin-bottom: 18px; }
.devis-table th { background: var(--green-050); color: var(--green-800); text-align: left; padding: 9px; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.devis-table td { padding: 9px; border-bottom: 1px solid var(--line); }
.devis-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.devis-tag { display: inline-block; margin-left: 6px; font-size: .68rem; background: #F1F1F1; color: var(--muted); padding: 2px 7px; border-radius: 999px; }
.devis-totals { display: grid; grid-template-columns: 1fr; gap: 16px; }
.devis-totals__left h2 { font-size: .95rem; }
.devis-totals__left p { font-size: .85rem; color: var(--ink-soft); }
.devis-recap { width: 100%; border-collapse: collapse; font-size: .88rem; }
.devis-recap th, .devis-recap td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; font-weight: 400; }
.devis-recap .num { text-align: right; font-variant-numeric: tabular-nums; }
.devis-recap .is-green { color: var(--green-700); }
.devis-recap .is-total th, .devis-recap .is-total td { font-weight: 700; color: var(--green-800); background: var(--green-050); border-bottom: 0; }
.devis-note { font-size: .8rem; color: var(--muted); }
.devis-foot { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; }
.devis-foot p { font-size: .85rem; }
.devis-sign { height: 70px; border: 1px dashed var(--line); border-radius: 12px; margin-bottom: 10px; }
.devis-foot__legal { font-size: .72rem; color: var(--muted); }

/* ------------------------------------------------------------------- Splash */

#app-splash {
    display: none; position: fixed; inset: 0; z-index: 99999; pointer-events: none;
    flex-direction: column; align-items: center; justify-content: center; gap: 14px;
    background: var(--green-700); color: #fff; font-weight: 700; font-size: 1.1rem;
}
.page-admin #app-splash, .page-login #app-splash { background: var(--blue-900); }
#app-splash img { border-radius: 22px; }
#app-splash.show { display: flex; animation: splashOut .4s ease 1.2s forwards; }
@keyframes splashOut { to { opacity: 0; visibility: hidden; } }

/* ----------------------------------------------------- Points de rupture */

@media (min-width: 768px) {
    body { font-size: 17px; }
    .app-main { padding: 22px 22px 40px; }
    h1 { font-size: 2rem; }
    .card { padding: 22px; }
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .price-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .band__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .footer__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .hero { padding: 30px 26px; }
    .hero__stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .hero__content h1 { font-size: 2.3rem; }
    .cta { grid-template-columns: 1.3fr .9fr; align-items: center; padding: 28px 26px; }
    .toolbar { flex-direction: row; flex-wrap: wrap; align-items: center; }
    .toolbar__search { flex: 1 1 260px; }
    .toolbar .select { flex: 0 0 auto; width: auto; }
    .msg-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .line-builder { grid-template-columns: 2fr 90px 1fr auto; align-items: center; }
    .devis-sheet { padding: 34px 30px; border-radius: 20px; }
    .devis-head { grid-template-columns: 1fr auto; }
    .devis-head__meta { text-align: right; }
    .devis-parties { grid-template-columns: 1fr 1fr; }
    .devis-totals { grid-template-columns: 1.1fr 1fr; }
    .modal { align-items: center; padding: 20px; }
    .modal__panel { border-radius: 22px; max-height: 88vh; animation: none; }
    .install-steps { grid-template-columns: 1fr 1fr; }
    .toasts { left: auto; right: 20px; bottom: 20px; width: 320px; }
    .hero__badge { position: absolute; left: 16px; right: 16px; bottom: 16px; margin-top: 0; }
    .hero__media img { height: 380px; }
}

@media (min-width: 1024px) {
    .hero { grid-template-columns: 1.1fr .9fr; align-items: center; gap: 30px; }
    .hero__stats { grid-template-columns: 1fr; max-width: 320px; }
    .sim__layout { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; gap: 20px; }
    .sim__col--side .card--sticky { position: sticky; top: 90px; }
    .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1180px) {
    .price-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .service-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Tableaux empiles sur petit ecran : une ligne devient une carte lisible. */
@media (max-width: 767px) {
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr {
        border: 1px solid var(--line); border-radius: var(--radius-sm);
        padding: 6px 12px; margin-bottom: 10px; background: #fff;
    }
    .table td {
        border-bottom: 1px dashed var(--line); padding: 8px 0;
        display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
        text-align: left !important;
    }
    .table td:last-child { border-bottom: 0; }
    .table td::before {
        content: attr(data-label); font-size: .72rem; font-weight: 700; text-transform: uppercase;
        letter-spacing: .04em; color: var(--muted); flex: 0 0 auto;
    }
    .table td.table__empty { display: block; text-align: center !important; }
    .table td.table__empty::before { content: none; }
    .table .actions-col { width: auto; }
    .row-actions { justify-content: flex-start; }
}

/* Impression du devis */
@media print {
    .devis-toolbar, .app-nav, .topbar, .install-btn, .toasts { display: none !important; }
    body.page-devis { background: #fff; padding: 0; }
    .devis-sheet { box-shadow: none; border-radius: 0; max-width: none; padding: 0; }
    .devis-head { grid-template-columns: 1fr auto; }
    .devis-parties { grid-template-columns: 1fr 1fr; }
    .devis-totals { grid-template-columns: 1.1fr 1fr; }
}
