/* L'attribut hidden doit toujours gagner sur les display: grid/flex des classes */
[hidden] {
  display: none !important;
}

#userEmailChip {
  cursor: pointer;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  width: 100%;
  padding-right: 44px;
  box-sizing: border-box;
}

.eye-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  opacity: 0.7;
  padding: 4px;
}

.eye-toggle:hover {
  opacity: 1;
}

.strength-bar {
  height: 7px;
  border-radius: 4px;
  background: var(--surface-strong);
  overflow: hidden;
  margin: 8px 0;
}

.strength-bar span {
  display: block;
  height: 100%;
  width: 0;
  transition: width 0.25s ease, background 0.25s ease;
  border-radius: 4px;
}

.strength-criteria {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: grid;
  gap: 3px;
  font-size: 0.82rem;
}

.strength-criteria li {
  color: var(--muted);
  transition: color 0.2s ease;
}

.strength-criteria li.met {
  color: var(--accent);
}

.strength-criteria li::before {
  content: "○ ";
}

.strength-criteria li.met::before {
  content: "✓ ";
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 20, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
  max-width: 440px;
  text-align: center;
  box-shadow: var(--shadow);
}

.modal-icon {
  font-size: 3rem;
  margin-bottom: 8px;
}

.modal-email {
  font-weight: 600;
  color: var(--primary);
  margin: 12px 0 20px;
  word-break: break-all;
}

.duration-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
}

.duration-picker select {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.price-detail {
  color: var(--muted);
  font-size: 0.85rem;
  margin: -8px 0 8px;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.sub-days {
  margin: 6px 0;
  font-size: 0.95rem;
}

.income-panel {
  margin-bottom: 18px;
}

.month-panel {
  margin-bottom: 18px;
}

.compact-control {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.65rem;
  padding: 0 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
}

.compact-control span {
  white-space: nowrap;
}

.compact-control input {
  min-height: 2rem;
  padding: 0 0.35rem;
}

.debt-summary {
  margin-bottom: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.summary-grid div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-grid small {
  color: var(--muted);
}

.summary-grid strong {
  font-size: 1.25rem;
}

.goal-item {
  margin-bottom: 16px;
}

.goal-item p {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  cursor: pointer;
}

.toggle-row input {
  width: 18px;
  height: 18px;
}

:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-strong: #f0f3f8;
  --text: #162033;
  --muted: #667085;
  --line: #d9e0ea;
  --primary: #246bfe;
  --primary-strong: #174ed8;
  --accent: #11a683;
  --warning: #f59e0b;
  --danger: #dc2626;
  --shadow: 0 24px 60px rgba(21, 33, 54, 0.12);
  --radius: 8px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d111a;
  --surface: #151b27;
  --surface-strong: #1d2635;
  --text: #eef3ff;
  --muted: #9aa7bd;
  --line: #2a3547;
  --primary: #6ea0ff;
  --primary-strong: #8ab3ff;
  --accent: #35d0a8;
  --warning: #fbbf24;
  --danger: #fb7185;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(36, 107, 254, 0.12), transparent 34rem),
    var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
  padding: 1rem clamp(1rem, 4vw, 4rem);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
}

.brand,
.sidebar-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.brand-logo,
.brand-mark {
  display: inline-grid;
  width: 2.45rem;
  height: 2.45rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius);
}

.brand-logo {
  display: block;
  object-fit: contain;
}

.brand-mark {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  font-weight: 800;
  letter-spacing: 0;
}

.brand small,
.sidebar-head small {
  display: block;
  color: var(--muted);
  font-size: 0.77rem;
  margin-top: 0.05rem;
}

.auth-logo {
  width: 4rem;
  height: 4rem;
  border-radius: 14px;
  margin-bottom: 1rem;
}

.landing-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  color: var(--muted);
  font-weight: 600;
}

.top-actions,
.workspace-actions,
.hero-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

select,
input {
  min-height: 2.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0 0.8rem;
}

