/* Repris de _old/public/styles/scss/pages/_home.scss */

@font-face {
  font-family: 'Poppins';
  src: url('../fonts/Poppins-Regular.woff2') format('woff2'),
  url('../fonts/Poppins-Regular.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Helvetica';
  src: url('../fonts/Helvetica-Bold.woff2') format('woff2'),
  url('../fonts/Helvetica-Bold.woff') format('woff');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

/*######################################################*/
/*################### THÈME CLAIR / SOMBRE #############*/
/*######################################################*/

/* Le thème est posé sur <html data-theme="..."> par le script en tête de
   base.html.twig (choix enregistré, sinon préférence du système). */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --fg: #000000;
  --muted: #6b6b6b;
  --ghost: #999999;
  --border: #e0e0e0;
  --surface: #f2f2f2;
  --danger: #c62828;
  --intro-pattern: url('../images/bg-try.png');
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --fg: #ffffff;
  --muted: #999999;
  --ghost: #999999;
  --border: #333333;
  --surface: #222222;
  --danger: #ff6b6b;
  /* Même motif que bg-try.png (point de 5px dans une tuile 27x23), en sombre */
  --intro-pattern: radial-gradient(circle at 13.5px 11.5px, #1c1c1c 2.5px, transparent 3px);
}

/* Sans JavaScript : on suit simplement la préférence du système */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #000000;
    --fg: #ffffff;
    --muted: #999999;
    --ghost: #999999;
    --border: #333333;
    --surface: #222222;
    --danger: #ff6b6b;
    --intro-pattern: radial-gradient(circle at 13.5px 11.5px, #1c1c1c 2.5px, transparent 3px);
  }
}

*, *:before, *:after {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  word-break: break-word;
}

body {
  overflow-x: hidden;
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--fg);
}

/* Changement de thème : cercle qui s'ouvre depuis le bouton (View Transitions API) */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

/* Rideau de transition entre les pages */
.page-transition {
  position: fixed;
  inset: 0;
  z-index: 30000;
  background: var(--fg);
  transform: scaleY(0);
  transform-origin: bottom;
  pointer-events: none;
}

.page-transition.is-covering {
  transform: scaleY(1);
}

/* Lien fixe en bas à droite */
.corner-link {
  position: fixed;
  right: 40px;
  bottom: 30px;
  z-index: 100;
  font-family: 'Helvetica', sans-serif;
  font-size: 22px;
  font-weight: bold;
  letter-spacing: -1px;
  color: var(--fg);
  text-decoration: none;
  padding-bottom: 4px;
}

.corner-link:after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .3s ease-in-out;
}

.corner-link:hover:after,
.corner-link:focus-visible:after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Langue + thème, en haut à droite */
.top-controls {
  position: fixed;
  top: 30px;
  right: 40px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Bouton clair / sombre : soleil qui se transforme en lune */
.theme-toggle {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--fg);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color .3s ease-in-out;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: var(--surface);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 24px;
  height: 24px;
}

.theme-toggle-core,
.theme-toggle-moon,
.theme-toggle-rays {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform .5s cubic-bezier(.76, 0, .24, 1), opacity .3s ease-in-out;
}

/* Mode sombre : le soleil grossit, perd ses rayons et une "ombre" le creuse en croissant */
:root[data-theme="dark"] .theme-toggle-core {
  transform: scale(1.7);
}

:root[data-theme="dark"] .theme-toggle-moon {
  transform: translate(-13px, 8px);
}

:root[data-theme="dark"] .theme-toggle-rays {
  transform: rotate(90deg) scale(0);
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle-core,
  .theme-toggle-moon,
  .theme-toggle-rays {
    transition: none;
  }
}

/* Sélecteur de langue : pilule (icône + code) qui ouvre un menu */
.lang-switcher {
  position: relative;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  font-family: 'Helvetica', sans-serif;
  font-weight: bold;
  font-size: 14px;
  letter-spacing: .5px;
  color: var(--fg);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .3s ease-in-out;
}

.lang-toggle svg {
  width: 20px;
  height: 20px;
}

.lang-toggle:hover,
.lang-toggle:focus-visible,
.lang-switcher.is-open .lang-toggle {
  background: var(--surface);
}

.lang-toggle:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  padding: 6px;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(.97);
  transform-origin: top right;
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
}

.lang-switcher.is-open .lang-menu {
  opacity: 1;
  visibility: visible;
  transform: none;
  /* visibility immédiate à l'ouverture : sinon le menu est encore "hidden" et focus() échoue */
  transition: opacity .2s ease, transform .2s ease, visibility 0s;
}

.lang-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--fg);
  text-decoration: none;
  outline: none;
}

.lang-menu a:hover,
.lang-menu a:focus-visible {
  background: var(--surface);
}

.lang-code {
  width: 22px;
  font-family: 'Helvetica', sans-serif;
  font-weight: bold;
  color: var(--muted);
}

/* Langue courante : code en couleur pleine + point à droite */
.lang-menu a[aria-current] .lang-code {
  color: var(--fg);
}

.lang-menu a[aria-current]:after {
  content: '';
  width: 6px;
  height: 6px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--fg);
}

@media (prefers-reduced-motion: reduce) {
  .lang-menu {
    transition: none;
  }
}

/* Repris de _old/public/styles/scss/fold/_loader.scss */
.loader {
  background: #000000;
  width: 100%;
  min-height: 100vh;
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20000;
  align-items: center;
  justify-content: center;
}

