:root {
    color-scheme: light;
    font-family: Arial, sans-serif;
    --ink: #18352b;
    --muted: #63766a;
    --line: #cfe0d3;
    --soft: #eef7ef;
    --accent: #237a52;
    --accent-dark: #155437;
    --accent-light: #d9eedc;
    --danger: #a33737;
    --reunion-bg: #fff7e6;
    --materiel-bg: #e6f2ff;
}

* { box-sizing: border-box; }

body {
    min-height: 100vh;
    margin: 0;
    background: #f4f8f3;
    color: var(--ink);
}

.site-header {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    width: 100%;
    min-height: 100px;
    padding: 0 max(24px, calc((100% - 1180px) / 2));
    background: var(--accent-dark);
    color: white;
}

.brand-block { display: flex; align-items: center; gap: 14px; padding: 20px 24px 20px 0; }
.overline { margin: 0 0 6px; color: #70927d; font-size: .76rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.site-header .overline { color: #b8e0bf; }
h1, h2, h3, p { margin-top: 0; }
.site-header h1 { margin: 0; font-size: 1.55rem; }

.header-actions { display: flex; flex: 0 0 auto; order: 2; }
.header-action { display: flex; align-self: stretch; align-items: center; justify-content: center; width: auto; min-width: 100px; height: auto; aspect-ratio: 1; color: var(--ink); font-size: 42px; line-height: 1; text-decoration: none; }
.header-action.reunion { background: var(--reunion-bg); }
.header-action.materiel { background: var(--materiel-bg); }
.header-action.assos { background: #f3edf6; }
.header-action.logout { background: var(--danger); color: white; font-size: 34px; }
.header-action:hover { filter: brightness(.95); }

.profile-layout { display: grid; grid-template-columns: minmax(230px, .7fr) minmax(0, 1.3fr); gap: 24px; width: min(1180px, calc(100% - 32px)); margin: 34px auto 60px; }
.welcome-panel, .settings-panel { border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: 0 12px 30px rgba(24, 53, 43, .07); }
.welcome-panel { display: flex; flex-direction: column; justify-content: center; min-height: 430px; padding: 34px; background: var(--accent-dark); color: white; }
.welcome-panel .overline { color: #b8e0bf; }
.profile-photo { position: relative; display: grid; place-items: center; width: clamp(118px, 42%, 180px); aspect-ratio: 1; margin: 0 0 28px; overflow: hidden; border: 3px solid #b8e0bf; border-radius: 50%; background: #286847; }
.profile-photo img { width: 100%; height: 100%; object-fit: cover; }
.profile-photo-placeholder { display: none; color: #d9eedc; font-size: 3.2rem; font-weight: 700; }
.profile-photo.no-image img { display: none; }
.profile-photo.no-image .profile-photo-placeholder { display: block; }
.welcome-panel h2 { max-width: 12ch; margin-bottom: 18px; color: white; font-size: clamp(2rem, 4vw, 3.8rem); line-height: .98; }
.welcome-panel > p:not(.overline) { max-width: 32ch; color: #d9eedc; line-height: 1.7; }
.scope-list { display: grid; gap: 8px; margin-top: 34px; }
.scope-list span { padding: 10px 12px; border: 1px solid rgba(216, 240, 220, .25); border-radius: 5px; color: #e6f5e8; }

.settings-panel { padding: clamp(24px, 4vw, 44px); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 30px; }
.section-heading h2 { margin-bottom: 0; font-size: clamp(1.45rem, 3vw, 2.2rem); }
.lock-mark { color: var(--accent); font-size: 2.2rem; }
.notice { margin-bottom: 22px; padding: 13px 15px; border-radius: 6px; font-weight: 600; }
.notice.success { background: var(--accent-light); color: var(--accent-dark); }
.notice.error { background: #fff0ed; color: #873737; }
.settings-form { display: grid; gap: 10px; max-width: 720px; }
.settings-form > label, .password-grid label { display: grid; gap: 7px; color: var(--muted); font-size: .86rem; font-weight: 700; }
.optional-label { color: var(--muted); font-size: .78rem; font-weight: 400; }
input { width: 100%; padding: 12px 13px; border: 1px solid #b7cbbb; border-radius: 6px; background: #fcfefc; color: var(--ink); font: inherit; }
input:focus { outline: 3px solid rgba(35, 122, 82, .16); border-color: var(--accent); }
.form-divider { height: 1px; margin: 20px 0; background: var(--line); }
.password-heading h3 { margin-bottom: 5px; font-size: 1.15rem; }
.password-heading p { margin-bottom: 12px; color: var(--muted); }
.password-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 14px; }
button { border: 0; border-radius: 6px; padding: 13px 17px; background: var(--accent); color: white; font: inherit; font-weight: 700; cursor: pointer; }
button:hover { background: var(--accent-dark); }

.login-page { display: grid; place-items: center; padding: 20px; background: #eaf5eb; }
.login-card { width: min(420px, 100%); padding: 32px; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: 0 12px 32px rgba(24, 53, 43, .1); }
.login-card h1 { margin: 0 0 8px; color: var(--accent-dark); font-size: 1.55rem; }
.login-card > p { margin: 0 0 24px; color: var(--muted); }
.user-preview { display: grid; justify-items: center; gap: 8px; margin: -4px 0 8px; }
.user-preview-image { display: grid; place-items: center; width: 96px; height: 96px; overflow: hidden; border: 2px solid var(--accent); border-radius: 50%; background: var(--soft); color: var(--accent); font-size: 2.4rem; font-weight: 700; }
.user-preview-image img { display: none; width: 100%; height: 100%; object-fit: cover; }
.user-preview-image.has-image img { display: block; }
.user-preview-image.has-image .placeholder { display: none; }
.login-form { display: grid; gap: 16px; }
.login-form label { display: grid; gap: 6px; color: var(--ink); font-size: 1rem; font-weight: 600; }
.login-form input { margin-bottom: 0; padding: 11px; border: 1px solid #b7cbbb; border-radius: 5px; }
.login-error input { border-color: #c0392b; animation: login-shake .55s ease-in-out; }
@keyframes login-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
.login-form button { margin-top: 0; padding: 12px; border-radius: 5px; }

@media (max-width: 760px) {
    .site-header { display: flex; flex-direction: column; align-items: stretch; padding: 0; }
    .brand-block { justify-content: center; padding: 20px 18px 16px; text-align: center; }
    .header-actions { width: 100%; justify-content: center; gap: 6px; padding: 0 8px 8px; }
    .header-action { flex: 1; width: auto; min-width: 0; height: 56px; min-height: 56px; aspect-ratio: auto; font-size: 32px; }
    .header-action.logout { font-size: 26px; }
    .profile-layout { grid-template-columns: 1fr; width: min(100% - 20px, 620px); margin-top: 16px; }
    .welcome-panel { min-height: auto; padding: 26px; }
    .profile-photo { width: 128px; margin-bottom: 22px; }
    .welcome-panel h2 { max-width: none; font-size: 2.4rem; }
}

@media (max-width: 500px) {
    .login-card { padding: 28px 22px; }
    .password-grid { grid-template-columns: 1fr; gap: 10px; }
    .settings-panel { padding: 24px 18px; }
    .section-heading { margin-bottom: 22px; }
}
