* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    min-height: 100vh;
}

.container {
    max-width: 560px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    color: #2c3e50;
}

h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: #555;
}

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    user-select: none;
}

.toggle input {
    width: 18px;
    height: 18px;
    accent-color: #3498db;
}

.mode-switch {
    display: flex;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #ccc;
}

.btn-mode {
    padding: 0.4rem 1rem;
    border: none;
    background: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s, color 0.2s;
}

.btn-mode.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}

.btn-mode:not(.active):hover {
    background: #eee;
}

/* Zone lecture */
.zone-lecture {
    background: #fff;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.ligne-lecture {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.ligne-lecture:last-child {
    border-bottom: none;
}

.lect-nom {
    font-weight: 500;
}

.lect-pct {
    color: #3498db;
    font-weight: 600;
}

.vide {
    color: #999;
    font-style: italic;
    font-size: 0.9rem;
}

/* Zone édition */
.zone-edition {
    background: #fff;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
}

/* Inputs ne dépassent jamais leur conteneur */
input[type="text"],
input[type="number"] {
    max-width: 100%;
}

.ligne-edition {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.ligne-edition input[type="text"] {
    flex: 1;
    min-width: 0;
}

.ligne-edition input[type="number"] {
    width: 80px;
    min-width: 0;
}

.ligne-edition .pct-label {
    font-size: 0.85rem;
    color: #888;
}

.ajout-personne {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #eee;
    flex-wrap: wrap;
}

.ajout-personne input[type="text"] {
    flex: 1;
    min-width: 0;
}

.ajout-personne input[type="number"] {
    width: 80px;
    min-width: 0;
}

.total-pct {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    text-align: right;
}

.total-pct.ok {
    color: #27ae60;
}

.total-pct.ko {
    color: #e74c3c;
}

/* Inputs */
input[type="text"],
input[type="number"] {
    padding: 0.45rem 0.6rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

input:focus {
    border-color: #3498db;
}

/* Buttons */
.btn {
    padding: 0.45rem 0.9rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-ajouter {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}

.btn-ajouter:hover {
    background: linear-gradient(135deg, #5a6fd6, #6a4293);
}

.btn-supprimer {
    background: linear-gradient(135deg, #e74c3c, #8e44ad);
    color: #fff;
    padding: 0.6rem 0.9rem;
    font-size: 0.85rem;
}

.btn-supprimer:hover {
    background: linear-gradient(135deg, #c0392b, #7d3c98);
}

.btn-small {
    background: linear-gradient(135deg, #3498db, #9b59b6);
    color: #fff;
    padding: 0.45rem 1.2rem;
    font-size: 0.85rem;
}

.btn-small:hover {
    background: linear-gradient(135deg, #2980b9, #8e44ad);
}

.btn-calculer {
    display: block;
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.btn-calculer:hover {
    background: linear-gradient(135deg, #5a6fd6, #6a4293);
}

/* Mode panels */
.mode-panel {
    background: #fff;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.champ-montant {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.champ-montant:not(:last-child) {
    margin-bottom: 0.75rem;
}

.champ-montant label {
    font-size: 0.9rem;
    white-space: nowrap;
}

.champ-montant input {
    flex: 1;
    min-width: 0;
}

/* Résultats */
.resultats {
    background: #fff;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.ligne-resultat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.ligne-resultat:last-child {
    border-bottom: none;
}

.res-nom {
    font-weight: 500;
}

.res-pct {
    color: #888;
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

.res-montant {
    font-weight: 600;
    color: #2c3e50;
}

.total-resultat {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 2px solid #eee;
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 1.05rem;
}

.btn-copier {
    display: block;
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.6rem;
    background: linear-gradient(135deg, #a855f7, #3b82f6);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    text-align: center;
}

.btn-copier:hover {
    background: linear-gradient(135deg, #9333ea, #2563eb);
}

.hidden {
    display: none !important;
}