.loader .loader-logo {
  width: 68px;
  height: 60px;
  background: url('../images/logo2.png') no-repeat;
  background-size: contain;
  opacity: 0;
}

.intro {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
  z-index: 0;
  text-align: left;
  background: var(--intro-pattern) repeat fixed;
  background-size: 27px 23px;
}

.intro h1 {
  position: relative;
  display: block;
}

.intro .first {
  display: block;
  position: relative;
  font-size: 150px;
  font-weight: bold;
  line-height: 120px;
  letter-spacing: -7px;
  font-family: 'Helvetica', sans-serif;
  -webkit-text-stroke: 2px var(--fg);
  -webkit-text-fill-color: var(--fg);
  text-shadow: 2px 2px 7px rgba(0, 0, 0, 0.5);
}

.intro .second {
  display: block;
  position: relative;
  font-size: 240px;
  font-weight: bold;
  line-height: 170px;
  letter-spacing: -10px;
  font-family: 'Helvetica', sans-serif;
  -webkit-text-stroke: 2px var(--fg);
  -webkit-text-fill-color: var(--fg);
  text-shadow: 2px 2px 7px rgba(0, 0, 0, 0.5);
}

/*######################################################*/
/*################### MOBILE SETS #####################*/
/*######################################################*/

@media (max-width: 1200px) {
  .intro .first {
    font-size: 120px;
    line-height: 100px;
    letter-spacing: -2px;
  }

  .intro .second {
    font-size: 140px;
    line-height: 110px;
    letter-spacing: -2px;
  }
}

@media (max-width: 1024px) {
  .intro .first {
    font-size: 70px;
    line-height: 60px;
    letter-spacing: 0;
  }
}

@media (max-width: 768px) {
  .intro .first {
    font-size: 65px;
    line-height: 45px;
    letter-spacing: 0;
    text-shadow: none;
  }

  .intro .second {
    font-size: 100px;
    line-height: 85px;
    letter-spacing: 0;
    text-shadow: none;
  }
}

@media (max-width: 580px) {
  .intro .first {
    font-size: 50px;
    line-height: 30px;
    letter-spacing: 0;
  }

  .intro .second {
    font-size: 70px;
    line-height: 65px;
    letter-spacing: 0;
  }
}

@media (max-width: 420px) {
  .intro .first {
    font-size: 40px;
    line-height: 35px;
    letter-spacing: 0;
  }

  .intro .second {
    font-size: 65px;
    line-height: 50px;
    letter-spacing: 0;
  }
}

/*######################################################*/
/*##################### À PROPOS #######################*/
/*######################################################*/

/* Repris de _old/public/styles/scss/pages/_about.scss */
.about {
  display: flex;
  align-items: center;
  min-height: 100vh;
  background: var(--bg);
  padding: 10rem 0;
  overflow: hidden;
}

.about-container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 16px;
}

.about .title {
  text-align: right;
}

.about h1 {
  display: inline-block;
  font-size: 110px;
  font-weight: bold;
  line-height: 60px;
  letter-spacing: -5px;
  font-family: 'Helvetica', sans-serif;
  -webkit-text-stroke: 2px var(--fg);
  -webkit-text-fill-color: var(--fg);
  position: relative;
  z-index: 1;
}

.about h1:before {
  /* Texte fantôme traduit : data-ghost sur le h1 */
  content: attr(data-ghost);
  white-space: nowrap;
  -webkit-text-stroke: 2px var(--ghost);
  -webkit-text-fill-color: var(--ghost);
  opacity: 30%;
  right: 60px;
  top: -60px;
  position: absolute;
  z-index: -1;
}

.about h1:after {
  content: '';
  position: absolute;
  width: 100px;
  height: 10px;
  background: var(--fg);
  bottom: -18px;
  left: 0;
}

.about-body {
  margin-top: 1.5rem;
  margin-left: auto;
  width: 66.666%;
}

.about .text {
  margin-top: 3rem;
  color: var(--fg);
  line-height: 30px;
  letter-spacing: 1px;
  text-align: right;
}

/* Texte long : il s'efface en fondu sous les contrôles fixes (haut) et le lien du coin (bas) */
.page-about:before,
.page-about:after {
  content: '';
  position: fixed;
  left: 0;
  right: 0;
  z-index: 50;
  height: 110px;
  pointer-events: none;
}

.page-about:before {
  top: 0;
  background: linear-gradient(to top, transparent, var(--bg) 55%);
}

.page-about:after {
  bottom: 0;
  background: linear-gradient(to bottom, transparent, var(--bg) 55%);
}

.about .text p + p {
  margin-top: 1.25rem;
}

.about .network-profile {
  margin: 1.5rem 0;
  text-align: right;
}

.about .network-profile div {
  display: inline-block;
  margin-left: 8px;
}

.about .network-profile a {
  display: inline-block;
  width: 2em;
  height: 2em;
  font-size: 16px;
  color: var(--fg);
  transition: all .5s ease-in-out;
}

.about .network-profile svg {
  width: 100%;
  height: 100%;
  transition: transform .5s ease-in-out;
}

.about .network-profile a:hover {
  color: var(--muted);
}

.about .network-profile a:hover svg {
  transform: scale(1.1);
}

