/* ===========================================================
   TAXI POL — style commun (Feuille de route + Décompte caisse)
   Palette: fond ardoise sombre, accent jaune taxi, cartes claires.
=========================================================== */

:root {
    --ink:        #1c2430;
    --ink-soft:   #4a5568;
    --paper:      #ffffff;
    --bg:         #eef1f5;
    --taxi:       #f5b700;
    --taxi-dark:  #c98f00;
    --line:       #d8dde5;
    --ok:         #1f8a5f;
    --danger:     #c0392b;
    --rouge-bon:  #c0392b;
    --vert-bon:   #1f8a5f;
    --radius:     10px;
    --font-head:  'Fjalla One', 'Arial Narrow', sans-serif;
    --font-body:  'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    background-image:
        linear-gradient(180deg, var(--ink) 0px, var(--ink) 64px, transparent 64px),
        repeating-linear-gradient(45deg, #00000000 0 18px, #00000008 18px 36px);
    font-family: var(--font-body);
    color: var(--ink);
    padding-bottom: 60px;
}

.topbar {
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    color: #fff;
    flex-wrap: wrap;
}
.topbar .badge {
    width: 42px; height: 42px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--taxi);
}
.topbar .badge img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.topbar h1 {
    font-family: var(--font-head);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-size: 17px;
    margin: 0;
}
.topbar span { color: #c7ceda; font-size: 13px; }

.wrap { max-width: 780px; margin: 20px auto; padding: 0 14px; }

/* ---- Tabs ---- */
.tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    background: #dfe4eb;
    padding: 5px;
    border-radius: 10px;
}
.tab-btn {
    flex: 1;
    padding: 11px 10px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--ink-soft);
    font-family: var(--font-head);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 13.5px;
    cursor: pointer;
}
.tab-btn.active {
    background: var(--ink);
    color: var(--taxi);
    box-shadow: 0 4px 12px -4px rgba(28,36,48,.5);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.card {
    background: var(--paper);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 20px -12px rgba(28,36,48,.25);
}

.card h2 {
    font-family: var(--font-head);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 15px;
    margin: 0 0 14px 0;
    padding-bottom: 8px;
    border-bottom: 3px solid var(--taxi);
    display: inline-block;
}
.card h3 { margin: 0; }

.grid { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid .full { grid-column: 1 / -1; }

@media (max-width: 560px) {
    .grid, .grid.cols-3 { grid-template-columns: 1fr 1fr; }
}

label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

input, select, textarea {
    width: 100%;
    padding: 10px 11px;
    border: 1.5px solid var(--line);
    border-radius: 7px;
    font-size: 15px;
    font-family: inherit;
    color: var(--ink);
    background: #fbfcfe;
}
input:disabled { background: #eef0f3; color: var(--ink-soft); }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--taxi-dark);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(245,183,0,.25);
}
textarea { resize: vertical; min-height: 60px; }

/* ---- dynamic rows (courses / cartes banque) ---- */
#courses-list, #cartes-banque-list { display: flex; flex-direction: column; gap: 12px; }

.course {
    border: 1.5px dashed var(--line);
    border-radius: 8px;
    padding: 14px;
    position: relative;
    background: #fafbfd;
}
.course-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px;
}
.course-head .num {
    font-family: var(--font-head);
    background: var(--ink);
    color: var(--taxi);
    padding: 3px 10px;
    border-radius: 5px;
    font-size: 13px;
    letter-spacing: 0.03em;
}
.btn-remove {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
}
.btn-remove:hover { text-decoration: underline; }

.btn-add {
    width: 100%;
    padding: 13px;
    border-radius: 8px;
    border: 2px dashed var(--taxi-dark);
    background: #fff8e6;
    color: var(--taxi-dark);
    font-weight: 700;
    font-size: 14.5px;
    cursor: pointer;
    margin-top: 12px;
}
.btn-add:hover { background: #fff1cc; }
.btn-add:disabled { opacity: .6; cursor: wait; }

.actions { position: sticky; bottom: 0; padding: 14px 0 4px; background: linear-gradient(180deg, transparent, var(--bg) 30%); }
.actions-row { display: flex; gap: 10px; }

.btn-submit {
    flex: 1.4;
    padding: 16px;
    border: none;
    border-radius: 9px;
    background: var(--ink);
    color: var(--taxi);
    font-family: var(--font-head);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 10px 24px -10px rgba(28,36,48,.55);
}
.btn-submit:active { transform: translateY(1px); }

.btn-save {
    flex: 1;
    padding: 16px;
    border: 2px solid var(--ink);
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
    font-family: var(--font-head);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-size: 14.5px;
    cursor: pointer;
}
.btn-save:active { transform: translateY(1px); }
.btn-save:disabled { opacity: .6; cursor: wait; }

.save-status {
    text-align: center;
    font-size: 12px;
    color: var(--ink-soft);
    min-height: 16px;
    margin-bottom: 6px;
}

.hint { font-size: 12px; color: var(--ink-soft); margin-top: 6px; }

.alert {
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}
.alert.error { background: #fdeceb; color: var(--danger); border: 1px solid #f3c1bb; }
.alert.success { background: #e9f7f1; color: var(--ok); border: 1px solid #b9e5cf; }
.alert.info { background: #eef3fb; color: #2c5789; border: 1px solid #bcd4ef; }

/* ---- login / admin ---- */
.login-card { max-width: 420px; margin: 40px auto; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.admin-table th, .admin-table td {
    text-align: left;
    padding: 9px 8px;
    border-bottom: 1px solid var(--line);
}
.admin-table th {
    color: var(--ink-soft);
    text-transform: uppercase;
    font-size: 11.5px;
    letter-spacing: 0.03em;
}
.admin-table .btn-remove { font-size: 12px; padding: 2px 6px; }

.toast {
    position: fixed;
    left: 50%;
    bottom: -60px;
    transform: translateX(-50%);
    background: var(--ink);
    color: var(--taxi);
    padding: 11px 20px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: 0 12px 30px -10px rgba(0,0,0,.5);
    transition: bottom .25s ease;
    z-index: 50;
}
.toast.show { bottom: 20px; }
.toast.error { background: var(--danger); color: #fff; }

/* ===========================================================
   DÉCOMPTE CAISSE — tableaux additions / déductions
=========================================================== */
.caisse-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.caisse-table td {
    padding: 8px 6px;
    vertical-align: middle;
    border-bottom: 1px solid var(--line);
}
.caisse-table tr:last-child td { border-bottom: none; }
.caisse-table .lbl { font-weight: 600; width: 55%; }
.caisse-table .op {
    width: 24px;
    text-align: center;
    font-family: var(--font-head);
    font-size: 16px;
    color: var(--ink-soft);
}
.caisse-table .unit { width: 24px; color: var(--ink-soft); font-size: 13px; }
.caisse-table input { padding: 8px 9px; font-size: 14px; }
.caisse-table .row-rouge .lbl { color: var(--rouge-bon); }
.caisse-table .row-vert .lbl { color: var(--vert-bon); }
.caisse-table .note {
    font-size: 11px;
    color: var(--ink-soft);
    font-style: italic;
    padding-top: 12px;
}
.caisse-table .lbl-total {
    font-family: var(--font-head);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-align: right;
    padding-right: 10px;
    white-space: nowrap;
}
.caisse-table .total-cell {
    font-family: var(--font-head);
    font-size: 17px;
    color: var(--ink);
    white-space: nowrap;
}

/* ---- Décomptes : deux colonnes (Cartes de banque / Espèces) ---- */
.decomptes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}
@media (max-width: 640px) {
    .decomptes-grid { grid-template-columns: 1fr; }
}

.col-head {
    font-family: var(--font-head);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 13px;
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 12px;
    color: #fff;
}
.col-head-carte { background: var(--ink); }
.col-head-especes { background: var(--taxi-dark); }

.carte-banque .carte-row { display: flex; align-items: center; gap: 10px; }
.carte-banque .carte-row label { margin: 0; white-space: nowrap; }
.carte-banque .carte-row input { max-width: 140px; margin-left: auto; }

.especes-list { display: flex; flex-direction: column; gap: 8px; }
.espece-row {
    display: grid;
    grid-template-columns: 60px 14px 64px 1fr;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
}
.espece-label { color: var(--ink-soft); font-weight: 600; white-space: nowrap; }
.espece-x { text-align: center; color: var(--ink-soft); }
.espece-row input { padding: 7px 8px; font-size: 14px; }
.espece-montant {
    font-family: var(--font-head);
    color: var(--ink);
    text-align: right;
    white-space: nowrap;
}

.col-total {
    margin-top: 14px;
    text-align: right;
    font-family: var(--font-head);
    font-size: 15px;
    letter-spacing: 0.02em;
    padding-top: 10px;
    border-top: 2px solid var(--taxi);
}
