:root {
    --black: #151515;
    --ink: #242424;
    --muted: #707070;
    --line: #e9e5dc;
    --paper: #fffaf0;
    --white: #ffffff;
    --yellow: #ffc928;
    --orange: #f28a16;
    --green: #24a065;
    --red: #d94a3a;
    --shadow: 0 14px 40px rgba(0, 0, 0, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f7f5ef;
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.45;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 260px;
    background: var(--black);
    color: var(--white);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    background: var(--yellow);
    color: var(--black);
    border-radius: 8px;
    font-weight: 900;
}

.brand strong,
.brand small {
    display: block;
}

.brand small,
.sidebar-user small,
.muted {
    color: var(--muted);
}

.sidebar nav {
    display: grid;
    gap: 8px;
}

.sidebar nav a {
    padding: 12px 14px;
    border-radius: 8px;
    color: #f6f6f6;
}

.sidebar nav a.active,
.sidebar nav a:hover {
    background: var(--yellow);
    color: var(--black);
}

.sidebar-user {
    margin-top: auto;
    display: grid;
    gap: 4px;
    font-size: 14px;
    position: relative;
    z-index: 50;
}

.sidebar-user a,
.sidebar-user .logout-link {
    color: var(--yellow);
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    width: max-content;
    min-height: 34px;
    padding: 6px 0;
    font-weight: 800;
    pointer-events: auto;
}

.sidebar-user a:hover,
.sidebar-user .logout-link:hover {
    color: #fff;
}

.main {
    flex: 1;
    padding: 28px;
    min-width: 0;
}

.login-wrap {
    min-height: 100vh;
    width: 100%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #151515 0%, #2a261d 58%, #f28a16 100%);
}

.login-card {
    width: min(430px, calc(100vw - 32px));
    background: var(--white);
    border-radius: 8px;
    padding: 32px;
    box-shadow: var(--shadow);
}

.login-brand {
    margin-bottom: 20px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: 30px;
    margin-bottom: 4px;
}

h2 {
    font-size: 19px;
    margin-bottom: 16px;
}

h3 {
    font-size: 16px;
}

.panel,
.metric {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    padding: 20px;
    margin-bottom: 18px;
}

.compact {
    padding: 14px 18px;
}

.metrics-grid,
.grid-two,
.grid-three,
.prospect-layout {
    display: grid;
    gap: 18px;
}

.metrics-grid {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    margin-bottom: 18px;
}

.grid-two {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.prospect-layout {
    grid-template-columns: minmax(330px, 1fr) minmax(360px, .9fr);
}

.metric {
    padding: 18px;
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.metric strong {
    display: block;
    font-size: 30px;
    margin-top: 8px;
}

.btn {
    appearance: none;
    border: 1px solid var(--line);
    background: var(--white);
    color: var(--ink);
    border-radius: 8px;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
}

.btn:hover {
    border-color: var(--orange);
}

.btn.primary {
    background: var(--yellow);
    border-color: var(--yellow);
    color: var(--black);
}

.btn.whatsapp {
    background: var(--green);
    color: var(--white);
    border-color: var(--green);
}

.btn.call {
    background: #0b7f4f;
    color: var(--white);
    border-color: #0b7f4f;
    font-size: 16px;
    min-height: 52px;
}

.btn.email {
    background: #1f6feb;
    color: var(--white);
    border-color: #1f6feb;
}

.btn.location {
    background: #7b4cc2;
    color: var(--white);
    border-color: #7b4cc2;
}

.btn.small {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 13px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px 12px;
    font: inherit;
    background: var(--white);
}

textarea {
    resize: vertical;
}

label {
    display: grid;
    gap: 7px;
    font-weight: 700;
    font-size: 14px;
}

.form-stack,
.form-grid,
.filters,
.inline-form {
    display: grid;
    gap: 14px;
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full,
.form-stack,
.form-grid .full {
    grid-column: 1 / -1;
}

.filters {
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    align-items: end;
}

.inline-form {
    grid-template-columns: minmax(240px, 360px) auto 1fr;
    align-items: center;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 9px;
}

.checkbox input,
.quick-status input {
    width: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 13px;
}

td small {
    display: block;
    color: var(--muted);
}

.status-pill {
    display: inline-flex;
    background: var(--paper);
    color: var(--black);
    border: 1px solid #f0d78d;
    border-radius: 8px;
    padding: 5px 9px;
    font-size: 13px;
    font-weight: 700;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 900;
    border: 1px solid var(--line);
    text-transform: uppercase;
}

.status-badge.hot {
    background: #e7f7ef;
    border-color: #8ad2ad;
    color: #126b43;
}

.status-badge.warm {
    background: #fff5d2;
    border-color: #f3cf67;
    color: #7b5b00;
}

.status-badge.whatsapp {
    background: #e7f4ff;
    border-color: #9fcdf2;
    color: #115d96;
}

.status-badge.unreachable {
    background: #eeeeee;
    border-color: #d5d5d5;
    color: #303030;
}

.status-badge.lost {
    background: #ffe9e6;
    border-color: #efafa8;
    color: #9a271d;
}

.status-badge.callback {
    background: #f1e7ff;
    border-color: #c7a8ee;
    color: #5f2c91;
}

.status-badge.default {
    background: var(--paper);
    color: var(--black);
}

.flash {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    background: #fff5d2;
    border: 1px solid #f3cf67;
}

.flash.success {
    background: #e7f7ef;
    border-color: #9bd7b8;
}

.flash.error {
    background: #ffe9e6;
    border-color: #efafa8;
}

.script-panel {
    background: #151515;
    color: var(--white);
}

.script-panel h2,
.script-panel h3 {
    color: var(--yellow);
}

.script-block {
    border-top: 1px solid #3a3a3a;
    padding-top: 14px;
    margin-top: 14px;
    font-size: 17px;
}

.objection-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.answer-box {
    margin-top: 14px;
    padding: 16px;
    background: var(--paper);
    border: 1px solid #f0d78d;
    border-radius: 8px;
    font-weight: 700;
}

.history-list,
.simple-list {
    display: grid;
    gap: 12px;
}

.history-item,
.relance-card {
    display: grid;
    gap: 5px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf8;
}

.telephony-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 16px;
}

.telephony-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.timer {
    min-width: 92px;
    background: var(--black);
    color: var(--yellow);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 24px;
    font-weight: 900;
    text-align: center;
}

.compact-timer {
    min-height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.quick-notes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.telephony-desk {
    display: grid;
    grid-template-columns: minmax(240px, .8fr) minmax(420px, 1.4fr) minmax(260px, .9fr);
    gap: 14px;
    padding-bottom: 176px;
}

.desk-pane {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 18px;
    min-height: 520px;
}

.script-focus {
    background: var(--black);
    color: var(--white);
}

.script-focus h2,
.script-focus h3 {
    color: var(--yellow);
}

.script-focus .script-block {
    font-size: 21px;
    line-height: 1.6;
}

.prospect-pane h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.desk-status {
    display: inline-flex;
    background: var(--yellow);
    color: var(--black);
    border-radius: 8px;
    padding: 8px 12px;
    font-weight: 900;
    margin-bottom: 14px;
}

.prospect-facts {
    display: grid;
    grid-template-columns: 95px 1fr;
    gap: 8px 10px;
    margin: 0 0 18px;
}

.prospect-facts dt {
    color: var(--muted);
    font-weight: 700;
}

.prospect-facts dd {
    margin: 0;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.full-btn {
    width: 100%;
    min-height: 56px;
    font-size: 17px;
}

.call-actions {
    display: flex;
    gap: 10px;
    align-items: stretch;
    flex-wrap: wrap;
}

.call-actions form {
    margin: 0;
}

.call-actions.stacked {
    display: grid;
}

.call-actions .btn {
    min-height: 54px;
}

.app-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 60;
    max-width: min(360px, calc(100vw - 32px));
    padding: 14px 16px;
    border-radius: 8px;
    background: var(--black);
    color: var(--white);
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}

.app-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.vertical {
    display: grid;
}

.vertical .btn {
    justify-content: flex-start;
    min-height: 54px;
    white-space: normal;
    text-align: left;
}

.large-answer {
    font-size: 18px;
    line-height: 1.55;
}

.quick-call-bar {
    position: fixed;
    left: 288px;
    right: 28px;
    bottom: 16px;
    z-index: 20;
    display: grid;
    grid-template-columns: minmax(130px, .7fr) minmax(300px, 1.4fr) minmax(130px, .6fr) minmax(105px, .5fr) minmax(180px, 1fr) minmax(180px, 1fr) auto auto;
    gap: 10px;
    align-items: end;
    background: #fffdf8;
    border: 2px solid var(--yellow);
    border-radius: 8px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .18);
    padding: 14px;
}

.quick-call-bar label {
    font-size: 12px;
}

.quick-call-bar select,
.quick-call-bar input,
.quick-call-bar textarea {
    padding: 9px 10px;
}

.quick-call-bar .btn {
    min-height: 58px;
}

.action-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.actions-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.advanced-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 14px;
    align-items: end;
}

.chart-card {
    min-height: 360px;
}

.chart-card canvas {
    width: 100%;
    height: 280px;
}

.desk-fast-status {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.desk-fast-status label {
    display: block;
}

.desk-fast-status input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.desk-fast-status span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
    background: var(--white);
    font-weight: 900;
    cursor: pointer;
}

.desk-fast-status input:checked + span {
    background: var(--yellow);
    border-color: var(--yellow);
    color: var(--black);
}

.relance-card:hover {
    border-color: var(--orange);
}

.quick-status {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.public-location {
    min-height: calc(100vh - 56px);
    display: grid;
    place-items: center;
    padding: 20px;
}

.location-card {
    width: min(560px, 100%);
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 28px;
}

.locations-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(300px, .6fr);
    gap: 18px;
}

.map-panel {
    position: relative;
}

.locations-map {
    min-height: 620px;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--line);
}

.map-empty {
    position: absolute;
    left: 32px;
    top: 32px;
    z-index: 2;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
}

.location-details {
    position: sticky;
    top: 28px;
    height: fit-content;
}

.popup-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.leaflet-popup-content .btn {
    min-height: 30px;
}

@media (max-width: 1100px) {
    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-two,
    .grid-three,
    .prospect-layout,
    .locations-layout {
        grid-template-columns: 1fr;
    }

    .filters {
        grid-template-columns: 1fr 1fr;
    }

    .advanced-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .telephony-desk {
        grid-template-columns: 1fr;
        padding-bottom: 0;
    }

    .desk-pane {
        min-height: auto;
    }

    .quick-call-bar {
        position: static;
        grid-template-columns: 1fr 1fr;
        margin-top: 16px;
    }
}

@media (max-width: 760px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        padding: 16px;
    }

    .sidebar nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .main {
        padding: 16px;
    }

    .page-head {
        align-items: stretch;
        flex-direction: column;
    }

    .metrics-grid,
    .form-grid,
    .filters,
    .inline-form,
    .advanced-filters {
        grid-template-columns: 1fr;
    }

    .table-panel {
        overflow-x: auto;
    }

    table {
        min-width: 680px;
    }

    .telephony-head {
        flex-direction: column;
        align-items: stretch;
    }

    .telephony-tools {
        align-items: stretch;
    }

    .telephony-tools .btn,
    .telephony-tools form,
    .timer {
        width: 100%;
    }

    .script-focus .script-block {
        font-size: 18px;
    }

    .quick-call-bar {
        grid-template-columns: 1fr;
    }
}