@media (max-width: 990px) {
  .about {
    padding: 8rem 0;
  }

  .about h1 {
    display: inline-block;
    font-size: 50px;
    line-height: 35px;
    letter-spacing: -2px;
  }

  .about h1:before {
    opacity: 40%;
    right: 50px;
    top: -30px;
  }

  .about h1:after {
    height: 8px;
    bottom: -5px;
  }

  .about-body {
    width: 100%;
  }
}

@media (max-width: 580px) {
  .corner-link {
    right: 20px;
    bottom: 20px;
    font-size: 18px;
  }

  .top-controls {
    top: 16px;
    right: 12px;
  }
}

/*######################################################*/
/*################### ESPACE PRIVÉ #####################*/
/*######################################################*/

/* Connexion */
.login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

.login-form {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 380px;
}

.login-form h1,
.dashboard h1 {
  font-family: 'Helvetica', sans-serif;
  font-weight: bold;
  font-size: 60px;
  line-height: 1;
  letter-spacing: -3px;
  margin-bottom: 2rem;
}

.login-form label {
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 1rem;
}

.login-form input {
  font: inherit;
  color: var(--fg);
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--fg);
  border-radius: 0;
  padding: 8px 0;
  outline: none;
}

.login-form input:focus {
  border-bottom-color: var(--muted);
}

.login-form button {
  margin-top: 2rem;
  padding: 14px;
  font-family: 'Helvetica', sans-serif;
  font-weight: bold;
  font-size: 18px;
  color: var(--bg);
  background: var(--fg);
  border: 2px solid var(--fg);
  cursor: pointer;
  transition: all .3s ease-in-out;
}

.login-form button:hover,
.login-form button:focus-visible {
  color: var(--fg);
  background: transparent;
}

.form-error {
  padding: 12px;
  margin-bottom: 1rem;
  border-left: 4px solid var(--fg);
  background: var(--surface);
  font-size: 14px;
}

/* Dashboard : sidebar fixe à gauche + contenu */
.dashboard-layout {
  min-height: 100vh;
}

.dashboard-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  width: 260px;
  padding: 28px 16px 20px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.dashboard-sidebar-head {
  position: relative;
  padding: 0 12px 28px;
}

.dashboard-brand {
  font-family: 'Helvetica', sans-serif;
  font-weight: bold;
  font-size: 22px;
  letter-spacing: -1px;
  color: var(--fg);
  text-decoration: none;
}

.dashboard-brand-sub {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}

.dashboard-sidebar .dashboard-sidebar-close {
  display: none;
}

.dashboard-nav {
  flex: 1;
  min-height: 0;
  /* Seul le menu défile : le pied (thème clair/sombre, déconnexion) reste toujours visible */
  margin: 0 -16px;
  padding: 0 16px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.dashboard-nav-title {
  margin: 20px 12px 8px;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
}

.dashboard-nav ul {
  list-style: none;
}

.dashboard-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 2px;
  font-size: 14px;
  color: var(--fg);
  text-decoration: none;
  border-radius: 10px;
  transition: background-color .2s ease;
}

.dashboard-nav-link:hover,
.dashboard-nav-link:focus-visible {
  background: var(--surface);
}

.dashboard-nav-link[aria-current="page"] {
  color: var(--bg);
  background: var(--fg);
}

.icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.dashboard-sidebar-foot {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 12px 0;
  border-top: 1px solid var(--border);
}

.dashboard-user {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: 13px;
}

.dashboard-user span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.dashboard-sidebar-actions {
  display: flex;
  align-items: center;
}

.dashboard-icon-button {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  color: var(--fg);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color .2s ease;
}

.dashboard-icon-button:hover,
.dashboard-icon-button:focus-visible {
  background: var(--surface);
}

.dashboard-icon-button .icon {
  width: 20px;
  height: 20px;
}

.dashboard-topbar,
.dashboard-overlay {
  display: none;
}

.dashboard {
  max-width: 1100px;
  margin-left: 260px;
  padding: 4rem 48px;
}

.dashboard-subtitle {
  margin: -1rem 0 2rem;
  color: var(--muted);
}

.dashboard-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 14px;
}

.dashboard-flash {
  margin-bottom: 1.5rem;
  padding: 12px 16px;
  font-size: 14px;
  background: var(--surface);
  border-left: 4px solid var(--fg);
}

.dashboard-flash.is-error {
  border-left-color: var(--danger);
}

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.dashboard-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 24px;
  color: var(--fg);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.dashboard-card.is-link {
  transition: border-color .2s ease, transform .2s ease;
}

.dashboard-card.is-link:hover,
.dashboard-card.is-link:focus-visible {
  border-color: var(--fg);
  transform: translateY(-2px);
}

.dashboard-card-label {
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}

.dashboard-card-value {
  font-family: 'Helvetica', sans-serif;
  font-size: 40px;
  line-height: 1;
}

.dashboard-badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: 12px;
  white-space: nowrap;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.dashboard-badge.is-warning {
  color: var(--danger);
  border-color: var(--danger);
}

.dashboard-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font: inherit;
  font-size: 14px;
  color: var(--fg);
  text-decoration: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease;
}

.dashboard-button:hover,
.dashboard-button:focus-visible {
  border-color: var(--fg);
}

.dashboard-button.is-danger:hover,
.dashboard-button.is-danger:focus-visible {
  color: var(--danger);
  border-color: var(--danger);
}

