:root {
    --bg: #0f1115;
    --bg-soft: #13161c;
    --card: #1a1d24;
    --card-hover: #21252e;
    --field: #12151b;
    --text: #e8e8ea;
    --text-muted: #9aa0ab;
    --accent: #d9a441;
    --accent-soft: rgba(217, 164, 65, 0.12);
    --border: #2a2e37;
    --present: #3f8f5b;
    --absent: #b0473f;
    --radius: 14px;
}

* {
    box-sizing: border-box;
    font-family: "Inter", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

html, body {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body {
    background-color: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

main {
    flex: 1;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 4vw, 2rem) 4rem;
}

/* ---------- Hero ---------- */

.hero {
    margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
    text-align: center;
}

.hero h1 {
    margin: 0;
    font-size: clamp(1.8rem, 5vw, 2.6rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.hero h1::after {
    content: "";
    display: block;
    width: 3rem;
    height: 3px;
    margin: 0.8rem auto 0;
    border-radius: 3px;
    background: var(--accent);
}

.hero-sub {
    margin: 1rem auto 0;
    color: var(--text-muted);
    font-size: clamp(0.95rem, 2vw, 1.1rem);
    max-width: 50ch;
}

/* ---------- Panel ---------- */

.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(1.2rem, 4vw, 2rem);
}

.add-form,
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    align-items: center;
    margin-bottom: 1.2rem;
}

.add-form {
    padding-bottom: 1.2rem;
    border-bottom: 1px solid var(--border);
}

.toolbar.hidden,
.table-wrap.hidden,
.panel-foot.hidden,
.empty-state.hidden {
    display: none;
}

/* ---------- Form fields ---------- */

input, select {
    background: var(--field);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 0.95rem;
    padding: 0.55em 0.7em;
    transition: border-color 0.2s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent);
}

input::placeholder {
    color: var(--text-muted);
}

/* Custom chevron for selects */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 2.2em;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%239aa0ab' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8em center;
    cursor: pointer;
}

select:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23d9a441' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

select option {
    background: var(--card);
    color: var(--text);
}

/* Remove native number spinners for a clean look */
input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#name, #lastName { width: 7em; }
#age { width: 5em; }

/* ---------- Buttons ---------- */

button {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 0.92rem;
    padding: 0.55em 1em;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

button:hover {
    background: var(--card-hover);
    border-color: #3a4150;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #1a1206;
    font-weight: 600;
}

.btn-primary:hover {
    background: #e6b454;
    border-color: #e6b454;
    color: #1a1206;
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: default;
}

#filterBtn.active {
    background: var(--accent-soft);
    border-color: rgba(217, 164, 65, 0.45);
    color: var(--accent);
}

/* ---------- Table ---------- */

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

table {
    border-collapse: collapse;
    width: 100%;
    min-width: 480px;
}

th, td {
    padding: 0.7em 0.9em;
    text-align: center;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

thead th {
    background: var(--bg-soft);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.presence-pill {
    min-width: 6.5em;
    padding: 0.4em 0.9em;
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: 999px;
}

.presence-pill.present {
    color: #a7e0bb;
    background: rgba(63, 143, 91, 0.18);
    border-color: rgba(63, 143, 91, 0.45);
}

.presence-pill.absent {
    color: #e6a6a0;
    background: rgba(176, 71, 63, 0.18);
    border-color: rgba(176, 71, 63, 0.45);
}

.presence-pill:hover {
    filter: brightness(1.18);
}

.row-del {
    padding: 0.25em 0.6em;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1;
}

.row-del:hover {
    color: #e6a6a0;
    border-color: rgba(176, 71, 63, 0.45);
    background: rgba(176, 71, 63, 0.14);
}

table tbody tr.choisi td {
    background: var(--accent-soft);
}

table tbody tr.choisi td:first-child {
    box-shadow: inset 3px 0 0 var(--accent);
}

.empty-state {
    margin: 0;
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--text-muted);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.counts .dot {
    margin: 0 0.4em;
    color: var(--border);
}

/* ---------- Panel footer ---------- */

.panel-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.4rem;
}

.counts {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

#nbrPersonneModifier,
#nbrPresentModifier {
    color: var(--text);
    font-weight: 700;
}

.hidden {
    display: none;
}

/* ---------- Footer ---------- */

footer {
    background: var(--bg-soft);
    border-top: 1px solid var(--border);
}

.footer-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 1.4rem clamp(1rem, 4vw, 2rem);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-nav {
    display: flex;
    gap: 1.2rem;
}

.footer-nav a {
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.footer-nav a:hover {
    color: var(--accent);
}

@media (max-width: 640px) {
    .add-form {
        flex-direction: column;
        align-items: stretch;
    }

    .add-form input,
    .add-form select,
    .add-form button {
        width: 100%;
    }

    .toolbar button {
        flex: 1 1 45%;
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
    }
}
