:root {
    --fond: #c6ede3;
    --titre: #0033a0;
    --bord: #0fd3a0;
    --text: #0033a0;
    --panel-bg: #ffffff;
    --accent: #c6ede3;
    --danger: #c0392b;
    --muted: #4d6462;
    --focus: #0077cc;
    --radius: 10px;
    --shadow: 0 4px 10px rgba(0,0,0,0.08);
    --gradient: linear-gradient(135deg, #c6ede3 0%, #ffffff 100%);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--fond);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

header {
    background: var(--accent);
    padding: 1.6rem 1rem;
    /* border-bottom supprimé */
    text-align: center;
}

h1 {
    margin: 0 auto;
    font-size: clamp(1.7rem, 2.8vw, 2.4rem);
    color: var(--titre);
    letter-spacing: 1px;
    display: block;
    border-bottom: 2px solid #0fd3a0;
    padding-bottom: .3em;
    margin-bottom: .0em;
    max-width: 1250px;   /* largeur maximale du trait */
    width: 100%;        /* occupe toute la largeur possible */
    text-align: center; /* centre le texte */
}

h2 {
    font-size: 1.3rem;
    margin-top: 0;
    color: var(--titre);
}

h3 { margin: 0 0 .5rem; font-size: 1rem; color: var(--titre); }

main {
    max-width: 1300px;
    margin: 1.5rem auto 3rem;
    padding: 0 1rem;
}

form { margin-bottom: 2rem; }

.grid.two {
    display: grid;
    gap: 1.2rem;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.panel {
    background: var(--panel-bg);
    padding: 1.2rem 1.2rem 1.6rem;
    border: 2px solid var(--bord);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: .8rem;
}

.panel p {
    margin: 0 0 .5rem;
    font-size: .9rem;
    color: var(--muted);
}

#liste-biens .item, #liste-dettes .item {
    display: grid;
    gap: .6rem .9rem;
    align-items: end;
    background: #f7fffd;
    padding: .7rem .7rem 1rem;
    border: 1px solid var(--bord);
    border-radius: 8px;
    margin-bottom: .6rem;
    position: relative;
}

#liste-biens .item {
    /* 2 champs + bouton */
    grid-template-columns: 1fr 1fr 54px;
}

#liste-dettes .item {
    grid-template-columns: 1fr 1fr 54px;
}

.item label {
    display: flex;
    flex-direction: column;
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--muted);
    gap: .3rem;
}

.item input[type="text"], .item select {
    padding: .6rem .6rem;
    border: 1px solid #8ad0c0;
    border-radius: 6px;
    font-size: .9rem;
    background: #fff;
}

.item input:focus, .item select:focus, input:focus {
    outline: 2px solid var(--focus);
    outline-offset: 1px;
}

.btn {
    appearance: none;
    border: 2px solid var(--accent);
    background: transparent;
    color: var(--titre);
    padding: .65rem 1rem;
    font-size: .9rem;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    transition: background .25s, color .25s, transform .15s;
}

.btn.primary {
    background: #0033a0;
    color: #fff;
    border-color: #0033a0;
}
.btn.primary:hover {
    background: #00285e;
    color: #fff;
}
.btn.secondary { background: #ffffff; }
.btn:hover { background: var(--titre); color: #fff; }
.btn:active { transform: translateY(2px); }

.remove-btn {
    background: #fff;
    border: 2px solid var(--danger);
    color: var(--danger);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}

.remove-btn:hover { background: var(--danger); color: #fff; }

label {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    font-size: .8rem;
    font-weight: 600;
    color: var(--muted);
}

input[type="text"], select {
    padding: .7rem .75rem;
    border: 2px solid #8ad0c0;
    border-radius: 8px;
    background: #fff;
    font-size: .95rem;
}

.alert {
    padding: .9rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: .9rem;
}

.alert-danger {
    background: #ffe9e6;
    border: 2px solid #ff9d92;
    color: #8a231b;
}

.cta-wrapper {
    margin-top: 1rem;
    display: flex;
    gap: .8rem;
    flex-wrap: wrap;
}

.resultats {
    margin-top: 2rem;
    background: var(--panel-bg);
    padding: 1.3rem 1.4rem 2rem;
    border: 2px solid var(--bord);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.cards {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit,minmax(180px,1fr));
    margin-bottom: 1.2rem;
}

.card {
    background: #f5fffc;
    border: 2px solid var(--bord);
    border-radius: 14px;
    padding: .9rem .9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .3rem;
    position: relative;
    overflow: hidden;
}

.card.accent {
    background: var(--accent);
    color: #003124;
    border-color: #00b88b;
}

.card .big { font-size: 1.2rem; font-weight: 700; margin: 0; }
.card .small { font-size: .7rem; margin: 0; opacity: .8; }

.details-table summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--titre);
    margin-bottom: .6rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
    background: #fff;
}

thead { background: #daf6ef; }

th, td {
    padding: .55rem .6rem;
    border: 1px solid var(--bord);
    text-align: left;
}

.disclaimer {
    font-size: .75rem;
    line-height: 1.3;
    color: var(--muted);
    margin-top: 1rem;
    background: #eefdf9;
    padding: .7rem .8rem;
    border-left: 4px solid var(--accent);
    border-radius: 6px;
}

footer {
    text-align: center;
    padding: 2rem 1rem;
    font-size: .75rem;
    color: var(--muted);
}

@media (max-width: 680px) {
    #liste-biens .item, #liste-dettes .item {
        grid-template-columns: 1fr 1fr;
        padding-right: 3.2rem;
    }
    #liste-biens .item .remove-btn,
    #liste-dettes .item .remove-btn {
        position: absolute;
        top: 6px;
        right: 6px;
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    .card .big { font-size: 1.05rem; }
}

@media (prefers-color-scheme: dark) {
    body { background: #0e1f1d; color: #e2f5f1; }
    header { background: #0fd3a0; border-bottom-color: #002d84; }
    .panel, .resultats { background: #14302c; }
    input, select { background: #102724; color: #e2f5f1; border-color: #3fbfa5; }
    table { background: #102724; }
    thead { background: #1d4f47; }
    .card { background: #134039; }
    .card.accent { background: #0fd3a0; color: #002f28; }
    .disclaimer { background: #173a35; }
}