.prospect-vehicles { margin-top: 10px; }
.vehicle-card { border: 1px solid #e5dfd2; border-radius: 8px; padding: 14px; margin: 12px 0; background: #fffaf0; }
.vehicle-card h4 { margin: 0 0 10px; color: #111; }
/* KOYAA sidebar accordion stability */
.sidebar { background: #111; color: #fff; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; background: #111; }
.sidebar nav a { color: #f6f6f6 !important; background: transparent; }
.sidebar nav a.active,
.sidebar nav a:hover { background: #ffc726 !important; color: #111 !important; }
.menu-section-title { font-family: inherit; }
.menu-section-items a { display: block; }
.vehicle-card { border: 1px solid #e5dfd2; border-radius: 8px; padding: 12px; margin: 10px 0; background: #fffaf0; }
.vehicle-card summary { cursor: pointer; font-weight: 800; color: #111; }
.vehicle-card[open] summary { margin-bottom: 10px; }
@media (max-width: 760px) {
  .sidebar { background: #111; }
  .sidebar nav { display: flex; flex-direction: column; grid-template-columns: none; }
}
/* Page de connexion KOYAA Sales */
.login-sales-page {
    position: fixed;
    inset: 0;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: clamp(18px, 4vw, 70px);
    overflow: hidden;
    background: #071a35;
}
.login-sales-bg {
    position: absolute;
    inset: 0;
    background-image: url('../login-koyaa-sales.png');
    background-size: cover;
    background-position: center;
    transform: scale(1.01);
}
.login-sales-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(3, 15, 34, .12) 0%, rgba(3, 15, 34, .10) 42%, rgba(3, 15, 34, .55) 100%);
}
.login-sales-card {
    position: relative;
    width: min(420px, calc(100vw - 32px));
    margin-right: clamp(0px, 5vw, 90px);
    background: rgba(255, 255, 255, .96);
    border: 1px solid rgba(255,255,255,.7);
    border-radius: 14px;
    padding: 28px;
    box-shadow: 0 24px 70px rgba(0,0,0,.30);
}
.login-sales-mini-brand {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 18px;
    color: #071a35;
}
.login-sales-mini-brand strong {
    font-size: 24px;
    letter-spacing: .08em;
}
.login-sales-mini-brand span {
    color: var(--orange);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .16em;
    font-size: 12px;
}
.login-sales-card h1 {
    margin: 0 0 6px;
    font-size: 30px;
    color: #111;
}
.login-sales-subtitle {
    margin: 0 0 22px;
    color: #5f6470;
}
.login-sales-form {
    display: grid;
    gap: 14px;
}
.login-sales-form label {
    display: grid;
    gap: 7px;
    font-weight: 800;
    color: #111;
}
.login-sales-form input {
    width: 100%;
    min-height: 48px;
    border: 1px solid #ded8cc;
    border-radius: 9px;
    padding: 11px 13px;
    font-size: 15px;
    background: #fff;
}
.login-sales-form input:focus {
    outline: 3px solid rgba(255, 201, 40, .35);
    border-color: var(--orange);
}
.login-sales-submit {
    width: 100%;
    min-height: 48px;
    margin-top: 4px;
}
@media (max-width: 900px) {
    .login-sales-page {
        justify-content: center;
        align-items: flex-end;
    }
    .login-sales-overlay {
        background: linear-gradient(180deg, rgba(3, 15, 34, .10) 0%, rgba(3, 15, 34, .22) 46%, rgba(3, 15, 34, .78) 100%);
    }
    .login-sales-card {
        margin: 0 0 18px;
    }
}
@media (max-width: 520px) {
    .login-sales-page { padding: 12px; }
    .login-sales-bg { background-position: center top; }
    .login-sales-card { padding: 22px; border-radius: 12px; }
}