/* Feuille autonome : la page de connexion ne peut pas charger styles.css, protégé par la session. */
:root {
  color-scheme: dark;
  --bg: #0E1016;
  --surface: #161A24;
  --surface-2: #1C2130;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #F4F1EC;
  --text-2: #BDBAB4;
  --text-3: #8D909C;
  --accent: #F2784B;
  --accent-ink: #F59673;
  --ring: rgba(242, 120, 75, 0.45);
  --danger: #FF8A8A;
  --danger-bg: rgba(226, 85, 122, 0.12);
  --danger-border: rgba(226, 85, 122, 0.35);
  --grad: linear-gradient(120deg, #F5B14C 0%, #F2784B 52%, #E2557A 100%);
  --on-grad: #1A0F0A;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 30px 60px -30px rgba(0, 0, 0, 0.8);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease-out: cubic-bezier(0.2, 0.75, 0.2, 1);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #F6F4F0;
    --surface: #FFFFFF;
    --surface-2: #F4F1EC;
    --border: rgba(24, 26, 34, 0.10);
    --border-strong: rgba(24, 26, 34, 0.22);
    --text: #1A1C23;
    --text-2: #4A4C55;
    --text-3: #6B6E78;
    --accent: #E9693A;
    --accent-ink: #B5461C;
    --ring: rgba(233, 105, 58, 0.35);
    --danger: #B4283F;
    --danger-bg: rgba(226, 85, 122, 0.08);
    --danger-border: rgba(180, 40, 63, 0.3);
    --shadow: 0 1px 2px rgba(24, 26, 34, 0.05), 0 24px 50px -28px rgba(60, 40, 20, 0.35);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(520px 380px at 50% 0%, rgba(242, 120, 75, 0.16), transparent 70%),
    radial-gradient(420px 320px at 100% 100%, rgba(226, 85, 122, 0.08), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
img, svg { display: block; }
h1, p { margin: 0; }

.shell {
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.panel {
  width: 100%; max-width: 400px;
  padding: 28px 22px 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 140px), var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  animation: rise 0.7s var(--ease-out) both;
}

.panel__head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; margin-bottom: 22px; }
.mark {
  position: relative; width: 76px; height: 76px; display: grid; place-items: center; margin-bottom: 6px;
  border-radius: 22px; background: var(--surface-2); border: 1px solid var(--border);
  animation: pop 0.8s var(--ease-out) 0.1s both;
}
.mark::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(242, 120, 75, 0.0), 0 10px 30px -10px rgba(242, 120, 75, 0.45);
}
.mark img { width: 52px; height: 52px; }
.title { font-size: 1.4rem; font-weight: 680; letter-spacing: -0.02em; animation: fade 0.6s var(--ease-out) 0.18s both; }
.subtitle { color: var(--text-3); font-size: 0.94rem; animation: fade 0.6s var(--ease-out) 0.24s both; }

.alert {
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 16px; padding: 11px 13px; border-radius: 12px;
  background: var(--danger-bg); border: 1px solid var(--danger-border); color: var(--danger);
  font-size: 0.9rem; line-height: 1.4;
  animation: shake 0.45s var(--ease-out) both;
}
.alert svg { flex: none; margin-top: 1px; }

.form { display: grid; gap: 16px; animation: fade 0.6s var(--ease-out) 0.3s both; }
.field { display: grid; gap: 7px; }
.field label { font-size: 0.88rem; font-weight: 580; color: var(--text-2); }
.field input {
  width: 100%; height: 50px; padding: 0 14px;
  font: inherit; font-size: 1rem; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  outline: none; appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.field input:hover { border-color: var(--border-strong); }
.field input:focus-visible, .field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.field input:-webkit-autofill { -webkit-text-fill-color: var(--text); box-shadow: 0 0 0 1000px var(--surface-2) inset; caret-color: var(--text); }
.field input:-webkit-autofill:focus { box-shadow: 0 0 0 1000px var(--surface-2) inset, 0 0 0 3px var(--ring); }
.form.has-error .field input[aria-invalid="true"] { border-color: var(--danger-border); }

.password { position: relative; }
.password input { padding-right: 52px; }
.reveal {
  position: absolute; right: 3px; top: 3px; width: 44px; height: 44px;
  display: grid; place-items: center; border: 0; border-radius: 10px; cursor: pointer;
  background: transparent; color: var(--text-3);
  transition: color 0.2s, background-color 0.2s;
}
.reveal:hover { color: var(--text); background: var(--border); }
.reveal:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.reveal .reveal__hide { display: none; }
.reveal[aria-pressed="true"] .reveal__show { display: none; }
.reveal[aria-pressed="true"] .reveal__hide { display: block; }
.hint { font-size: 0.8rem; color: var(--accent-ink); }

.submit {
  position: relative; margin-top: 4px; height: 52px; width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 13px; cursor: pointer;
  font: inherit; font-size: 1rem; font-weight: 650; letter-spacing: 0.005em; color: var(--on-grad);
  background: var(--grad); background-size: 140% 100%; background-position: 0% 0;
  box-shadow: 0 10px 24px -12px rgba(242, 120, 75, 0.8);
  transition: background-position 0.5s var(--ease-out), transform 0.15s, box-shadow 0.2s, filter 0.2s;
}
.submit:hover { background-position: 100% 0; box-shadow: 0 14px 30px -12px rgba(242, 120, 75, 0.9); }
.submit:active { transform: scale(0.985); }
.submit:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.submit__spinner {
  display: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(26, 15, 10, 0.3); border-top-color: var(--on-grad);
  animation: spin 0.8s linear infinite;
}
.submit[aria-busy="true"] { cursor: progress; filter: saturate(0.85); }
.submit[aria-busy="true"] .submit__spinner { display: block; }

.foot { font-size: 0.8rem; color: var(--text-3); text-align: center; animation: fade 0.6s var(--ease-out) 0.4s both; }

@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(0.8) rotate(-12deg); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 560px) {
  .panel { padding: 34px 32px 30px; }
}
@media (max-height: 560px) {
  .shell { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0s !important; transition-duration: 0.001ms !important; }
  .submit__spinner { animation: none; }
}
