/* Base : couleurs, typographie, cartes, boutons, tableaux, formulaires, badges, avatars, mobile */

:root {
  --chart-bg: #0b2350; --chart-bg2: #102c63; --chart-text: #eef4ff; --chart-ship: #ffffff; --chart-glow: #78beff;
  --bg: #0b1017;
  --panel: #121a24;
  --panel-2: #172231;
  --line: #243245;
  --text: #dbe5f0;
  --muted: #8195ab;
  --accent: #38bdf8;
  --accent-2: #f59e42;
  --ok: #4cc38a;
  --warn: #e0b24a;
  --bad: #e5534f;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Cartes et grilles */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.stat { font-size: 1.8rem; font-weight: 700; }

/* Boutons */
.btn, button {
  display: inline-block; cursor: pointer; font: inherit;
  padding: .45rem .9rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text);
}
.btn:hover, button:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: #04121c; font-weight: 600; }
.btn.danger, button.danger { border-color: var(--bad); color: var(--bad); background: transparent; }
.btn.ok, button.ok { border-color: var(--ok); color: var(--ok); background: transparent; }
.btn.sm, button.sm { padding: .2rem .55rem; font-size: .82rem; }
form.inline { display: inline; margin: 0; }

/* Tableaux */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.table-wrap { overflow-x: auto; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { white-space: nowrap; text-align: right; }

/* Badges */
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; border: 1px solid var(--line); background: var(--panel-2); }
 .st-approved, .st-done { border-color: var(--ok); color: var(--ok); }
 .st-ongoing { border-color: var(--accent); color: var(--accent); }
 .st-pending, .st-planned { border-color: var(--warn); color: var(--warn); }
 .st-cancelled, .st-rejected { border-color: var(--bad); color: var(--bad); }