/* Liste des messages */
.messages-list {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.message-item + .message-item {
  border-top: 1px solid var(--border);
}

.message-summary {
  display: grid;
  grid-template-columns: minmax(160px, 220px) 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 18px 20px;
  list-style: none;
  cursor: pointer;
  transition: background-color .2s ease;
}

.message-summary::-webkit-details-marker {
  display: none;
}

.message-summary:hover,
.message-item[open] .message-summary {
  background: var(--surface);
}

.message-from {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: 14px;
}

.message-from span,
.message-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.message-preview {
  font-size: 14px;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.message-body {
  padding: 8px 20px 24px;
  background: var(--surface);
}

.message-text {
  max-width: 720px;
  margin-bottom: 20px;
  line-height: 1.7;
}

.message-details {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  margin-bottom: 20px;
  font-size: 13px;
}

.message-details dt {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}

.message-details a {
  color: var(--fg);
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dashboard-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
  font-size: 14px;
  color: var(--muted);
}

/* Dashboard (accueil) : liens rapides */
.dashboard-section-title {
  margin: 3rem 0 1rem;
  font-size: 13px;
  font-weight: normal;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}

.dashboard-shortcuts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.dashboard-shortcut {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  color: var(--fg);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: border-color .2s ease, transform .2s ease;
}

.dashboard-shortcut:hover,
.dashboard-shortcut:focus-visible {
  border-color: var(--fg);
  transform: translateY(-2px);
}

.dashboard-shortcut .icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 9px;
  border-radius: 10px;
  background: var(--surface);
}

.dashboard-shortcut > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dashboard-shortcut small {
  font-size: 13px;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-shortcut {
    transition: none;
  }
}

/* Dashboard › Finances (dépenses / revenus, reprise de my-finance) */
.dashboard {
  --finance-expense: #c62828;
  --finance-income: #059669;
}

:root[data-theme="dark"] .dashboard {
  --finance-expense: #ff6b6b;
  --finance-income: #34d399;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .dashboard {
    --finance-expense: #ff6b6b;
    --finance-income: #34d399;
  }
}

.dashboard .is-expense {
  color: var(--finance-expense);
}

.dashboard .is-income {
  color: var(--finance-income);
}

.dashboard [hidden] {
  display: none !important;
}

.finance-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 2rem;
}

.finance-head h1 {
  margin-bottom: 1rem;
}

.finance-head .dashboard-subtitle {
  margin: 0;
}

.finance-actions,
.finance-form-actions,
.finance-filters-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dashboard-button .icon {
  width: 16px;
  height: 16px;
}

.dashboard-button.is-primary {
  color: var(--bg);
  background: var(--fg);
  border-color: var(--fg);
}

.dashboard-button.is-primary:hover,
.dashboard-button.is-primary:focus-visible {
  color: var(--fg);
  background: transparent;
}

.dashboard-button.is-expense:hover,
.dashboard-button.is-expense:focus-visible {
  border-color: var(--finance-expense);
}

.dashboard-button.is-income:hover,
.dashboard-button.is-income:focus-visible {
  border-color: var(--finance-income);
}

.dashboard-icon-button.is-danger:hover,
.dashboard-icon-button.is-danger:focus-visible {
  color: var(--danger);
}

.dashboard-icon-button:disabled {
  opacity: .3;
  cursor: not-allowed;
}

.finance-value {
  font-size: 32px;
  letter-spacing: -1px;
}

/* Champs de formulaire du dashboard (filtres, formulaires finances) */
.dashboard-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.dashboard-field > span,
.dashboard-field > label {
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}

.dashboard-field input,
.dashboard-field select,
.dashboard-field textarea {
  width: 100%;
  font: inherit;
  color: var(--fg);
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--border);
  border-radius: 0;
  padding: 8px 0;
  outline: none;
  transition: border-color .2s ease;
}

.dashboard-field textarea {
  resize: vertical;
}

.dashboard-field select option,
.dashboard-field select optgroup {
  color: var(--fg);
  background: var(--bg);
}

.dashboard-field input:focus,
.dashboard-field select:focus,
.dashboard-field textarea:focus {
  border-bottom-color: var(--fg);
}

.dashboard-field.has-error input,
.dashboard-field.has-error select,
.dashboard-field.has-error textarea {
  border-bottom-color: var(--danger);
}

.dashboard-field ul,
.finance-form > ul {
  list-style: none;
  font-size: 13px;
  color: var(--danger);
}

.finance-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  align-items: end;
  gap: 16px 20px;
  margin: 32px 0 24px;
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.finance-active-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 14px;
}

.finance-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.finance-check input,
.finance-item-check {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--fg);
  cursor: pointer;
}

.finance-list-head .finance-check {
  padding-left: 22px;
}

.finance-item:has(.finance-item-check:checked) {
  background: var(--surface);
}

.finance-bulk-bar {
  position: sticky;
  top: 12px;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 12px 10px 20px;
  background: var(--bg);
  border: 1px solid var(--fg);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
}

.dashboard-button.is-danger {
  color: var(--danger);
}

.finance-list-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--muted);
}

.finance-list {
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 14px;
}

/* Pas d'overflow: hidden sur la liste (il couperait le menu ⋮) : on arrondit les lignes extrêmes */
.finance-item:first-child {
  border-top-left-radius: 13px;
  border-top-right-radius: 13px;
}

.finance-item:last-child {
  border-bottom-left-radius: 13px;
  border-bottom-right-radius: 13px;
}

