/* =========================================================
   Collect'Huiles – habillage de l'interface
   Couleurs d'origine conservées : orange #f78b26 / jaune #F0B325
   (thème Kendo "turquoise" inchangé pour les composants)
   ========================================================= */

:root {
    --ch-orange: #f78b26;
    --ch-orange-dark: #d9711a;
    --ch-yellow: #F0B325;
    --ch-ink: #2b2b2b;
    --ch-muted: #6b6b6b;
    --ch-bg: #f6f5f3;
    --ch-card: #ffffff;
    --ch-line: #ebe7e2;
    --ch-radius: 12px;
    --ch-shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.06);
}

body {
    background: var(--ch-bg);
    color: var(--ch-ink);
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.main { background: var(--ch-bg); }

/* ---------- Barre du haut ---------- */
.top-row {
    background: var(--ch-card) !important;
    border-bottom: 1px solid var(--ch-line) !important;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.top-row a { color: var(--ch-orange-dark); font-weight: 600; text-decoration: none; }
.top-row a:hover { color: var(--ch-orange); }

/* ---------- Menu latéral ---------- */
.k-drawer {
    background: linear-gradient(180deg, var(--ch-orange) 0%, #f39a3d 100%) !important;
    border-right: none !important;
}
.k-drawer .k-drawer-item {
    color: #fff !important;
    margin: 2px 10px;
    border-radius: 8px;
    padding: 10px 14px !important;
    transition: background .15s ease;
}
.k-drawer .k-drawer-item .k-icon { color: #fff; }
.k-drawer .k-drawer-item:hover,
.k-drawer .k-drawer-item.text-info {
    background: rgba(255,255,255,.22) !important;
    color: #fff !important;
}
.k-drawer .k-drawer-item.text-info { font-weight: 600; box-shadow: inset 3px 0 0 #fff; }
.ch-version { color: rgba(255,255,255,.85); font-size: 12px; letter-spacing: .3px; }

/* ---------- En-tête de page ---------- */
.ch-page-header {
    display: flex; justify-content: space-between; align-items: flex-end;
    margin: 18px 0 14px;
}
.ch-page-title { font-size: 26px; font-weight: 700; margin: 0; color: var(--ch-ink); }
.ch-title { font-size: 22px; font-weight: 700; margin: 0 0 .6em; }
.ch-subtitle { font-size: 16px; font-weight: 600; margin: 18px 0 8px; text-align: left; }
.ch-muted { color: var(--ch-muted); font-size: 13px; }
.ch-muted:first-letter { text-transform: uppercase; }

/* ---------- Indicateurs clés ---------- */
.ch-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}
.ch-kpi {
    display: flex; align-items: center; gap: 14px;
    background: var(--ch-card);
    border-radius: var(--ch-radius);
    box-shadow: var(--ch-shadow);
    padding: 16px 18px;
    border-left: 4px solid var(--ch-orange);
}
.ch-kpi-accent { border-left-color: var(--ch-yellow); }
.ch-kpi-icon {
    font-size: 22px; width: 44px; height: 44px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: #fff3e6; color: var(--ch-orange-dark);
}
.ch-kpi-accent .ch-kpi-icon { background: #fff8e1; color: #b8860b; }
.ch-kpi-value { font-size: 28px; font-weight: 700; line-height: 1.1; }
.ch-kpi-label { font-size: 13px; color: var(--ch-muted); }

/* ---------- Tuiles ---------- */
.k-tilelayout { background: transparent !important; padding: 0 !important; }
.k-tilelayout-item.k-card {
    border: none !important;
    border-radius: var(--ch-radius) !important;
    box-shadow: var(--ch-shadow) !important;
    overflow: hidden;
}
.k-tilelayout-item-header.k-card-header {
    background: var(--ch-card) !important;
    border-bottom: 1px solid var(--ch-line) !important;
    padding: 12px 16px !important;
}

/* ---------- Barre d'outils des tuiles ---------- */
.ch-toolbar {
    display: flex; flex-wrap: wrap; gap: 10px 16px;
    align-items: center; justify-content: space-between; width: 100%;
}
.ch-toolbar-title { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; text-align: left; }
.ch-toolbar-title .k-icon { color: var(--ch-orange); }
.ch-toolbar-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ch-chip {
    font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
    background: #fff3e6; color: var(--ch-orange-dark);
}
.ch-switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ch-muted); cursor: pointer; margin: 0; }

/* bouton de filtre sélectionné : orange de la marque */
.k-button-group .k-button.k-selected,
.k-button-group .k-button.k-state-active {
    background: var(--ch-orange) !important;
    border-color: var(--ch-orange) !important;
    color: #fff !important;
}

/* ---------- Zone actions (virements / tournées) ---------- */
.ch-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; text-align: left; }
.ch-field { display: flex; flex-direction: column; gap: 4px; }
.ch-field label { font-size: 12px; color: var(--ch-muted); margin: 0; }
.ch-empty {
    margin-top: 16px; padding: 18px; border: 1px dashed var(--ch-line); border-radius: 10px;
    color: var(--ch-muted); background: #fcfbfa; text-align: center;
}

/* ---------- Grille ---------- */
.k-grid { border-radius: 10px; border-color: var(--ch-line) !important; }
.k-grid .k-grid-header th { font-weight: 600; }
.k-grid tbody tr:hover { background: #fff7ef !important; }
.k-grid td a { color: var(--ch-ink); font-weight: 600; text-decoration: none; }
.k-grid td a:hover { color: var(--ch-orange-dark); text-decoration: underline; }

/* ---------- Cartes génériques ---------- */
.ch-card {
    background: var(--ch-card); border-radius: var(--ch-radius); box-shadow: var(--ch-shadow); padding: 24px 28px;
}

/* ---------- Bandeau d'erreur Blazor ---------- */
#blazor-error-ui {
    background: #fff4e5;
    color: #7a4a00;
    border-top: 3px solid var(--ch-orange);
    box-shadow: 0 -4px 14px rgba(0,0,0,.08);
    padding: 14px 20px;
    font-size: 15px;
    display: none;
    gap: 16px; align-items: center;
    position: fixed; bottom: 0; left: 0; width: 100%; z-index: 100000;
}
#blazor-error-ui .reload {
    background: var(--ch-orange); color: #fff; padding: 6px 14px; border-radius: 6px;
    text-decoration: none; font-weight: 600; margin-left: 12px;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 18px; top: 12px; font-size: 18px; }

/* =========================================================
   Style commun à TOUTES les pages de l'appli (menu latéral)
   limité à .main .content : la page vitrine /welcome n'est pas touchée
   ========================================================= */
.main .content { padding-top: 12px; padding-bottom: 32px; }

.main .content h1,
.main .content h2,
.main .content h3 { color: var(--ch-ink); font-weight: 700; letter-spacing: -.2px; }
.main .content h1 { font-size: 26px; margin: 14px 0 12px; }
.main .content h2 { font-size: 22px; margin: 14px 0 10px; }
.main .content h3 { font-size: 18px; margin: 12px 0 8px; }

/* cartes Telerik (fiche client, compte, paramètres...) */
.main .content .k-card {
    border: none;
    border-radius: var(--ch-radius);
    box-shadow: var(--ch-shadow);
    overflow: hidden;
}
.main .content .k-card-header {
    background: var(--ch-card);
    border-bottom: 1px solid var(--ch-line);
    padding: 12px 16px;
}
.main .content .k-card-title { font-weight: 600; font-size: 16px; }

/* boutons principaux : orange de la marque */
.main .content .k-button-solid-primary,
.main .content .k-button.k-primary {
    background: var(--ch-orange);
    border-color: var(--ch-orange);
    color: #fff;
}
.main .content .k-button-solid-primary:hover,
.main .content .k-button.k-primary:hover {
    background: var(--ch-orange-dark);
    border-color: var(--ch-orange-dark);
}
.main .content .k-button { border-radius: 8px; }

/* champs de saisie : contour orange quand on écrit dedans */
.main .content .k-input:focus-within,
.main .content .k-textbox:focus-within,
.main .content .k-picker:focus-within,
.main .content .form-control:focus {
    border-color: var(--ch-orange);
    box-shadow: 0 0 0 3px rgba(247,139,38,.18);
}

/* onglets */
.main .content .k-tabstrip-items .k-item.k-active,
.main .content .k-tabstrip-items .k-item.k-state-active {
    border-bottom: 3px solid var(--ch-orange);
    font-weight: 600;
}
.main .content .k-tabstrip-items .k-link:hover { color: var(--ch-orange-dark); }

/* agenda (planning des collectes) */
.main .content .k-scheduler { border-radius: 10px; border-color: var(--ch-line); }
.main .content .k-scheduler-toolbar { background: var(--ch-card); }
.main .content .k-event { border-radius: 6px; }

/* fenêtres (popups) */
.k-window { border-radius: var(--ch-radius); box-shadow: 0 10px 40px rgba(0,0,0,.18); }
.k-window-titlebar { background: var(--ch-orange); color: #fff; }
.k-window-titlebar .k-button { color: #fff; }

/* notifications plus lisibles */
.k-notification { border-radius: 10px; box-shadow: var(--ch-shadow); font-size: 14px; }

/* =========================================================
   Clients V2 (aperçu) : liste + fiche client
   ========================================================= */
.ch-v2-badge {
    font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
    background: #fff3e6; color: var(--ch-orange-dark); vertical-align: middle; margin-left: 8px;
}
.ch-v2-search { padding: 16px 18px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 12px; }
.ch-v2-searchbar { display: flex; align-items: center; gap: 10px; border: 1px solid var(--ch-line); border-radius: 10px; padding: 0 12px; background: #fff; }
.ch-v2-searchbar:focus-within { border-color: var(--ch-orange); box-shadow: 0 0 0 3px rgba(247,139,38,.18); }
.ch-v2-searchbar .k-icon { color: var(--ch-muted); }
.ch-v2-input { border: none; outline: none; flex: 1; height: 42px; font-size: 15px; background: transparent; }
.ch-v2-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.ch-v2-chip {
    border: 1px solid var(--ch-line); background: #fff; border-radius: 999px; padding: 6px 14px;
    font-size: 13px; color: var(--ch-ink); cursor: pointer;
}
.ch-v2-chip:hover { border-color: var(--ch-orange); }
.ch-v2-chip.on { background: var(--ch-orange); border-color: var(--ch-orange); color: #fff; }
.ch-v2-count { font-weight: 600; margin-left: 4px; opacity: .8; }

.ch-v2-list { padding: 6px 0; }
.ch-v2-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ch-v2-table th { text-align: left; font-weight: 600; font-size: 12px; color: var(--ch-muted); padding: 10px 14px; border-bottom: 1px solid var(--ch-line); }
.ch-v2-table td { padding: 10px 14px; border-bottom: 1px solid var(--ch-line); vertical-align: middle; }
.ch-v2-table tbody tr { cursor: pointer; }
.ch-v2-table tbody tr.static { cursor: default; }
.ch-v2-table tbody tr:hover { background: #fff7ef; }
.ch-v2-table .num { text-align: right; white-space: nowrap; }
.ch-v2-table .tags { text-align: right; white-space: nowrap; }
.ch-v2-table.compact td, .ch-v2-table.compact th { padding: 8px 10px; }
.ch-v2-name { font-weight: 600; }
.ch-v2-more { text-align: center; padding: 12px; }

.ch-v2-pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; margin-left: 4px; white-space: nowrap; }
.ch-v2-pill.ok { background: #e7f5ea; color: #276737; }
.ch-v2-pill.warn { background: #fff4d6; color: #8a5a00; }
.ch-v2-pill.danger { background: #fdecec; color: #a12c2c; }
.ch-v2-pill.grey { background: #efedea; color: #5f5e5a; }

.ch-v2-back { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 10px; }
.ch-v2-back a { color: var(--ch-orange-dark); font-weight: 600; text-decoration: none; }
.ch-v2-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; padding: 18px 22px; margin-bottom: 14px; }
.ch-v2-ident { display: flex; gap: 14px; align-items: center; min-width: 0; }
.ch-v2-avatar {
    width: 52px; height: 52px; border-radius: 50%; flex: none;
    background: #fff3e6; color: var(--ch-orange-dark); font-weight: 700; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
}
.ch-v2-title { font-size: 22px; font-weight: 700; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ch-v2-sub { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ch-muted); margin-top: 4px; }
.ch-v2-sub a { color: var(--ch-ink); text-decoration: none; }
.ch-v2-sub a:hover { color: var(--ch-orange-dark); }
.ch-v2-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ch-v2-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px;
    border: 1px solid var(--ch-line); background: #fff; color: var(--ch-ink); font-weight: 600; font-size: 14px; text-decoration: none;
}
.ch-v2-btn:hover { border-color: var(--ch-orange); color: var(--ch-orange-dark); text-decoration: none; }
.ch-v2-btn.primary { background: var(--ch-orange); border-color: var(--ch-orange); color: #fff; }
.ch-v2-btn.primary:hover { background: var(--ch-orange-dark); color: #fff; }

.ch-kpi-danger { border-left-color: #d64545; background: #fff6f6; }
.ch-kpi-danger .ch-kpi-value, .ch-kpi-danger .ch-kpi-label { color: #a12c2c; }

.ch-v2-cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.ch-v2-col { display: flex; flex-direction: column; gap: 14px; }
.ch-v2-col .ch-card { padding: 16px 18px; }
.ch-v2-cardtitle { font-weight: 700; font-size: 16px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ch-v2-bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; height: 140px; align-items: end; }
.ch-v2-bar { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.ch-v2-bar-val { background: var(--ch-orange); border-radius: 4px 4px 0 0; min-height: 2px; }
.ch-v2-bar:hover .ch-v2-bar-val { background: var(--ch-orange-dark); }
.ch-v2-bar-lbl { font-size: 11px; color: var(--ch-muted); text-align: center; margin-top: 4px; }
.ch-v2-solli { padding: 8px 10px; border-radius: 8px; background: #fff8e1; margin-bottom: 6px; font-size: 14px; }
.ch-v2-info { font-size: 14px; }
.ch-v2-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--ch-line); }
.ch-v2-row:last-child { border-bottom: none; }
.ch-v2-row > span:last-child { text-align: right; overflow-wrap: anywhere; }

@media (max-width: 991px) {
    .ch-v2-cols { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
    .ch-v2-table th:nth-child(3), .ch-v2-table td:nth-child(3),
    .ch-v2-table th:nth-child(5), .ch-v2-table td:nth-child(5) { display: none; }
    .ch-v2-title { font-size: 19px; }
    .ch-v2-btn { flex: 1 1 45%; justify-content: center; }
}

/* =========================================================
   Carte V2 (aperçu)
   ========================================================= */
.ch-map-toolbar { padding: 12px 16px; margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; justify-content: space-between; }
.ch-map-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ch-muted); }
.ch-map-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.ch-map-wrap {
    position: relative; height: calc(100vh - 240px); min-height: 460px;
    border-radius: var(--ch-radius); overflow: hidden; box-shadow: var(--ch-shadow); background: #e9e6e1;
}
.ch-map { position: absolute; inset: 0; z-index: 1; }
/* fond de carte adouci : les points orange ressortent mieux */
.ch-map .leaflet-tile-pane { filter: grayscale(.85) brightness(1.04) contrast(.92); }
.ch-map-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--ch-muted); z-index: 2; }
.ch-map-pin span {
    display: block; width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.ch-map-cluster div {
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 13px;
    border: 3px solid rgba(255,255,255,.85); box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.ch-map-cluster { background: transparent; }
.ch-map-panel {
    position: absolute; top: 12px; right: 12px; z-index: 500; width: 300px; max-width: calc(100% - 24px);
    background: #fff; border-radius: var(--ch-radius); box-shadow: 0 8px 30px rgba(0,0,0,.18);
    padding: 16px 18px; display: none; font-size: 14px;
}
.ch-map-panel.open { display: block; }
.ch-map-close { position: absolute; top: 6px; right: 10px; border: none; background: none; font-size: 22px; color: var(--ch-muted); cursor: pointer; }
.ch-map-ptitle { font-size: 17px; font-weight: 700; padding-right: 20px; }
.ch-map-pstatus { font-size: 13px; font-weight: 600; margin: 2px 0 8px; }
.ch-map-prow { color: var(--ch-muted); margin-bottom: 6px; }
.ch-map-prow a { color: var(--ch-ink); font-weight: 600; text-decoration: none; }
.ch-map-pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 14px; }
.ch-map-pgrid div { background: #faf8f5; border-radius: 8px; padding: 8px 10px; }
.ch-map-pgrid span { display: block; font-size: 11px; color: var(--ch-muted); }
.ch-map-pgrid b { font-size: 15px; }
.ch-map-pactions { display: flex; gap: 8px; }
.ch-map-pactions .ch-v2-btn { flex: 1; justify-content: center; }
@media (max-width: 767px) {
    .ch-map-wrap { height: calc(100vh - 300px); }
    .ch-map-panel { top: auto; bottom: 12px; right: 12px; left: 12px; width: auto; }
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
    .ch-page-title { font-size: 22px; }
    .ch-kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
    .ch-kpi { padding: 12px; gap: 10px; }
    .ch-kpi-icon { display: none; }
    .ch-kpi-value { font-size: 22px; }
    .ch-card { padding: 18px; }
    /* boutons plus grands au doigt (chauffeurs sur tablette / téléphone) */
    .main .content .k-button { min-height: 40px; }
    .main .content h1 { font-size: 22px; }
}