.primary-button,
.ghost-button,
.icon-button,
.menu-button,
.secondary-button {
  min-height: 2.65rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0 1rem;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.primary-button {
  background: var(--primary);
  color: white;
  box-shadow: 0 12px 26px rgba(36, 107, 254, 0.25);
}

.primary-button:hover,
.ghost-button:hover,
.secondary-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.ghost-button,
.secondary-button,
.icon-button,
.menu-button {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

.large {
  min-height: 3.2rem;
  padding: 0 1.25rem;
}

.full {
  width: 100%;
}

.menu-button {
  display: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(22rem, 0.98fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
  padding: clamp(3rem, 7vw, 6rem) clamp(1rem, 4vw, 4rem);
  max-width: 1280px;
  margin: 0 auto;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--primary);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 13ch;
  font-size: clamp(2.55rem, 6vw, 5.2rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  line-height: 1.08;
  letter-spacing: 0;
}

h3 {
  margin: 0.8rem 0 0.45rem;
}

.hero-copy {
  max-width: 42rem;
  margin: 1.35rem 0 1.6rem;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.secondary-link {
  color: var(--primary);
  font-weight: 800;
}

.trust-row {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.trust-row span,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.82rem;
}

.product-frame {
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 8px);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.mini-toolbar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

.mini-toolbar span {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--line);
}

.mini-toolbar strong {
  margin-left: auto;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  padding: 1rem;
}

.metric-card,
.chart-card,
.feature-grid article,
.price-card,
.panel,
.auth-modal .modal-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.metric-card {
  padding: 1.1rem;
}

.metric-card small,
.stat small {
  color: var(--muted);
  font-weight: 700;
}

.metric-card strong,
.stat strong {
  display: block;
  margin-top: 0.4rem;
  font-size: 1.65rem;
}

.metric-card.accent {
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 16%, var(--surface)), var(--surface));
}

.progress {
  height: 0.55rem;
  margin-top: 1rem;
  border-radius: 999px;
  background: var(--surface-strong);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.chart-card {
  grid-column: span 2;
  min-height: 14rem;
  display: flex;
  align-items: end;
  gap: 0.8rem;
  padding: 1.1rem;
}

.bar {
  flex: 1;
  border-radius: 8px 8px 2px 2px;
  background: color-mix(in srgb, var(--primary) 24%, var(--surface-strong));
}

.bar.active {
  background: linear-gradient(180deg, var(--accent), var(--primary));
}

.section {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(3rem, 6vw, 5rem) clamp(1rem, 4vw, 4rem);
}

.section-heading {
  max-width: 680px;
  margin-bottom: 1.5rem;
}

.feature-grid,
.pricing-grid,
.stats-grid,
.card-grid,
.form-grid {
  display: grid;
  gap: 1rem;
}

.feature-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.feature-grid article,
.price-card,
.panel {
  padding: 1.25rem;
}

.feature-grid span {
  color: var(--primary);
  font-weight: 800;
}

.feature-grid p,
.price-card p,
.security-band p,
.panel p {
  color: var(--muted);
  line-height: 1.6;
}

.pricing-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.price-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  min-width: 0;
}

.price-card.featured {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--line));
  box-shadow: var(--shadow);
}

.price {
  font-size: 2rem;
  font-weight: 800;
}

.price small {
  color: var(--muted);
  font-size: 0.9rem;
}

.price-card ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  line-height: 1.8;
}

.pricing-note {
  grid-column: 1 / -1;
}

.site-footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.5rem clamp(1rem, 4vw, 4rem) 2rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.footer-brand strong {
  color: var(--text);
}

.footer-brand small {
  display: block;
  margin-top: 0.2rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.8rem;
  font-weight: 750;
}

.footer-copy {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.9rem;
}

.legal-page {
  min-height: 58vh;
}

.legal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.security-band {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 2rem;
  align-items: center;
  border-top: 1px solid var(--line);
}

.auth-page {
  min-height: calc(100vh - 4.75rem);
  padding: clamp(2rem, 6vw, 5rem) clamp(1rem, 4vw, 4rem);
}

.auth-panel {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(20rem, 28rem);
  gap: clamp(2rem, 6vw, 4rem);
  align-items: center;
}

.auth-panel h1 {
  max-width: 12ch;
}

.auth-card {
  display: grid;
  gap: 0.9rem;
  padding: 1.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.back-link {
  display: inline-flex;
  margin-bottom: 1.5rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr);
  min-height: calc(100vh - 4.75rem);
  max-width: 100vw;
}

