:root {
  --teal: #2d7085;
  --teal-dark: #1f5263;
  --teal-hover: #3490a8;
  --coral: #e45f51;
  --gold: #bd9e56;
  --gold-light: #d4b978;
  --bg: #f4f8fa;
  --surface: #ffffff;
  --text: #1a2e36;
  --muted: #5a737c;
  --line: #d5e3e8;
  --radius: 14px;
  --shadow: 0 18px 40px rgba(45, 112, 133, 0.12);
  --shadow-sm: 0 1px 3px rgba(31, 82, 99, 0.08);
  --footer-bg: #1f2a30;
  --footer-link-hover: #9ad7de;
  --success: #2e7d4f;
  --danger: #c0392b;
  --warning: #e87c09;
  --info: #1486a3;
  --transition: 160ms ease;
  --header-height: 64px;
  --max-width: 1200px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  font-family: "Segoe UI", "Trebuchet MS", Candara, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(253, 216, 143, 0.45), transparent 55%),
    radial-gradient(ellipse 70% 45% at 100% 0%, rgba(188, 210, 217, 0.55), transparent 50%),
    linear-gradient(165deg, #eef5f7 0%, var(--bg) 45%, #e8f1f4 100%);
}

a {
  color: var(--teal);
  text-underline-offset: 2px;
}

a:hover {
  color: var(--teal-dark);
}

img {
  max-width: 100%;
  height: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Layout ── */

.container {
  width: min(var(--max-width), calc(100% - 2rem));
  margin: 0 auto;
}

.page {
  width: min(var(--max-width), calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  animation: rise 0.55s ease-out;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .page {
    animation: none;
  }

  .btn,
  .copy-btn,
  .nav-link,
  .toast {
    transition: none;
  }
}

/* ── Header ── */

.site-header {
  background: linear-gradient(135deg, var(--teal-dark) 0%, var(--teal) 100%);
  border-bottom: 3px solid var(--gold);
  box-shadow: var(--shadow-sm);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
  gap: 1rem;
  width: min(var(--max-width), calc(100% - 2rem));
  margin: 0 auto;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.site-logo:hover {
  opacity: 0.92;
}

.site-logo__img {
  display: block;
  height: 36px;
  width: auto;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.nav-link {
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  transition: background-color var(--transition), color var(--transition);
}

.nav-link:hover,
.nav-link.is-active {
  background-color: rgba(189, 158, 86, 0.22);
  color: var(--gold-light);
}

.nav-user {
  display: none;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85rem;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.is-authenticated .nav-user {
  display: inline-flex;
}

body.is-authenticated .nav-auth-only {
  display: inline-flex;
}

.nav-auth-only {
  display: none;
}

/* ── Brand (pages sans header pleine largeur) ── */

.brand a {
  display: inline-block;
}

.brand img {
  width: 180px;
  height: auto;
  display: block;
}

/* ── Cards / panels ── */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 2rem 1.75rem 1.75rem;
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--teal), var(--coral));
}

.page-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.45rem, 4vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--teal-dark);
}

.page-intro {
  margin: 0 0 1.5rem;
  color: var(--muted);
  line-height: 1.55;
}

.alert {
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.95rem;
}

.alert--error {
  color: var(--danger);
  background: rgba(192, 57, 43, 0.08);
  border: 1px solid rgba(192, 57, 43, 0.25);
}

.alert--info {
  color: var(--teal-dark);
  background: rgba(45, 112, 133, 0.08);
  border: 1px solid rgba(45, 112, 133, 0.2);
}

/* ── Buttons ── */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: inherit;
  border: 2px solid var(--teal);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), transform 120ms ease;
}

.btn:hover:not(:disabled):not(.is-disabled) {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
  color: #fff;
  box-shadow: 0 6px 16px rgba(45, 112, 133, 0.28);
}

.btn:active:not(:disabled):not(.is-disabled) {
  transform: translateY(1px);
}

.btn:disabled,
.btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn--block {
  width: 100%;
}

.btn--danger {
  background: var(--coral);
  border-color: var(--coral);
}

.btn--danger:hover:not(:disabled):not(.is-disabled) {
  background: #c94d41;
  border-color: #c94d41;
}

.btn--ghost {
  background: transparent;
  color: var(--teal-dark);
}

.btn--ghost:hover:not(:disabled):not(.is-disabled) {
  background: rgba(188, 210, 217, 0.45);
  color: var(--teal-dark);
  border-color: var(--teal);
  box-shadow: none;
}

.btn--sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
}

.copy-btn {
  appearance: none;
  border: 1px solid var(--teal);
  background: var(--teal);
  color: #fff;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: background var(--transition), box-shadow var(--transition);
}

.copy-btn:hover {
  background: var(--teal-dark);
  box-shadow: 0 6px 16px rgba(45, 112, 133, 0.28);
}

.copy-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* ── Progress ── */

.progress {
  display: none;
  width: 100%;
  height: 8px;
  margin-top: 1rem;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.progress.is-visible {
  display: block;
}

.progress__bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--teal), var(--coral));
  border-radius: 999px;
  transition: width 80ms linear;
}

/* ── Toasts ── */

#toast-root {
  position: fixed;
  z-index: 10000;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(360px, calc(100% - 2rem));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: toast-in 0.25s ease-out;
}

.toast--success { background: var(--teal); }
.toast--error { background: var(--danger); }
.toast--warning { background: var(--warning); }
.toast--info { background: var(--info); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Footer ── */

.site-footer {
  margin-top: auto;
  padding: 18px 0;
  background-color: var(--footer-bg);
}

.site-footer__inner {
  width: min(var(--max-width), calc(100% - 2rem));
  margin: 0 auto;
  color: rgb(255 255 255 / 75%);
  text-align: center;
  font-size: 0.9rem;
}

.site-footer__copyright {
  margin: 0 0 6px;
}

.site-footer__nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.site-footer a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid rgb(255 255 255 / 35%);
  transition: border-color var(--transition), color var(--transition);
}

.site-footer a:hover {
  color: var(--footer-link-hover);
  border-bottom-color: var(--footer-link-hover);
}

/* ── Legal ── */

.legal p {
  margin: 0 0 0.85rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  .site-header__inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem 0;
  }

  .nav-user {
    max-width: 100%;
  }

  .brand img {
    width: 140px;
  }

  .panel {
    padding: 1.5rem 1.15rem 1.25rem;
  }

  .page {
    padding-top: 1.25rem;
  }
}