.finance-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 14px 16px 14px 20px;
  border-left: 3px solid transparent;
}

.finance-item + .finance-item {
  border-top: 1px solid var(--border);
}

.finance-item.is-expense {
  border-left-color: var(--finance-expense);
}

.finance-item.is-income {
  border-left-color: var(--finance-income);
}

.dashboard .finance-item,
.dashboard .finance-form {
  color: var(--fg);
}

.finance-item:hover {
  background: var(--surface);
}

.finance-item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.finance-item-meta,
.finance-muted {
  font-size: 13px;
  color: var(--muted);
}

.finance-item-comment {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.finance-item-amount {
  font-family: 'Helvetica', sans-serif;
  font-size: 18px;
  white-space: nowrap;
}

.finance-item-actions {
  display: flex;
  gap: 2px;
}

.finance-back {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}

.finance-back:hover,
.finance-back:focus-visible {
  color: var(--fg);
}

.finance-form {
  max-width: 720px;
  padding: 24px;
  border: 1px solid var(--border);
  border-top-width: 3px;
  border-radius: 14px;
}

.finance-form.is-expense {
  border-top-color: var(--finance-expense);
}

.finance-form.is-income {
  border-top-color: var(--finance-income);
}

.finance-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.finance-form-grid .is-wide {
  grid-column: 1 / -1;
}

.finance-form-actions {
  margin-top: 28px;
}

.finance-categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.finance-panel {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.finance-panel h2 {
  margin-bottom: 16px;
  font-family: 'Helvetica', sans-serif;
  font-size: 22px;
  letter-spacing: -.5px;
}

.finance-category-list {
  list-style: none;
  margin-bottom: 24px;
}

.finance-category-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.finance-category-rename {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.finance-category-rename input {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: var(--fg);
  background: transparent;
  border: 0;
  border-bottom: 1px dashed transparent;
  padding: 6px 0;
  outline: none;
}

.finance-category-rename input:hover,
.finance-category-rename input:focus {
  border-bottom-color: var(--muted);
}

.finance-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.finance-inline input {
  flex: 1;
}

@media (max-width: 900px) {
  .finance-filters {
    padding: 16px;
  }

  .finance-item {
    gap: 8px;
    padding-left: 14px;
  }

  .finance-list-head .finance-check {
    padding-left: 16px;
  }

  .finance-bulk-bar {
    top: 64px;
  }

  .finance-form {
    padding: 16px;
  }

  .finance-form-grid {
    grid-template-columns: 1fr;
  }
}

/* Finances : menu d'actions ⋮ d'un mouvement */
.finance-menu {
  position: relative;
}

.finance-menu > summary {
  list-style: none;
  cursor: pointer;
}

.finance-menu > summary::-webkit-details-marker {
  display: none;
}

.finance-menu[open] > summary {
  background: var(--surface);
}

.finance-menu-panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 20;
  min-width: 210px;
  padding: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
}

.finance-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--fg);
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.finance-menu-item .icon {
  width: 16px;
  height: 16px;
}

.finance-menu-item:hover,
.finance-menu-item:focus-visible {
  background: var(--surface);
}

.finance-menu-item.is-danger {
  color: var(--danger);
}

/* Finances › Entités */
.finance-groups {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.finance-panel h2 .dashboard-badge {
  vertical-align: middle;
  font-family: 'Poppins', sans-serif;
  letter-spacing: 0;
}

.finance-table-wrap {
  overflow-x: auto;
}

.finance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.finance-table th,
.finance-table td {
  padding: 10px 8px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

.finance-table th {
  font-weight: normal;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.finance-table td:first-child {
  min-width: 160px;
}

.finance-table td:first-child .dashboard-badge {
  margin-left: 6px;
}

.finance-table tbody tr:last-child td {
  border-bottom: 0;
}

.finance-table tbody tr:hover {
  background: var(--surface);
}

.finance-table tr.is-inactive td {
  color: var(--muted);
}

.finance-table .is-nowrap {
  white-space: nowrap;
}

.finance-table a {
  color: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.dashboard-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.dashboard-checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--fg);
}

.dashboard-empty code {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 8px;
  font-size: 13px;
  background: var(--surface);
  border-radius: 6px;
}

@media (max-width: 900px) {
  .finance-table .is-optional {
    display: none;
  }
}

/* Dashboard › Investissements */
.invest-scope {
  grid-template-columns: repeat(auto-fit, minmax(220px, 320px));
  margin-top: 0;
}

.invest-cards {
  margin-bottom: 24px;
}

.invest-cards .finance-muted {
  font-size: 12px;
}

.invest-section {
  margin-top: 24px;
}

.invest-section > h2,
.invest-inline-title {
  margin-bottom: 16px;
}

.invest-inline-title {
  display: inline-block;
  margin-bottom: 0;
}

details.invest-section > summary {
  cursor: pointer;
}

details.invest-section[open] > summary {
  margin-bottom: 16px;
}

.invest-subhead {
  margin-bottom: 8px;
}

.invest-subhead h2 {
  margin-bottom: 0;
}

.invest-table .is-num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.invest-table th.is-num {
  text-align: right;
}

/* Dates, montants, badges : jamais coupés (le tableau défile horizontalement sur mobile) */
.invest-table td:not(:first-child) {
  white-space: nowrap;
}

.invest-table .finance-item-meta {
  display: block;
  font-size: 12px;
}

.invest-asset-link {
  color: inherit;
  text-decoration: none;
}

.invest-asset-link:hover,
.invest-asset-link:focus-visible {
  text-decoration: underline;
}

.invest-months td,
.invest-months th {
  padding: 8px 6px;
  font-size: 13px;
}

.invest-note {
  margin-top: 12px;
  font-size: 13px;
}

.invest-note p + p {
  margin-top: 6px;
}

.invest-totals {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--muted);
}

.invest-type {
  display: inline-block;
  padding: 2px 8px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.invest-type.is-buy { border-color: var(--finance-expense); color: var(--finance-expense); }
.invest-type.is-sell,
.invest-type.is-dividend { border-color: var(--finance-income); color: var(--finance-income); }

.dashboard-badge.is-success {
  color: var(--finance-income);
  border-color: var(--finance-income);
  text-decoration: none;
}

.invest-inline-form {
  margin: 8px 0 0;
}

.invest-empty-actions {
  justify-content: center;
  margin-top: 16px;
}

.finance-form .finance-muted {
  font-size: 12px;
}

/* Dashboard › Appréciations (générateur avec Claude) */
.appr {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.appr .finance-panel h2 {
  margin-bottom: 0;
}

.appr-student .dashboard-field,
.appr-add .dashboard-field {
  flex: 1;
}

.appr-criteria-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.appr-add {
  margin-bottom: 16px;
}

.appr-criteria-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.appr-view-toggle {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.appr-view-toggle .dashboard-icon-button {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  color: var(--muted);
}

.appr-view-toggle .dashboard-icon-button.is-active {
  color: var(--fg);
  background: var(--surface);
}

.appr-criteria.is-list {
  grid-template-columns: 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.appr-criteria.is-list .appr-criterion {
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.appr-criteria.is-list .appr-criterion:last-child {
  border-bottom: 0;
}

.appr-criteria.is-list .appr-criterion:hover:not(.is-selected) {
  background: var(--surface);
}

.appr-criteria.is-list .appr-criterion label {
  padding: 12px 44px 12px 14px;
  font-size: 15px;
  line-height: 1.5;
}

.appr-criteria.is-list .appr-criterion .dashboard-icon-button {
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
}

.appr-criteria {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
  list-style: none;
}

.appr-criterion {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color .15s ease, background-color .15s ease;
}

.appr-criterion:hover {
  border-color: var(--muted);
}

.appr-criterion.is-selected {
  color: var(--bg);
  background: var(--fg);
  border-color: var(--fg);
}

.appr-criterion label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 36px 10px 12px;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
}

.appr-criterion input {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: currentColor;
}

.appr-criterion-num {
  flex-shrink: 0;
  font-size: 12px;
  opacity: .5;
  margin-top: 1px;
}

.appr-criterion .dashboard-icon-button {
  position: absolute;
  top: 4px;
  right: 4px;
  opacity: 0;
  color: inherit;
}

.appr-criterion:hover .dashboard-icon-button,
.appr-criterion .dashboard-icon-button:focus-visible {
  opacity: 1;
}

.appr-restore {
  margin-top: 12px;
}

.appr-link-button {
  padding: 0;
  font: inherit;
  font-size: 13px;
  background: none;
  border: 0;
  cursor: pointer;
}

.appr .dashboard-flash {
  margin: 16px 0 0;
}

.appr-results {
  margin-top: 24px;
}

.appr-results h2 {
  margin-bottom: 12px !important;
}

.appr-result-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-left: 1.4em;
}

.appr-result {
  padding-left: 4px;
}

.appr-result-text {
  font-size: 15px;
  line-height: 1.55;
}

.appr-result-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.dashboard-button.is-done {
  color: var(--finance-income);
  border-color: var(--finance-income);
}

.appr-meta {
  margin-top: 8px;
  font-size: 12px;
}

.appr-preview {
  margin-top: 20px;
}

.appr-preview summary {
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
}

.appr-preview pre {
  margin-top: 10px;
  padding: 16px;
  max-height: 360px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  background: var(--surface);
  border-radius: 10px;
}

@media (max-width: 900px) {
  .appr-criterion .dashboard-icon-button {
    opacity: 1;
  }
}

.appr-credit {
  margin-bottom: 20px;
}

.appr-credit.is-low {
  border-color: var(--danger);
}

.appr-credit h2 {
  margin-bottom: 14px;
}

.appr-credit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
}

.appr-credit-grid > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.appr-credit-value {
  font-size: 28px;
  line-height: 1.1;
  color: var(--finance-income);
}

.appr-credit.is-low .appr-credit-value {
  color: var(--danger);
}

.appr-credit-form {
  flex-wrap: wrap;
  align-items: flex-end;
  margin-top: 18px;
}

.appr-credit-history {
  margin-top: 14px;
  font-size: 13px;
}

.appr-credit-history summary {
  cursor: pointer;
  color: var(--muted);
}

.appr-credit-history ul {
  margin-top: 6px;
  padding-left: 1.2em;
}

/* Dashboard : calculatrice d'intérêts composés (public/js/calculator.js) */
.calc {
  /* Couleurs des séries : solde / investi / intérêts (cartes, graphique, tableau) */
  --calc-balance: #059669;
  --calc-invested: #0284c7;
  --calc-interest: #d97706;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

:root[data-theme="dark"] .calc {
  --calc-balance: #34d399;
  --calc-invested: #38bdf8;
  --calc-interest: #fbbf24;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .calc {
    --calc-balance: #34d399;
    --calc-invested: #38bdf8;
    --calc-interest: #fbbf24;
  }
}

.calc .is-balance {
  color: var(--calc-balance);
}

.calc .is-invested {
  color: var(--calc-invested);
}

.calc .is-interest {
  color: var(--calc-interest);
}

/* L'attribut hidden doit primer sur les display: flex ci-dessous */
.calc [hidden] {
  display: none !important;
}

.calc-panel {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.calc-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.calc-panel h2 {
  font-family: 'Helvetica', sans-serif;
  font-size: 22px;
  letter-spacing: -.5px;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px 24px;
}

.calc-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calc-field.is-wide {
  grid-column: 1 / -1;
}

.calc-field span {
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}

.calc-field input,
.calc-field select {
  font: inherit;
  color: var(--fg);
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--border);
  border-radius: 0;
  padding: 8px 0;
  outline: none;
  transition: border-color .2s ease;
}

.calc-field select option {
  color: var(--fg);
  background: var(--bg);
}

.calc-field input:focus,
.calc-field select:focus {
  border-bottom-color: var(--fg);
}

.calc-error {
  margin-top: 20px;
  padding: 12px 16px;
  font-size: 14px;
  background: var(--surface);
  border-left: 4px solid var(--danger);
}

.calc-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.calc-form .calc-actions {
  margin-top: 28px;
}

.calc-submit {
  padding: 12px 32px;
  font-family: 'Helvetica', sans-serif;
  font-weight: bold;
  font-size: 16px;
  color: var(--bg);
  background: var(--fg);
  border: 2px solid var(--fg);
  border-radius: 999px;
  cursor: pointer;
  transition: all .3s ease-in-out;
}

.calc-submit:hover,
.calc-submit:focus-visible {
  color: var(--fg);
  background: transparent;
}

.calc-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.calc-presets .dashboard-card-label {
  margin-right: 8px;
}

.calc-results {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.calc-value {
  font-size: 32px;
  letter-spacing: -1px;
}

.calc-hint {
  font-size: 13px;
  color: var(--muted);
}

.calc-legend {
  display: flex;
  gap: 16px;
  list-style: none;
  font-size: 13px;
  color: var(--muted);
}

.calc-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.calc-swatch {
  display: inline-block;
  width: 18px;
  border-top: 2px solid var(--calc-balance);
}

.calc-swatch.is-invested {
  border-top: 2px dashed var(--calc-invested);
}

.calc-swatch.is-interest {
  border-top: 2px dotted var(--calc-interest);
}

.calc-chart {
  height: 280px;
}

.calc-chart svg {
  display: block;
  font-family: 'Poppins', sans-serif;
}

.calc-grid-line {
  stroke: var(--border);
}

.calc-axis {
  font-size: 11px;
  fill: var(--muted);
}

.calc-line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
}

.calc-line.is-balance {
  stroke: var(--calc-balance);
  stroke-width: 2.5;
}

.calc-line.is-invested {
  stroke: var(--calc-invested);
  stroke-dasharray: 6 5;
}

.calc-line.is-interest {
  stroke: var(--calc-interest);
  stroke-dasharray: 2 4;
}

.calc-table-wrap {
  overflow-x: auto;
}

.calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.calc-table th,
.calc-table td {
  padding: 10px 8px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.calc-table th:first-child,
.calc-table td:first-child {
  text-align: center;
}

.calc-table tbody tr:hover {
  background: var(--surface);
}

.calc-table th {
  font-weight: normal;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}

.calc-results .dashboard-button:disabled {
  opacity: .4;
  cursor: default;
}

@media (max-width: 900px) {
  .calc-panel {
    padding: 16px;
  }

  .calc-chart {
    height: 220px;
  }

  .calc-table .is-optional {
    display: none;
  }
}

/* Mobile : sidebar en tiroir */
@media (max-width: 900px) {
  .dashboard-topbar {
    position: sticky;
    top: 0;
    z-index: 150;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }

  .dashboard-topbar .theme-toggle {
    margin-left: auto;
  }

  .dashboard-sidebar {
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.76, 0, .24, 1);
  }

  .dashboard-sidebar.is-open {
    transform: none;
  }

  .dashboard-sidebar .dashboard-sidebar-close {
    display: grid;
    position: absolute;
    top: -8px;
    right: 0;
  }

  .dashboard-overlay:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 190;
    background: rgba(0, 0, 0, .4);
  }

  .dashboard {
    margin-left: 0;
    padding: 2rem 16px;
  }

  .message-summary {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

@media (max-width: 580px) {
  .login-form h1,
  .dashboard h1 {
    font-size: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-sidebar {
    transition: none;
  }
}

/*######################################################*/
/*##################### CONTACT ########################*/
/*######################################################*/

/* Badge reCAPTCHA masqué (il couvrirait le lien du coin) : la mention légale est sous le formulaire */
.grecaptcha-badge {
  visibility: hidden !important;
}

html:has(.contact-dialog[open]) {
  overflow: hidden;
}

/* Fenêtre plein écran, ouverte en cercle par public/js/contact.js */
.contact-dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
  color: var(--fg);
}

.contact-dialog[open] {
  display: flex;
}

.contact-dialog::backdrop {
  background: transparent;
}

.contact-close {
  position: fixed;
  top: 30px;
  right: 40px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--fg);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color .3s ease-in-out, transform .3s ease-in-out;
}

.contact-close svg {
  width: 24px;
  height: 24px;
}

.contact-close:hover,
.contact-close:focus-visible {
  background: var(--surface);
  transform: rotate(90deg);
}

.contact-close:focus-visible,
.contact-submit:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

.contact-container {
  width: 100%;
  max-width: 760px;
  margin: auto;
  padding: 120px 16px 80px;
}

.contact-view[hidden] {
  display: none;
}

/* Titre façon "Qui suis-je ?" : gros Helvetica + texte fantôme derrière */
.contact-title {
  position: relative;
  z-index: 1;
  display: inline-block;
  margin-bottom: 1.5rem;
  font-family: 'Helvetica', sans-serif;
  font-weight: bold;
  font-size: 90px;
  line-height: 1;
  letter-spacing: -4px;
}

.contact-title[data-ghost]:before {
  content: attr(data-ghost);
  position: absolute;
  left: 50px;
  top: -45px;
  z-index: -1;
  white-space: nowrap;
  color: var(--ghost);
  opacity: .3;
}

.contact-intro {
  max-width: 560px;
  margin-bottom: 3rem;
  line-height: 1.7;
  color: var(--muted);
}

.contact-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 32px;
}

/* Champ : label flottant + trait qui se dessine au focus */
.field {
  position: relative;
  padding-top: 22px;
  margin-bottom: 28px;
}

.field-input {
  width: 100%;
  padding: 10px 0;
  font: inherit;
  font-size: 18px;
  color: var(--fg);
  background: linear-gradient(var(--fg), var(--fg)) no-repeat left bottom / 0 2px;
  border: 0;
  border-bottom: 2px solid var(--border);
  border-radius: 0;
  outline: none;
  transition: background-size .4s cubic-bezier(.76, 0, .24, 1), border-color .3s ease;
}

.field-input:focus {
  background-size: 100% 2px;
}

.field-textarea {
  display: block;
  min-height: 140px;
  line-height: 1.6;
  resize: vertical;
}

.field-label {
  position: absolute;
  left: 0;
  top: 34px;
  font-size: 18px;
  color: var(--muted);
  pointer-events: none;
  transform-origin: left top;
  transition: transform .25s ease, color .25s ease;
}

.field-input:focus + .field-label,
.field-input:not(:placeholder-shown) + .field-label {
  transform: translateY(-30px) scale(.75);
  color: var(--fg);
}

.field-error {
  margin-top: 6px;
  font-size: 13px;
  color: var(--danger);
}

.field-error:empty {
  display: none;
}

.field.has-error .field-input {
  border-bottom-color: var(--danger);
}

/* Pot de miel */
.field-hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.contact-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 12px;
}

.contact-legal {
  max-width: 380px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.contact-legal a {
  color: inherit;
}

/* Bouton pilule avec flèche */
.contact-submit {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  margin-left: auto;
  padding: 0 28px;
  font-family: 'Helvetica', sans-serif;
  font-weight: bold;
  font-size: 18px;
  color: var(--bg);
  background: var(--fg);
  border: 2px solid var(--fg);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .3s ease, color .3s ease;
}

.contact-submit svg {
  width: 20px;
  height: 20px;
  transition: transform .3s ease;
}

.contact-submit:hover,
.contact-submit:focus-visible {
  color: var(--fg);
  background: transparent;
}

.contact-submit:hover svg {
  transform: translateX(4px);
}

.contact-submit:disabled {
  cursor: progress;
  opacity: .7;
}

.contact-submit.is-loading svg {
  animation: contact-nudge 1s ease-in-out infinite;
}

@keyframes contact-nudge {
  50% {
    transform: translateX(6px);
  }
}

.contact-status {
  margin-bottom: 1.5rem;
  padding: 12px 16px;
  font-size: 14px;
  background: var(--surface);
  border-left: 4px solid var(--danger);
}

.contact-status[hidden] {
  display: none;
}

/* Succès : coche qui se dessine */
.contact-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.contact-success .contact-submit {
  margin-left: 0;
}

.contact-check {
  width: 96px;
  height: 96px;
  margin-bottom: 2rem;
}

.contact-check circle {
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
}

.contact-check path {
  stroke-dasharray: 32;
  stroke-dashoffset: 32;
}

.contact-success.is-animated .contact-check circle {
  animation: contact-draw .6s ease forwards;
}

.contact-success.is-animated .contact-check path {
  animation: contact-draw .4s .5s ease forwards;
}

@keyframes contact-draw {
  to {
    stroke-dashoffset: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .contact-check circle,
  .contact-check path {
    stroke-dashoffset: 0;
    animation: none !important;
  }

  .field-input,
  .field-label,
  .contact-close,
  .contact-submit,
  .contact-submit svg {
    transition: none;
  }
}

@media (max-width: 700px) {
  .contact-container {
    padding: 90px 16px 60px;
  }

  .contact-row {
    grid-template-columns: 1fr;
  }

  .contact-title {
    font-size: 50px;
    letter-spacing: -2px;
  }

  .contact-title[data-ghost]:before {
    left: 30px;
    top: -25px;
  }

  .contact-close {
    top: 16px;
    right: 12px;
  }

  .contact-submit {
    width: 100%;
    justify-content: center;
  }
}

.invest-note {
  margin-top: 12px;
  font-size: 12px;
}
