body {
    font-family: sans-serif;
    background-color: #f0f2f5;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
}

.container {
    background-color: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 500px;
    text-align: center;
    position: relative;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.header h1 {
    margin: 0;
    color: #005a9e;
}

#settings-button {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s, color 0.3s;
}

#settings-button:hover,
#settings-button:focus-visible {
    background-color: #f0f0f0;
    color: #333;
}

#settings-button svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s;
}

#settings-button:hover svg,
#settings-button:focus-visible svg {
    transform: rotate(90deg);
}

#settings-panel {
    position: fixed;
    top: 0;
    right: -600px;
    width: 300px;
    height: 100%;
    background-color: #fff;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    z-index: 1000;
    transition: right 0.3s ease;
}

#settings-panel.open {
    right: 0;
}

#settings-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

#settings-panel-header h2 {
    margin: 0;
    color: #005a9e;
    font-size: 1.2rem;
}

#close-settings {
    background: none;
    border: none;
    color: #666;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s, color 0.3s;
}

#close-settings:hover,
#close-settings:focus-visible {
    background-color: #f0f0f0;
    color: #333;
}

.settings-group {
    margin-bottom: 1.5rem;
}

.settings-group h3 {
    margin: 0 0 0.75rem 0;
    color: #333;
    font-size: 1rem;
    font-weight: 600;
}

.switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #005a9e;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

input:checked + .slider:after {
    border-color: #005a9e;
}

.form-group-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

input[type="text"],
input[type="time"],
input[type="number"],
input[type="date"],
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

input[type="text"]#balance-hhmm {
    font-family: monospace;
    letter-spacing: 1px;
}

button {
    background-color: #005a9e;
    color: #fff;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #004175;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid #005a9e;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px #b3d4fc;
}

.result-container {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 4px;
    text-align: left;
}

.result-container p[role="alert"] {
    color: #b00;
    font-weight: bold;
}

/* Amélioration de l'affichage de l'historique */
#history-container {
    margin-top: 2rem;
    background: #f7fafc;
    border: 1px solid #e0e6ed;
    border-radius: 6px;
    padding: 1.2rem 1rem 1rem 1rem;
    box-shadow: 0 2px 8px rgba(0,90,158,0.04);
    text-align: center;
    display: none;
}

#history-container.has-history {
    display: block;
}

#history-container h2 {
    color: #005a9e;
    font-size: 1.2rem;
    margin: 0 0 1rem 0;
    letter-spacing: 0.5px;
}

#history-container > div:last-child {
    display: flex;
    justify-content: center;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

#history-order {
    padding: 0.3rem 0.6rem;
    font-size: 0.9rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    color: #333;
    cursor: pointer;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#history-order:hover,
#history-order:focus-visible {
    border-color: #005a9e;
    outline: none;
    box-shadow: 0 0 0 2px #b3d4fc;
}

#history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#history-list li {
    background: #fff;
    border: 1px solid #e0e6ed;
    border-radius: 4px;
    margin-bottom: 0.7rem;
    padding: 0.7rem 1rem;
    font-size: 0.98rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: box-shadow 0.2s;
    box-shadow: 0 1px 2px rgba(0,90,158,0.03);
    word-break: break-word;
    width: 95%;
    max-width: 420px;
}

#history-list li:last-child {
    margin-bottom: 0;
}

#history-list button {
    background: none;
    border: none;
    color: #b00;
    font-size: 1.2em;
    cursor: pointer;
    margin-left: 1em;
    padding: 0.2em 0.5em;
    border-radius: 3px;
    transition: background 0.2s;
}

#history-list button:hover,
#history-list button:focus-visible {
    background: #ffeaea;
}

#clear-history,
#export-history {
    margin-bottom: 1rem;
    margin-right: 0.5rem;
    font-size: 0.95rem;
    padding: 0.5rem 1.1rem;
}