.sidebar {
  position: sticky;
  top: 4.75rem;
  height: calc(100vh - 4.75rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  border-right: 1px solid var(--line);
  background: var(--surface);
  min-width: 0;
  max-width: 100vw;
}

.app-nav {
  display: grid;
  gap: 0.35rem;
}

.app-nav button {
  width: 100%;
  min-height: 2.7rem;
  padding: 0 0.85rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  font-weight: 750;
}

.app-nav button.active,
.app-nav button:hover {
  background: var(--surface-strong);
  color: var(--text);
}

.workspace {
  padding: clamp(1rem, 3vw, 2rem);
  min-width: 0;
  max-width: 100vw;
}

.workspace-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.notice {
  margin-bottom: 1rem;
  border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--line));
  background: color-mix(in srgb, var(--warning) 10%, var(--surface));
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  font-weight: 650;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.card-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}

.panel h3 {
  margin-top: 0;
}

.panel,
.card-grid > *,
.stats-grid > *,
.form-grid > *,
.split > * {
  min-width: 0;
}

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 44rem;
}

th,
td {
  padding: 0.9rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

tr:last-child td {
  border-bottom: 0;
}

.form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  margin-bottom: 1rem;
}

label span {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.84rem;
}

label input,
label select {
  width: 100%;
}

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.auth-modal {
  border: 0;
  padding: 0;
  background: transparent;
}

.auth-modal::backdrop {
  background: rgba(9, 13, 23, 0.58);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  width: min(92vw, 28rem);
  padding: 1.35rem;
  box-shadow: var(--shadow);
}

.modal-card h2 {
  font-size: 1.6rem;
  margin-bottom: 1rem;
}

.modal-card label {
  display: block;
  margin-bottom: 0.8rem;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.form-note,
.empty-state {
  color: var(--muted);
  font-size: 0.9rem;
}

.pill-good,
.pill-warn,
.pill-danger {
  display: inline-flex;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.78rem;
}

.pill-good {
  color: #047857;
  background: rgba(16, 185, 129, 0.13);
}

.pill-warn {
  color: #b45309;
  background: rgba(245, 158, 11, 0.16);
}

.pill-danger {
  color: #be123c;
  background: rgba(244, 63, 94, 0.14);
}

@media (max-width: 1060px) {
  .landing-nav,
  .top-actions {
    display: none;
  }

  .topbar.menu-open .landing-nav,
  .topbar.menu-open .top-actions {
    position: absolute;
    left: 1rem;
    right: 1rem;
    top: calc(100% + 0.5rem);
    display: grid;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .topbar.menu-open .top-actions {
    top: calc(100% + 12.5rem);
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .hero,
  .security-band {
    grid-template-columns: 1fr;
  }

  h1 {
    max-width: 16ch;
  }

  .feature-grid,
  .pricing-grid,
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .app-nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 0.2rem;
    max-width: 100%;
  }

  .app-nav button {
    flex: 0 0 8rem;
  }

  .workspace-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-grid,
  .card-grid,
  .split,
  .auth-panel,
  .legal-grid,
  .site-footer {
    grid-template-columns: 1fr;
  }

  .footer-links {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .topbar {
    padding: 0.85rem 1rem;
  }

  .hero,
  .section {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .product-grid,
  .feature-grid,
  .pricing-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .chart-card {
    grid-column: auto;
  }

  .topbar.menu-open .top-actions {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 1rem;
  }

  .topbar.menu-open .landing-nav,
  .topbar.menu-open .top-actions {
    left: 0.75rem;
    right: 0.75rem;
  }

  .hero-actions,
  .workspace-actions,
  .account-actions,
  .duration-picker {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .ghost-button,
  .secondary-button,
  .icon-button,
  .menu-button,
  select,
  input {
    min-height: 2.85rem;
  }

  .brand span {
    max-width: 10rem;
  }

  .product-frame,
  .table-wrap {
    max-width: 100%;
  }

  table {
    min-width: 38rem;
  }
}

@media (max-width: 380px) {
  .brand-logo,
  .brand-mark {
    width: 2.1rem;
    height: 2.1rem;
  }

  .brand span {
    max-width: 8rem;
  }

  h1 {
    font-size: 2.15rem;
  }
}