.st-requested { border-color: var(--bad); background: var(--bad); color: #fff; font-weight: 600; }
.card.alert, .training.alert { border-color: var(--bad); box-shadow: inset 3px 0 0 var(--bad); }
tr.requested td { background: rgba(229, 83, 79, .09); }
:root { --bad-soft: rgba(229, 83, 79, .09); }
tr.requested td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.alert-text { color: var(--bad); font-weight: 600; }
.grade { border-color: currentColor; background: transparent; font-weight: 600; }

/* Onglets / filtres */
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.tabs a { padding: .3rem .8rem; border: 1px solid var(--line); border-radius: 999px; color: var(--text); }
.tabs a.active { background: var(--accent); border-color: var(--accent); color: #04121c; font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }

/* Formulaires */
input, select, textarea {
  font: inherit; color: var(--text); background: #0d141d; border: 1px solid var(--line);
  border-radius: 8px; padding: .45rem .6rem; max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; }
textarea { width: 100%; }
.formcard { max-width: 640px; }
.field { margin-bottom: .9rem; }
.field label { display: block; font-weight: 600; margin-bottom: .2rem; }
.field input[type=text], .field input[type=number], .field input[type=password],
.field input[type=datetime-local], .field select, .field textarea { width: 100%; }
.field input[type=checkbox] { width: auto; margin-right: .4rem; }
.help { color: var(--muted); font-size: .82rem; }
.errorlist { margin: .2rem 0; padding: 0; list-style: none; color: var(--bad); font-size: .85rem; }

/* Messages flash */
.messages { list-style: none; margin: 0 0 1rem; padding: 0; }
/* Messages : une ligne courte, une icône, une couleur ; les confirmations disparaissent seules */
.messages li { display: flex; align-items: center; gap: .6rem; padding: .45rem .5rem .45rem .7rem; border-radius: 8px; margin-bottom: .4rem;
  border: 1px solid var(--line); border-left: 4px solid var(--line); background: var(--panel); font-size: .93rem; transition: opacity .4s, transform .4s; }
.messages li.gone { opacity: 0; transform: translateY(-4px); }
.msg-icon { flex: 0 0 auto; display: grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; font-size: .8rem; font-weight: 800; }
.msg-text { flex: 1 1 auto; }
.msg-close { flex: 0 0 auto; background: none; border: 0; color: var(--muted); font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 0 .3rem; }
.messages .success { border-left-color: var(--ok); } .messages .success .msg-icon { background: var(--ok); color: #08131c; } .messages .success .msg-icon::before { content: "✓"; }
.messages .info { border-left-color: var(--accent); } .messages .info .msg-icon { background: var(--accent); color: #08131c; } .messages .info .msg-icon::before { content: "i"; }
.messages .warning { border-left-color: var(--warn); } .messages .warning .msg-icon { background: var(--warn); color: #08131c; } .messages .warning .msg-icon::before { content: "!"; }
.messages .error { border-left-color: var(--bad); } .messages .error .msg-icon { background: var(--bad); color: #fff; } .messages .error .msg-icon::before { content: "✕"; }

/* Barre de progression */
.bar { height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }

/* Badges */
.medal { --c: var(--accent); display: inline-flex; align-items: center; justify-content: center; width: 2.4rem; height: 2.7rem;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: var(--c); vertical-align: middle; flex-shrink: 0; }
.medal > span { display: flex; align-items: center; justify-content: center; width: calc(100% - 6px); height: calc(100% - 6px);
  clip-path: inherit; background: #0d141d; color: var(--c); font: 700 .68rem/1 system-ui, sans-serif; letter-spacing: .02em; }
.medal.dim { filter: grayscale(1); opacity: .45; }
.medal .medal-icon { display: block; width: 62%; height: 62%; color: var(--c); fill: currentColor; }
.medal img { width: 70%; height: 70%; object-fit: contain; }
.medal.lg { width: 3.4rem; height: 3.85rem; }
.medal.sm { width: 1.7rem; height: 1.9rem; }
.medal.sm > span { width: calc(100% - 4px); height: calc(100% - 4px); font-size: .55rem; }
.member-medals { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
.member-medals .more { color: var(--muted); font-size: .8rem; margin-left: .2rem; }
.credits { color: var(--muted); font-size: .78rem; margin-top: 1rem; }
.medals { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.badge-grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.badge-card { display: flex; gap: .8rem; align-items: flex-start; margin: 0; }
.badge-card p { margin: .15rem 0 0; }
.badge-card.not-owned strong { color: var(--muted); }
.badge-line { display: flex; gap: .7rem; align-items: center; padding: .35rem 0; }
.badge-line > div { flex: 1; min-width: 0; }



/* Notifications et réponses aux missions */
.bell { position: relative; display: inline-flex; align-items: center; padding: .25rem; color: var(--muted, #8fa0b2); }
.bell.on { color: #ffb547; }
.bell-count { position: absolute; top: -4px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: #e05a5a; color: #fff; font-size: .7rem; font-weight: 700; display: grid; place-items: center; }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif a { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem .4rem; border-bottom: 1px solid rgba(255, 255, 255, .06); color: inherit; text-decoration: none; }
.notif a:hover { background: rgba(84, 182, 255, .06); }
.notif.unread .notif-text { font-weight: 600; }
.notif.unread a { border-left: 3px solid var(--accent, #54b6ff); padding-left: .6rem; }
.notif.k-cancel.unread a { border-left-color: #e05a5a; }
.notif.k-suggestion.unread a { border-left-color: #ffb547; }
.rsvp-banner { background: rgba(255, 181, 71, .08); border: 1px solid rgba(255, 181, 71, .55); border-left: 4px solid #ffb547; border-radius: 8px; padding: .45rem .8rem; margin: 0 0 .8rem; font-size: .93rem; }
.rsvp-banner.one { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
details.rsvp-banner > summary { cursor: pointer; list-style: none; }
details.rsvp-banner > summary::-webkit-details-marker { display: none; }
details.rsvp-banner[open] > summary .muted { display: none; }
.rsvp-banner ul { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .35rem; }
.rsvp-banner li { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }

.mission-card.is-in { border-left: 4px solid #5ad18a; }
.mission-card.is-out { border-left: 4px solid rgba(143, 160, 178, .5); opacity: .8; }
.mission-card.is-pending { border-left: 4px solid #ffb547; }
.rsvp-actions { margin-top: .5rem; display: flex; gap: .4rem; flex-wrap: wrap; }

 

/* Avatars et profils */
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; border-radius: 50%;
  object-fit: cover; width: 2.5rem; height: 2.5rem; background: #0e1a28; }
.avatar-initials { background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--av) 55%, #1b2b3e), #0e1a28 75%);
  color: #fff; font-weight: 700; letter-spacing: .02em; border: 2px solid color-mix(in srgb, var(--av) 70%, transparent); }
.avatar-xs { width: 1.7rem; height: 1.7rem; font-size: .65rem; border-width: 1px; }
.avatar-xl { width: 7.5rem; height: 7.5rem; font-size: 2.4rem; border-radius: 18px; }
img.avatar-xl { border: 2px solid var(--line); }
.me-link { display: inline-flex; align-items: center; gap: .4rem; }
.profile-hero { display: flex; gap: 1.2rem; align-items: flex-start; flex-wrap: wrap; }
.profile-id { flex: 1 1 18rem; min-width: 0; }
.profile-id h1 { margin: 0 0 .25rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.profile-id p { margin: .2rem 0; }
.profile-bio { margin-top: .6rem !important; white-space: normal; line-height: 1.5; }
.profile-hero .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.officer-notes { border-color: #b66ee8; background: linear-gradient(0deg, rgba(182,110,232,.06), rgba(182,110,232,.06)), var(--panel); }
.officer-notes textarea { width: 100%; margin: .6rem 0 .5rem; }
.photo-preview { margin-bottom: .5rem; }
.photo-preview img, .photo-preview .avatar { width: 7.5rem; height: 7.5rem; border-radius: 18px; object-fit: cover; }

/* Listes clé / valeur, couleurs d'état, page de connexion */
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
.ok-text { color: var(--ok); } .bad-text { color: var(--bad); }
.daytitle { margin: 1.2rem 0 .5rem; text-transform: capitalize; }
.login { max-width: 380px; margin: 4rem auto; }
