:root {
  --red-700: #b41f2a;
  --red-600: #cf2f3b;
  --red-050: #fff1f2;
  --brand-ink: #2a2023;
  --brand-graphite: #17181c;
  --brand-ivory: #fffaf4;
  --brand-champagne: #d7b778;
  --brand-gold-muted: #9c7a39;
  --gray-950: #20242a;
  --gray-800: #343942;
  --gray-600: #69707d;
  --gray-300: #d9dde4;
  --gray-200: #e8ebf0;
  --gray-100: #f5f6f8;
  --white: #ffffff;
  --green: #18865b;
  --amber: #a66505;
  --blue: #2d6cdf;
  --orange: #d9720a;
  --shadow: 0 10px 24px rgba(32, 36, 42, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--gray-950);
  background: var(--gray-100);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

html {
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  gap: 18px;
  padding: 28px 16px;
  background: var(--gray-100);
}

.premium-auth-shell {
  position: relative;
  overflow: hidden;
  grid-template-columns: minmax(0, 1fr);
  background-image:
    radial-gradient(circle at 50% 12%, rgba(215, 183, 120, 0.22), transparent 28%),
    radial-gradient(circle at 18% 88%, rgba(180, 31, 42, 0.22), transparent 30%),
    linear-gradient(160deg, rgba(18, 15, 18, 0.88) 0%, rgba(38, 27, 30, 0.82) 45%, rgba(15, 17, 22, 0.92) 100%),
    url("/images/sidebar-bg.jpg");
  background-size: cover, cover, cover, cover;
  background-position: center, center, center, center 55%;
  background-repeat: no-repeat;
  color: var(--brand-ivory);
}

.premium-auth-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 250, 244, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 250, 244, 0.035) 1px, transparent 1px);
  background-size: 84px 84px;
  mask-image: radial-gradient(circle at 50% 30%, black, transparent 72%);
}

.premium-auth-shell::after {
  content: "";
  position: absolute;
  inset: auto 12% 8% 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(215, 183, 120, 0.5), transparent);
  opacity: 0.8;
}

.premium-intro {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(360px, 100%);
  margin-bottom: -4px;
  animation: premium-intro-settle 1800ms cubic-bezier(0.19, 1, 0.22, 1) both;
}

.premium-intro__halo {
  position: absolute;
  inset: -76px -16px auto;
  height: 174px;
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(255, 246, 225, 0.24), transparent 40%),
    radial-gradient(circle, rgba(215, 183, 120, 0.22), transparent 68%);
  filter: blur(24px);
  animation: premium-halo-breathe 2200ms 120ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.premium-intro__logo {
  position: relative;
  display: grid;
  place-items: center;
  width: 228px;
  height: 146px;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.26));
}

.premium-intro__mark {
  width: 228px;
  height: auto;
  animation: premium-logo-fade 2200ms 120ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.premium-intro__line {
  width: 156px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand-champagne), transparent);
  transform-origin: center;
  animation: premium-line-reveal 1400ms 280ms cubic-bezier(0.19, 1, 0.22, 1) both;
}

.auth-card {
  width: min(440px, 100%);
  display: grid;
  gap: 14px;
  position: relative;
  z-index: 1;
  padding: 24px;
  border: 1px solid rgba(215, 183, 120, 0.24);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 250, 244, 0.98), rgba(255, 255, 255, 0.94));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34), 0 1px 0 rgba(255, 255, 255, 0.72) inset;
  color: var(--gray-950);
  backdrop-filter: blur(18px);
}

.auth-card.wide {
  width: min(840px, 100%);
}

.auth-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(215, 183, 120, 0.3);
}

.auth-card h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

.auth-card p,
.auth-note {
  margin: 0;
  color: var(--gray-600);
  font-size: 13px;
}

.auth-alert {
  padding: 10px 12px;
  border: 1px solid var(--red-600);
  border-radius: 8px;
  background: var(--red-050);
  color: var(--red-700);
  font-weight: 800;
}

.auth-success {
  padding: 10px 12px;
  border: 1px solid rgba(15, 118, 110, 0.28);
  border-radius: 8px;
  background: rgba(240, 253, 250, 0.88);
  color: #0f766e;
  font-weight: 800;
}

.auth-actions {
  display: flex;
  justify-content: center;
}

.auth-debug-link {
  color: var(--red-700);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.auth-security-copy {
  width: min(440px, 100%);
  display: grid;
  gap: 4px;
  position: relative;
  z-index: 1;
  color: rgba(255, 250, 244, 0.76);
  font-size: 12px;
  text-align: center;
}

.auth-security-copy strong {
  color: var(--brand-ivory);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-setup-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
}

.auth-qr-panel,
.recovery-panel {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--gray-100);
}

.qr-code {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 12px;
  border-radius: 8px;
  background: var(--white);
}

.qr-code svg {
  width: min(220px, 100%);
  height: auto;
}

.manual-secret {
  overflow-wrap: anywhere;
  padding: 9px 10px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  background: var(--white);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 800;
}

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

.setup-actions .button {
  flex: 1 1 160px;
}

.recovery-panel h2 {
  margin: 0;
  font-size: 17px;
}

.recovery-codes {
  min-height: 176px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 800;
}

.code-input {
  letter-spacing: 0;
  font-size: 22px;
  font-weight: 850;
  text-align: center;
}

.portal-body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--white);
}

.portal-body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(32, 36, 42, 0.04) 0%, rgba(32, 36, 42, 0.02) 42%, rgba(32, 36, 42, 0.34) 100%),
    url("/images/lns-patrimoine-background.jpg") center top / cover no-repeat;
}

.portal-body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.18) 46%, rgba(255, 255, 255, 0.32) 100%);
}

.portal-loading {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  color: var(--red-700);
  font-size: 22px;
  font-weight: 850;
}

.portal-shell {
  width: min(720px, 100%);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 14px calc(86px + env(safe-area-inset-bottom));
  background: transparent;
}

.portal-shell.single {
  display: grid;
  place-items: center;
}

.portal-topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 -14px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 24px rgba(18, 41, 57, 0.12);
  backdrop-filter: blur(14px);
}

.portal-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(280px, calc(100vw - 128px));
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--gray-950);
  text-align: left;
}

.portal-brand-logo {
  display: block;
  width: min(220px, 100%);
  height: 44px;
  object-fit: contain;
  object-position: left center;
  mix-blend-mode: multiply;
}

.portal-topbar-left {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.portal-consent-mini {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(24, 134, 91, 0.28);
  border-radius: 8px;
  background: rgba(24, 134, 91, 0.1);
  color: var(--green);
}

.portal-consent-mini svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.4;
}

.portal-brand strong,
.portal-brand small {
  display: block;
}

.portal-brand strong {
  font-size: 15px;
  line-height: 1.1;
}

.portal-brand small {
  margin-top: 2px;
  color: var(--gray-600);
  font-size: 12px;
}

.portal-admin-link {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  color: var(--gray-600);
  text-decoration: none;
}

.portal-consent-row {
  position: sticky;
  top: 63px;
  z-index: 7;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 8px;
  margin: 0 -14px;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 8px 18px rgba(18, 41, 57, 0.1);
  backdrop-filter: blur(14px);
}

.portal-consent-row.collapsed {
  padding-top: 6px;
  padding-bottom: 6px;
}

.portal-consent-indicator {
  min-width: 0;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid;
  border-radius: 8px;
  background: var(--white);
  font-weight: 900;
  text-align: left;
}

.portal-consent-row.collapsed .portal-consent-indicator {
  min-height: 36px;
  padding: 6px 9px;
}

.portal-consent-indicator.required {
  border-color: var(--red-600);
  color: var(--red-700);
  background: var(--red-050);
}

.portal-consent-indicator.valid {
  border-color: rgba(24, 134, 91, 0.28);
  color: var(--green);
  background: rgba(24, 134, 91, 0.08);
}

.portal-consent-dot {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  color: var(--white);
  flex: 0 0 auto;
}

.portal-consent-indicator.required .portal-consent-dot {
  background: var(--red-700);
}

.portal-consent-indicator.valid .portal-consent-dot {
  background: var(--green);
}

.portal-consent-dot svg {
  width: 16px;
  height: 16px;
}

.portal-consent-toggle {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  color: var(--gray-800);
}

.portal-consent-toggle svg {
  width: 19px;
  height: 19px;
}

.portal-consent-details {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 2px 0;
}

.portal-consent-row.collapsed .portal-consent-details {
  display: none;
}

.portal-consent-details p {
  margin: 0;
  color: var(--gray-600);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.portal-legal-button,
.portal-inline-link {
  border: 0;
  background: transparent;
  color: var(--red-700);
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.portal-legal-button {
  min-height: 32px;
  padding: 0 4px;
  white-space: nowrap;
}

.portal-screen {
  display: none;
  padding: 16px 0 8px;
}

.portal-screen.active {
  display: block;
}

.portal-hero {
  display: grid;
  gap: 14px;
  min-height: calc(100dvh - 198px - env(safe-area-inset-bottom));
  align-content: end;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, rgba(32, 36, 42, 0.08) 58%, rgba(32, 36, 42, 0.46) 100%),
    url("/images/lns-patrimoine-background.jpg") center top / cover no-repeat;
  color: var(--white);
  box-shadow: 0 18px 34px rgba(18, 41, 57, 0.22);
  text-shadow: 0 2px 14px rgba(18, 41, 57, 0.48);
}

.crm-shell .portal-hero {
  min-height: calc(100dvh - 142px - env(safe-area-inset-bottom));
}

.portal-eyebrow {
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.portal-hero h1,
.portal-section h1,
.portal-section h2,
.portal-news-card h3 {
  margin: 0;
  letter-spacing: 0;
}

.portal-hero h1 {
  font-size: 34px;
  line-height: 1.02;
}

.portal-hero p {
  max-width: 56ch;
  margin: 0;
  color: rgba(255, 255, 255, 0.94);
  line-height: 1.45;
}

.portal-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.portal-action {
  min-width: 0;
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--gray-950);
  font-weight: 850;
  text-align: left;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(18, 41, 57, 0.12);
  backdrop-filter: blur(8px);
}

.portal-action svg,
.portal-bottom-nav svg,
.portal-admin-link svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  stroke-width: 2.2;
}

.portal-action.disabled {
  color: var(--gray-600);
  background: var(--gray-100);
}

.portal-section {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(18, 41, 57, 0.12);
  backdrop-filter: blur(12px);
}

.portal-section.first {
  margin-top: 0;
}

.portal-section h1 {
  color: var(--gray-950);
  font-size: 28px;
  line-height: 1.05;
}

.portal-section h2 {
  font-size: 18px;
}

.portal-section p,
.portal-muted {
  margin: 0;
  color: var(--gray-600);
  line-height: 1.5;
}

.portal-news-strip,
.portal-news-list {
  display: grid;
  gap: 12px;
}

.portal-news-card {
  overflow: hidden;
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  min-height: 116px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 24px rgba(18, 41, 57, 0.1);
  backdrop-filter: blur(10px);
}

.portal-news-card img,
.portal-news-visual {
  width: 100%;
  height: 100%;
  min-height: 116px;
  object-fit: cover;
  background: var(--red-050);
}

.portal-news-visual {
  display: grid;
  place-items: center;
  color: var(--red-700);
}

.portal-news-card > div:last-child {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  padding: 12px;
}

.portal-news-meta {
  color: var(--red-700);
  font-size: 12px;
  font-weight: 850;
}

.portal-news-card h3 {
  font-size: 17px;
  line-height: 1.15;
}

.portal-news-card p {
  margin: 0;
  color: var(--gray-600);
  font-size: 13px;
  line-height: 1.4;
}

.portal-empty,
.portal-error {
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--gray-600);
  box-shadow: 0 10px 24px rgba(18, 41, 57, 0.1);
  backdrop-filter: blur(10px);
}

.portal-error {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  justify-items: start;
}

.portal-error h1,
.portal-error p {
  margin: 0;
}

.portal-form {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(18, 41, 57, 0.12);
  backdrop-filter: blur(12px);
}

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

.portal-field,
.portal-consent {
  display: grid;
  gap: 6px;
  color: var(--gray-800);
  font-size: 13px;
  font-weight: 800;
}

.portal-field.full,
.portal-consent.full {
  grid-column: 1 / -1;
}

.portal-field input,
.portal-field select,
.portal-field textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--white);
  color: var(--gray-950);
}

.portal-field textarea {
  resize: vertical;
}

.portal-consent {
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  color: var(--gray-600);
  font-weight: 650;
  line-height: 1.4;
}

.portal-consent input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
}

.portal-legal-copy {
  display: grid;
  gap: 10px;
  color: var(--gray-600);
  line-height: 1.55;
}

.portal-legal-copy p {
  margin: 0;
}

.portal-legal-title h1 {
  font-size: 26px;
}

.portal-legal-stack {
  display: grid;
  gap: 14px;
}

.portal-legal-card {
  gap: 14px;
}

.portal-legal-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.portal-legal-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--red-050);
  color: var(--red-700);
}

.portal-legal-icon svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.3;
}

.portal-legal-copy h3 {
  margin: 4px 0 0;
  color: var(--gray-950);
  font-size: 15px;
  line-height: 1.3;
}

.portal-legal-copy ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
}

.portal-legal-copy li::marker {
  color: var(--red-700);
}

.portal-legal-kv,
.portal-legal-address {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(217, 221, 228, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.portal-legal-kv > span:first-child,
.portal-legal-address strong {
  color: var(--gray-800);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.portal-legal-kv > span:last-child,
.portal-legal-address span {
  color: var(--gray-950);
  font-weight: 760;
  overflow-wrap: anywhere;
}

.portal-legal-kv.important > span:last-child {
  color: var(--red-700);
  font-size: 16px;
  font-weight: 950;
}

.portal-legal-kv a,
.portal-legal-cta {
  color: var(--red-700);
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.portal-legal-cta {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(180, 31, 42, 0.28);
  border-radius: 8px;
  background: var(--red-050);
  text-decoration: none;
}

.portal-legal-cta svg {
  width: 18px;
  height: 18px;
}

.portal-legal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--gray-600);
  box-shadow: 0 12px 28px rgba(18, 41, 57, 0.1);
  backdrop-filter: blur(12px);
}

.portal-legal-footer strong {
  color: var(--gray-950);
}

.portal-legal-access {
  width: 100%;
  margin-top: 12px;
}

.portal-consent-dialog {
  width: min(680px, 100%);
}

.portal-consent-body {
  display: grid;
  gap: 16px;
}

.portal-consent-identity {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--gray-100);
}

.portal-consent-checks {
  display: grid;
  gap: 10px;
}

.portal-consent-checks .portal-consent {
  padding: 10px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
}

.portal-consent-dialog .portal-primary {
  padding: 0 14px;
}

.portal-primary {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  background: var(--red-700);
  color: var(--white);
  font-weight: 850;
}

.portal-primary:disabled {
  opacity: 0.6;
}

.portal-primary svg {
  width: 20px;
  height: 20px;
}

.portal-form-status {
  min-height: 20px;
  color: var(--gray-600);
  font-size: 13px;
  font-weight: 800;
}

.portal-form-status.success {
  color: var(--green);
}

.portal-form-status.error {
  color: var(--red-700);
}

.portal-contact-card {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(245, 246, 248, 0.82);
}

.portal-contact-card strong {
  color: var(--gray-950);
  font-size: 18px;
}

.portal-contact-card span {
  color: var(--gray-600);
}

.portal-details {
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 24px rgba(18, 41, 57, 0.1);
  backdrop-filter: blur(10px);
}

.portal-details summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 12px 14px;
  color: var(--gray-950);
  font-weight: 850;
}

.portal-details p {
  margin: 0;
  padding: 0 14px 14px;
  color: var(--gray-600);
  line-height: 1.5;
}

.portal-bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 -10px 26px rgba(18, 41, 57, 0.12);
  backdrop-filter: blur(16px);
}

.portal-bottom-nav button,
.portal-bottom-nav a {
  min-width: 0;
  min-height: 70px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--gray-600);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
  text-decoration: none;
}

.portal-bottom-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
}

.portal-bottom-label {
  max-width: 100%;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.portal-bottom-nav button.active {
  background: var(--red-050);
  color: var(--red-700);
}

.portal-bottom-nav .portal-bottom-emphasis {
  transform: translateY(-8px);
}

.portal-bottom-nav .portal-bottom-emphasis.active {
  background: transparent;
}

.portal-bottom-emphasis .portal-bottom-icon {
  width: 54px;
  height: 54px;
  background: var(--red-700);
  color: var(--white);
  box-shadow: 0 10px 22px rgba(180, 31, 42, 0.28);
}

.portal-bottom-emphasis .portal-bottom-icon svg {
  width: 24px;
  height: 24px;
}

.portal-bottom-emphasis .portal-bottom-label {
  color: var(--red-700);
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.select.compact {
  min-height: 36px;
  padding: 6px 8px;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 264px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 14px;
  background-image: linear-gradient(175deg, rgba(120, 16, 26, 0.94) 0%, rgba(120, 16, 26, 0.88) 30%, rgba(90, 14, 22, 0.9) 65%, rgba(60, 10, 16, 0.95) 100%), url("/images/sidebar-bg.jpg");
  background-size: cover;
  background-position: center 60%;
  background-repeat: no-repeat;
  border-right: 1px solid rgba(0, 0, 0, 0.2);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--brand-ink), #4c1d24);
  color: var(--brand-ivory);
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(42, 32, 35, 0.18);
}

.sidebar .brand-mark {
  background: var(--white);
  padding: 4px;
}

.premium-brand-mark {
  overflow: hidden;
  border: 1px solid rgba(215, 183, 120, 0.26);
}

.lns-logo {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.lns-logo--compact {
  width: 100%;
  height: auto;
}

.brand-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--white);
}

.brand-subtitle {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: auto;
  padding-right: 2px;
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  color: var(--white);
  background: transparent;
  text-align: left;
}

.nav-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  stroke-width: 2;
}

.nav-button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}

.nav-button.active {
  background: rgba(255, 255, 255, 0.16);
  color: var(--white);
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-item .nav-button {
  flex: 1;
  min-width: 0;
}

.nav-item.open .nav-button {
  padding-right: 34px;
}

/* "Intercalaire" treatment: an open item reads as a binder tab sticking out of the
   red sidebar — pale card, flush-right edge, rounded only on the outward (left) side.
   The active one goes fully white with a solid accent bar, like the tab currently pulled. */
.nav-item.open .nav-button {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 8px 0 0 8px;
  box-shadow: inset 3px 0 0 rgba(255, 255, 255, 0.55);
}

.nav-item.open.active .nav-button,
.nav-item.open.active .nav-button:hover {
  background: var(--white);
  color: var(--red-700);
  box-shadow: inset 4px 0 0 var(--red-700);
}

.nav-tab-close {
  position: absolute;
  right: 4px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  flex: 0 0 auto;
}

.nav-tab-close svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

.nav-tab-close:hover {
  background: rgba(255, 255, 255, 0.18);
  color: var(--white);
}

.nav-item.open.active .nav-tab-close {
  color: rgba(180, 31, 42, 0.6);
}

.nav-item.open.active .nav-tab-close:hover {
  background: rgba(180, 31, 42, 0.12);
  color: var(--red-700);
}

/* Fiche contact ouverte : sous-intercalaire indenté sous "Clients / Prospects", nom en italique. */
.nav-item.sub .nav-button {
  min-height: 32px;
  padding-left: 30px;
  font-size: 13px;
}

.nav-item.sub .nav-button span {
  font-style: italic;
}

/* Catégories du menu : sous-menu flottant affiché au survol (voir bindNavFlyouts dans main.js). */
.nav-group {
  position: relative;
}

.nav-group .nav-button {
  justify-content: flex-start;
}

.nav-group-toggle .nav-chevron {
  margin-left: auto;
  font-size: 18px;
  line-height: 1;
  opacity: 0.7;
}

.nav-group.flyout-open .nav-group-toggle {
  background: rgba(255, 255, 255, 0.12);
}

.nav-flyout {
  display: none;
  position: fixed;
  z-index: 40;
  min-width: 230px;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  border-radius: 12px;
  background: linear-gradient(175deg, rgba(120, 16, 26, 0.98), rgba(80, 12, 20, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 14px 34px rgba(20, 4, 8, 0.45);
}

.nav-group.flyout-open .nav-flyout {
  display: flex;
}

.nav-flyout .nav-button {
  min-height: 38px;
  white-space: nowrap;
}

.main {
  grid-column: 2;
  min-width: 0;
}

.gmail-health-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 28px;
  background: #fdecec;
  border-bottom: 1px solid #f3b4b4;
  color: #7a1f1f;
  font-size: 14px;
}

/* Un sélecteur de classe simple gagne toujours contre [hidden] : les styles auteur
   l'emportent sur la feuille de style par défaut du navigateur même sans !important, donc
   "display: flex" ci-dessus s'appliquait déjà avant que JS ne retire l'attribut hidden. */
.gmail-health-banner[hidden] {
  display: none;
}

.gmail-health-banner strong {
  font-weight: 600;
}

.gmail-health-banner .button {
  white-space: nowrap;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(220px, 420px) auto;
  gap: 16px;
  align-items: center;
  min-height: 72px;
  padding: 14px 28px;
  background: rgba(245, 246, 248, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--gray-200);
}

.search-wrap {
  position: relative;
}

.global-search {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 40px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  background: var(--white);
  color: var(--gray-950);
}

.search-icon {
  position: absolute;
  left: 13px;
  top: 12px;
  color: var(--gray-600);
}

.search-results {
  position: absolute;
  top: 48px;
  left: 0;
  right: 0;
  display: none;
  max-height: 330px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.search-results.open {
  display: block;
}

.search-result {
  display: block;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--gray-950);
  text-align: left;
}

.search-result:hover {
  background: var(--gray-100);
}

.topbar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.swisslife-one-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 4px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
}

.swisslife-one-link img {
  height: 20px;
  width: auto;
  display: block;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 190px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  color: var(--gray-800);
  font-size: 13px;
  font-weight: 800;
}

.user-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-pill svg {
  width: 16px;
  height: 16px;
  color: var(--red-700);
  flex: 0 0 auto;
}

.task-alert {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 46px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  background: var(--white);
  color: var(--gray-600);
  font-weight: 850;
}

.task-alert.pending {
  border-color: var(--red-600);
  color: var(--red-700);
  background: var(--red-050);
}

.alert-light {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gray-300);
}

.task-alert.pending .alert-light {
  animation: alert-blink 0.9s infinite;
  background: var(--red-600);
  box-shadow: 0 0 0 5px rgba(207, 47, 59, 0.14), 0 0 12px rgba(207, 47, 59, 0.65);
}

.alert-count {
  min-width: 1ch;
  line-height: 1;
}

.task-alert:not(.pending) .alert-count {
  display: none;
}

@keyframes alert-blink {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.32;
    transform: scale(0.72);
  }
}

@keyframes premium-intro-settle {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  55% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes premium-halo-breathe {
  0% {
    opacity: 0;
    transform: scale(0.88);
  }
  58% {
    opacity: 1;
  }
  100% {
    opacity: 0.88;
    transform: scale(1);
  }
}

@keyframes premium-logo-fade {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.96);
  }
  50% {
    opacity: 0.94;
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes premium-line-reveal {
  0% {
    opacity: 0;
    transform: scaleX(0.18);
  }
  100% {
    opacity: 1;
    transform: scaleX(1);
  }
}

.content {
  padding: 24px 28px 48px;
}

.view-pane {
  display: none;
}

.view-pane.active {
  display: block;
}

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.view-title {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
}

.view-kicker {
  margin: 5px 0 0;
  color: var(--gray-600);
  font-size: 14px;
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

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

.link-button {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.link-button:hover strong {
  text-decoration: underline;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  background: var(--white);
  color: var(--gray-950);
  text-decoration: none;
  font-weight: 700;
}

.button {
  padding: 0 14px;
}

.icon-button {
  width: 38px;
  padding: 0;
}

.button svg,
.icon-button svg {
  width: 17px;
  height: 17px;
}

.booking-trigger {
  position: relative;
}

.booking-trigger select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: 0;
}

.attachment-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.attachment-link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.button.primary {
  border-color: var(--red-700);
  background: var(--red-700);
  color: var(--white);
}

.button.ghost {
  background: transparent;
}

.button.compact {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.button.danger {
  border-color: var(--red-600);
  background: var(--red-050);
  color: var(--red-700);
}

.icon-button.danger {
  color: var(--red-700);
}

.icon-button.danger:hover {
  border-color: var(--red-600);
  background: var(--red-050);
}

.input,
.select,
.textarea {
  min-height: 38px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  background: var(--white);
  color: var(--gray-950);
}

.input,
.select {
  padding: 0 10px;
}

.textarea {
  width: 100%;
  min-height: 86px;
  padding: 10px;
  resize: vertical;
}

.dictation-wrap {
  position: relative;
  display: block;
}

.dictation-wrap .input,
.dictation-wrap .select {
  width: 100%;
}

.input.has-dictation-button,
.textarea.has-dictation-button {
  padding-right: 36px;
}

.dictation-button {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--gray-500);
  cursor: pointer;
}

.dictation-button:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

.dictation-button svg {
  width: 15px;
  height: 15px;
}

/* Le micro d'un textarea flotte en haut à droite pour ne jamais se superposer à la
   poignée de redimensionnement (coin bas-droit). */
.dictation-button-textarea {
  top: 8px;
  transform: none;
}

.dictation-button.dictation-recording {
  color: var(--red-700);
  background: var(--red-050);
  animation: dictation-pulse 1.2s ease-in-out infinite;
}

@keyframes dictation-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

.field-input-row .dictation-button {
  position: static;
  transform: none;
  flex: 0 0 auto;
}

.inline-create-client {
  padding: 14px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--gray-100);
}

.inline-create-client.full {
  grid-column: 1 / -1;
}

.inline-create-title {
  margin-bottom: 12px;
  color: var(--gray-800);
  font-size: 13px;
  font-weight: 850;
  text-transform: uppercase;
}

.calendar-shell {
  overflow: hidden;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  min-height: 680px;
}

.calendar-frame {
  display: block;
  width: 100%;
  height: min(78vh, 820px);
  min-height: 680px;
  border: 0;
  background: var(--white);
}

.calendar-config {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  gap: 8px;
  align-items: end;
  margin-top: 12px;
}

.calendar-grid-shell {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  overflow: hidden;
}

.calendar-grid-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-200);
}

.calendar-grid-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.calendar-grid-week-label {
  color: var(--gray-800);
  font-size: 13px;
  text-transform: capitalize;
}

[data-calendar-panel].loading {
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-050, #fafafa);
}

.calendar-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--gray-700);
}

.calendar-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.calendar-allday-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--gray-200);
}

.calendar-grid-scroll {
  overflow-x: auto;
}

.calendar-grid-header {
  display: grid;
  grid-template-columns: 52px repeat(7, minmax(90px, 1fr));
  border-bottom: 1px solid var(--gray-200);
}

.calendar-grid-day-label {
  padding: 6px 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-600);
  border-left: 1px solid var(--gray-200);
  text-transform: capitalize;
}

.calendar-grid-body {
  display: grid;
  grid-template-columns: 52px minmax(630px, 1fr);
  max-height: min(70vh, 760px);
  overflow-y: auto;
  position: relative;
}

.calendar-grid-gutter {
  position: relative;
}

.calendar-grid-hour {
  box-sizing: border-box;
  padding: 2px 6px 0 0;
  text-align: right;
  font-size: 11px;
  color: var(--gray-600);
  border-top: 1px solid var(--gray-200);
}

.calendar-grid-days {
  position: relative;
}

.calendar-grid-hour-line {
  box-sizing: border-box;
  border-top: 1px solid var(--gray-200);
}

.calendar-grid-columns {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-day-column {
  position: relative;
  border-left: 1px solid var(--gray-200);
}

.calendar-day-column.today {
  background: var(--red-050);
}

.calendar-event {
  position: absolute;
  left: 3px;
  right: 3px;
  border-radius: 6px;
  padding: 2px 6px;
  color: var(--white);
  font-size: 11px;
  line-height: 1.3;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(32, 36, 42, 0.15);
}

.calendar-event.draggable {
  cursor: grab;
}

.calendar-event.dragging {
  opacity: 0.5;
}

.calendar-event-time {
  display: block;
  font-weight: 700;
  opacity: 0.9;
}

.calendar-event-title {
  display: block;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.calendar-add-form {
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 1.6fr) auto;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.metrics {
  grid-template-columns: repeat(7, minmax(140px, 1fr));
}

.grid.two {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

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

.panel,
.metric,
.card {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 1px 0 rgba(32, 36, 42, 0.02);
}

.panel {
  padding: 16px;
}

.metric {
  padding: 14px;
  min-height: 92px;
}

.metric-label {
  color: var(--gray-600);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-value {
  margin-top: 8px;
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1;
  font-weight: 850;
}

.metric-note {
  margin-top: 6px;
  color: var(--gray-600);
  font-size: 12px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
  font-size: 17px;
}

.task-section + .task-section {
  margin-top: 24px;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.quick-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 14px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  color: var(--gray-950);
  text-decoration: none;
  font-weight: 800;
}

.quick-link:hover {
  border-color: var(--red-600);
  color: var(--red-700);
}

.quick-links-logos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
}

.quick-link-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 96px;
  padding: 10px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.quick-link-logo:hover {
  transform: translateY(-2px);
  border-color: var(--red-600);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.quick-link-logo-mark {
  display: block;
  height: 32px;
  width: 72px;
}

.quick-link-logo-mark img,
.quick-link-logo-mark svg {
  height: 100%;
  width: 100%;
  object-fit: contain;
}

.quick-link-logo-label {
  color: var(--gray-950);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--gray-200);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--gray-600);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  background: #fafbfc;
}

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

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--gray-100);
  color: var(--gray-800);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.red {
  background: var(--red-050);
  color: var(--red-700);
}

.badge.green {
  background: #e9f7f1;
  color: var(--green);
}

.badge.amber {
  background: #fff4df;
  color: var(--amber);
}

.badge.blue {
  background: #ecf3ff;
  color: var(--blue);
}

.badge.orange {
  background: #fdf0e2;
  color: var(--orange);
}

.task-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 5px rgba(217, 114, 10, 0.16), 0 0 12px rgba(217, 114, 10, 0.65);
  animation: alert-blink 0.9s infinite;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--gray-200);
}

.progress span {
  display: block;
  height: 100%;
  background: var(--red-600);
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  align-items: start;
}

.stage {
  min-height: 80px;
  padding: 8px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
}

.stage-title {
  display: flex;
  justify-content: space-between;
  margin: 0 0 6px;
  color: var(--gray-800);
  font-size: 12px;
}

.stage-rule {
  margin: -2px 0 8px;
  color: var(--gray-500);
  font-size: 10.5px;
  line-height: 1.35;
}

.stage-drop {
  min-height: 40px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-radius: 6px;
  transition: background-color 0.15s ease, outline-color 0.15s ease;
  outline: 2px dashed transparent;
  outline-offset: 2px;
}

.stage-drop.drag-over {
  background: var(--gray-100);
  outline-color: var(--blue);
}

.mini-card {
  padding: 10px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--gray-100);
  margin-bottom: 8px;
}

.pipeline-card {
  margin-bottom: 0;
  cursor: grab;
  border-left: 3px solid transparent;
  padding: 6px 8px;
}

.pipeline-card-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.pipeline-card-freshness {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.pipeline-card-trophy {
  display: flex;
  flex: 0 0 auto;
  color: #c99a1e;
}

.pipeline-card-trophy svg {
  width: 13px;
  height: 13px;
}

.pipeline-freshness-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--gray-600);
}

.pipeline-freshness-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.pipeline-freshness-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.pipeline-card-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipeline-card.priority-high {
  border-left-color: var(--red-600);
}

.pipeline-card.dragging {
  opacity: 0.4;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.timeline-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--red-600);
}

.muted {
  color: var(--gray-600);
}

.small {
  font-size: 12px;
}

.prospecting-metrics.grid.metrics {
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  margin-bottom: 14px;
}

.prospecting-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(5, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.prospecting-layout.grid.two {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
}

.prospecting-side {
  align-self: start;
}

.signal-list {
  display: grid;
  gap: 8px;
}

.signal-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--gray-100);
}

.signal-item span {
  min-width: 0;
  color: var(--gray-800);
  font-size: 13px;
  font-weight: 780;
}

.signal-item strong {
  color: var(--red-700);
}

.score-cell {
  display: grid;
  gap: 6px;
  min-width: 84px;
}

.score-cell strong,
.score-large {
  color: var(--red-700);
  font-weight: 900;
}

.score-large {
  font-size: 34px;
  line-height: 1;
}

.prospect-detail-modal {
  width: min(1040px, 100%);
}

.prospect-detail-body {
  display: grid;
  gap: 16px;
}

.prospect-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.detail-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--gray-100);
}

.detail-card h3 {
  margin: 0;
  color: var(--gray-600);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-card p {
  margin: 0;
  color: var(--gray-800);
  font-size: 13px;
  line-height: 1.4;
}

.detail-card a {
  color: var(--red-700);
  font-weight: 850;
}

.readonly-field {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  background: var(--gray-100);
  color: var(--gray-950);
  font-weight: 800;
}

.prospect-message-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
}

.prospect-message {
  min-height: 190px;
  line-height: 1.45;
}

.empty {
  padding: 20px;
  border: 1px dashed var(--gray-300);
  border-radius: 8px;
  color: var(--gray-600);
  background: var(--white);
}

.report-list {
  display: grid;
  gap: 12px;
}

.report-card {
  padding: 14px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
}

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

.field {
  display: grid;
  gap: 5px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--gray-600);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.field-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.field-input-row .input {
  flex: 1;
  min-width: 0;
}

.field-input-row .icon-button {
  flex: 0 0 auto;
  color: var(--red-700);
}

.field-input-row .icon-button[aria-disabled="true"] {
  color: var(--gray-300);
  cursor: default;
  pointer-events: none;
}

.modal-root {
  position: fixed;
  /* Left inset stops at the sidebar's own width so it stays visible and clickable
     while a modal is open — switching tabs must not force-close an in-progress edit. */
  inset: 0 0 0 264px;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(32, 36, 42, 0.38);
  z-index: 40;
}

.modal-root.open {
  display: grid;
}

.modal {
  width: min(900px, 100%);
  max-height: min(840px, 92vh);
  overflow: auto;
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.modal-header,
.modal-footer {
  position: sticky;
  background: var(--white);
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.modal-header {
  top: 0;
  border-bottom: 1px solid var(--gray-200);
}

.modal-footer {
  bottom: 0;
  border-top: 1px solid var(--gray-200);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--gray-200);
}

.modal-title {
  margin: 0;
  font-size: 18px;
}

.modal-body {
  padding: 16px;
}

.voice-modal {
  width: min(1120px, 100%);
}

.meeting-detail p {
  margin: 0 0 12px;
  line-height: 1.4;
}

.meeting-detail hr {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 12px 0;
}

.meeting-detail-contact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.meeting-detail-contact .muted svg {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
}

.meeting-detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--gray-200);
}

.meeting-detail-move-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 10px;
}

/* Un sélecteur de classe simple gagne toujours contre [hidden] (styles auteur > user-agent,
   même sans !important) — voir le bandeau Gmail pour le même piège déjà rencontré. */
.meeting-detail-move-form[hidden] {
  display: none;
}

.meeting-detail-move-form .field {
  flex: 1;
}

.voice-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-200);
  background: #fafbfc;
}

.voice-steps span {
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  color: var(--gray-600);
  font-size: 12px;
  font-weight: 800;
}

.voice-steps span.active {
  border-color: var(--red-600);
  background: var(--red-050);
  color: var(--red-700);
}

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

.voice-grid .full,
.modal-footer.full {
  grid-column: 1 / -1;
}

.voice-player {
  width: 100%;
  margin-top: 12px;
}

.voice-transcription {
  min-height: 260px;
}

.compact-title {
  margin: 0 0 12px;
  font-size: 16px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--gray-700);
  font-size: 13px;
  font-weight: 700;
}

.check-row input {
  margin-top: 2px;
}

.notice {
  padding: 12px 14px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--gray-100);
  color: var(--gray-800);
  font-size: 13px;
}

.notice.amber {
  border-color: #f1cf91;
  background: #fff4df;
  color: var(--amber);
}

.proposal-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
}

.proposal-item + .proposal-item {
  margin-top: 10px;
}

.settings-form {
  display: grid;
  gap: 14px;
}

.toggle-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  color: var(--gray-800);
  font-weight: 800;
}

.toggle-line input {
  width: 18px;
  height: 18px;
  accent-color: var(--red-700);
}

.security-section {
  margin-top: 18px;
}

.security-rules {
  display: grid;
  gap: 10px;
}

.security-rules div {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  color: var(--gray-800);
  font-weight: 750;
}

.security-rules svg {
  width: 18px;
  height: 18px;
  color: var(--red-700);
}

.security-agent {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button.danger {
  border-color: var(--red-600);
  background: var(--red-050);
  color: var(--red-700);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(380px, calc(100vw - 44px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--gray-950);
  color: var(--white);
  box-shadow: var(--shadow);
  z-index: 60;
}

@media (max-width: 1180px) {
  .grid.metrics {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .prospecting-metrics.grid.metrics {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .prospecting-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .prospect-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .quick-links {
    grid-template-columns: 1fr;
  }
}

@media (prefers-color-scheme: dark) {
  .portal-legal-title,
  .portal-legal-card,
  .portal-legal-footer {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(32, 36, 42, 0.9);
    color: rgba(255, 255, 255, 0.92);
  }

  .portal-legal-heading,
  .portal-legal-copy h3,
  .portal-legal-footer strong,
  .portal-legal-kv > span:last-child,
  .portal-legal-address span {
    color: var(--white);
  }

  .portal-legal-copy,
  .portal-legal-footer,
  .portal-legal-title p {
    color: rgba(255, 255, 255, 0.76);
  }

  .portal-legal-kv,
  .portal-legal-address {
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.07);
  }

  .portal-legal-kv > span:first-child,
  .portal-legal-address strong {
    color: rgba(255, 255, 255, 0.74);
  }

  .portal-legal-icon,
  .portal-legal-cta {
    background: rgba(180, 31, 42, 0.18);
  }
}

@media (max-width: 820px) {
  .premium-auth-shell {
    align-content: center;
    padding: 22px 14px calc(22px + env(safe-area-inset-bottom));
  }

  .premium-intro {
    width: min(280px, 100%);
  }

  .premium-intro__logo,
  .premium-intro__mark {
    width: 118px;
  }

  .auth-card {
    border-radius: 16px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: auto 0 0 0;
    width: 100%;
    min-height: calc(72px + env(safe-area-inset-bottom));
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    gap: 0;
    border-right: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.25);
    border-bottom: 0;
    background-position: center 30%;
    box-shadow: 0 -8px 18px rgba(32, 36, 42, 0.28);
  }

  .brand {
    display: none;
  }

  .nav {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(82px, 1fr);
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 2px;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    height: 100%;
  }

  .nav-item.open .nav-button {
    padding-right: 7px;
  }

  .nav-tab-close {
    display: none;
  }

  .nav-group-toggle .nav-chevron {
    display: none;
  }

  .nav-flyout .nav-button {
    flex-direction: row;
    min-height: 44px;
    font-size: 14px;
    text-align: left;
    justify-content: flex-start;
  }

  .nav-button {
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-height: 56px;
    padding: 7px 6px;
    text-align: center;
    font-size: 11px;
    line-height: 1.15;
    white-space: normal;
  }

  .nav-button svg {
    width: 20px;
    height: 20px;
  }

  .main {
    grid-column: 1;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px 16px;
  }

  .topbar-actions {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .user-pill {
    min-width: 44px;
    max-width: 150px;
    min-height: 44px;
  }

  .topbar-actions::-webkit-scrollbar {
    display: none;
  }

  .task-alert,
  .icon-button {
    min-width: 44px;
    min-height: 44px;
  }

  .icon-button {
    width: 44px;
  }

  .content {
    padding: 18px 16px calc(112px + env(safe-area-inset-bottom));
  }

  .view-header {
    flex-direction: column;
  }

  .view-header .toolbar {
    width: 100%;
  }

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

  .prospecting-metrics.grid.metrics,
  .prospecting-filters,
  .prospect-detail-grid {
    grid-template-columns: 1fr;
  }

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

  .calendar-config {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .calendar-frame,
  .calendar-shell {
    min-height: 620px;
  }

  .modal-root {
    /* Sidebar is now the bottom tab bar on this breakpoint — exclude its height instead
       of the (now unused) left column, so it stays reachable while a modal is open. */
    inset: 0 0 calc(72px + env(safe-area-inset-bottom)) 0;
    align-items: end;
    padding: 10px;
  }

  .modal {
    width: 100%;
    max-height: calc(100dvh - 24px);
    border-radius: 8px 8px 0 0;
  }

  .voice-grid {
    grid-template-columns: 1fr;
  }

  .auth-setup-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }

  .premium-intro,
  .premium-intro__halo,
  .premium-intro__mark,
  .premium-intro__line,
  .task-alert.pending .alert-light {
    animation: none !important;
  }
}

@media (max-width: 640px) {
  .view-title {
    font-size: 23px;
  }

  .metric {
    min-height: 82px;
  }

  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .row-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .row-actions .button {
    width: auto;
    min-width: 44px;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tr {
    overflow: hidden;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: var(--white);
  }

  td {
    display: grid;
    grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-200);
  }

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

  td::before {
    content: attr(data-label);
    color: var(--gray-600);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
  }
}

@media (max-width: 520px) {
  .grid.metrics {
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
    min-height: 44px;
  }

  .toolbar {
    align-items: stretch;
    width: 100%;
  }

  .toolbar .input,
  .toolbar .select {
    width: 100%;
  }

  .quick-link {
    min-height: 60px;
  }

  .calendar-frame,
  .calendar-shell {
    height: 68vh;
    min-height: 520px;
  }

  .modal-header,
  .modal-footer {
    padding: 12px;
  }

  .modal-footer {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .auth-card {
    padding: 16px;
  }

  .auth-card h1 {
    font-size: 21px;
  }

  .modal-body {
    padding: 12px;
  }

  .voice-steps {
    display: grid;
    grid-template-columns: 1fr;
    padding: 10px 12px;
  }

  .portal-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  .portal-topbar {
    margin-right: -12px;
    margin-left: -12px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .portal-consent-row {
    top: 63px;
    grid-template-columns: minmax(0, 1fr) 40px;
    margin-right: -12px;
    margin-left: -12px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .portal-legal-button {
    justify-self: start;
    min-height: 32px;
  }

  .portal-consent-details {
    align-items: flex-start;
    flex-direction: column;
  }

  .portal-consent-identity {
    grid-template-columns: 1fr;
  }

  .portal-hero {
    padding: 18px 14px;
  }

  .portal-hero h1 {
    font-size: 30px;
  }

  .portal-action-grid,
  .portal-form-grid {
    grid-template-columns: 1fr;
  }

  .portal-news-card {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .portal-news-card img,
  .portal-news-visual {
    min-height: 112px;
  }

  .portal-bottom-nav {
    padding-right: 6px;
    padding-left: 6px;
  }

  .portal-legal-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .portal-legal-title h1 {
    font-size: 23px;
  }
}

.field[hidden] {
  display: none;
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.metric-link {
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.recontact-list {
  max-height: 420px;
  overflow: auto;
}

.recontact-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.recontact-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.recontact-alert {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 46px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  background: var(--white);
  color: var(--gray-600);
  font-weight: 850;
}

.recontact-alert svg {
  width: 16px;
  height: 16px;
}

.recontact-alert.pending {
  border-color: #c98a1b;
  background: #fff6e3;
  color: #8a5a00;
}

@media (max-width: 900px) {
  .recontact-alert {
    min-width: 44px;
    min-height: 44px;
  }
}

.notice.red {
  border-color: #efb4b8;
  background: #fdecee;
  color: var(--red-700);
}

.email-alert {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.loan-form {
  display: grid;
  gap: 14px;
}

.loan-form[hidden] {
  display: none;
}

/* Comparateur de prêt : écran présenté au client (grands caractères, peu de chiffres) */
.loan-present {
  display: grid;
  gap: 22px;
  padding: 28px 32px 36px;
  background: #fff;
  border: 1px solid #e3e6ea;
  border-radius: 16px;
  color: #1f2328;
  font-size: 20px;
  line-height: 1.5;
}
.loan-present h2 { margin: 2px 0 0; font-size: 34px; line-height: 1.15; }
.loan-present h3 { margin: 10px 0 0; font-size: 24px; }
.loan-present-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.loan-present-kicker { font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; color: #b41f2a; font-weight: 700; }
.loan-present-hero { padding: 26px 30px; border-radius: 16px; background: #f4f5f7; }
.loan-present-hero.good { background: #e8f5ee; border: 2px solid #2e8b57; }
.loan-present-label { font-size: 20px; color: #3b424a; }
.loan-present-big { font-size: 72px; line-height: 1.05; font-weight: 800; color: #1e6b45; margin: 6px 0; }
.loan-present-sub { font-size: 22px; }
.loan-present-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.loan-present-card { padding: 22px 24px; border-radius: 14px; border: 2px solid #d5d9df; background: #fafbfc; }
.loan-present-card.red { border-color: #b41f2a; background: #fdf3f4; }
.loan-present-tag { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 16px; font-weight: 700; color: #fff; }
.loan-present-tag.grey { background: #6b7380; }
.loan-present-tag.red { background: #b41f2a; }
.loan-present-value { font-size: 46px; font-weight: 800; margin: 10px 0 0; }
.loan-present-note { font-size: 17px; color: #4a5058; margin-bottom: 12px; }
.loan-present-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid #e3e6ea; font-size: 19px; }
.loan-present-bars { display: grid; gap: 12px; }
.loan-present-bars > div { display: grid; grid-template-columns: 190px 1fr 130px; align-items: center; gap: 14px; font-size: 19px; }
.loan-present-bars .bar { height: 26px; background: #eceef1; border-radius: 13px; overflow: hidden; }
.loan-present-bars .bar i { display: block; height: 100%; border-radius: 13px; }
.loan-present-bars b { text-align: right; }
.loan-present-legend { display: flex; gap: 26px; font-size: 18px; }
.loan-present-legend i { display: inline-block; width: 22px; height: 6px; border-radius: 3px; margin-right: 8px; vertical-align: middle; }
.loan-present-table { width: 100%; border-collapse: collapse; font-size: 19px; }
.loan-present-table th { text-align: left; padding: 10px 12px; background: #f4f5f7; font-size: 17px; }
.loan-present-table td { padding: 11px 12px; border-bottom: 1px solid #e3e6ea; }
.loan-present-table td.ok { color: #1e6b45; font-weight: 700; }
.loan-present-table td.ko { color: #b41f2a; font-weight: 700; }
.loan-present-list { margin: 0; padding-left: 26px; display: grid; gap: 10px; }
.loan-present-foot { margin: 6px 0 0; font-size: 15px; color: #5a616a; }
@media (max-width: 720px) {
  .loan-present { padding: 18px; font-size: 18px; }
  .loan-present-big { font-size: 52px; }
  .loan-present-bars > div { grid-template-columns: 1fr; }
}

/* Paramètres fiscaux et barèmes Swiss Life (js/views/fiscalParamsPanel.js) */
.fiscal-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 10px 0 14px;
}

[data-proposal] [data-edit][hidden] {
  display: none;
}

.fiscal-documents .fiscal-selected {
  background: var(--gray-100);
}

.fiscal-compare td {
  vertical-align: top;
}

.fiscal-compare q {
  display: block;
  margin-top: 4px;
  font-style: italic;
  white-space: pre-wrap;
}

/* Synthèse du bilan : graphiques (palette catégorielle validée, valeurs toujours écrites à côté) */
.viz-donut {
  display: grid;
  grid-template-columns: 160px 1fr;
  align-items: center;
  gap: 16px;
}

.viz-donut svg {
  width: 160px;
  height: 160px;
}

.viz-donut-label {
  fill: var(--gray-600);
  font-size: 10px;
}

.viz-donut-value {
  fill: var(--gray-800);
  font-size: 13px;
  font-weight: 800;
}

.viz-legend {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

.viz-legend li {
  display: grid;
  grid-template-columns: 12px 1fr auto 56px;
  align-items: center;
  gap: 8px;
}

.viz-legend li .muted {
  text-align: right;
}

.viz-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.viz-stack {
  display: flex;
  gap: 2px;
  height: 18px;
  border-radius: 4px;
  overflow: hidden;
}

.viz-stack span {
  min-width: 3px;
}

.viz-line {
  width: 100%;
  height: auto;
}

.viz-grid {
  stroke: var(--gray-200);
  stroke-width: 1;
}

.viz-axis {
  fill: var(--gray-600);
  font-size: 10px;
}

.bilan-alert {
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-left-width: 4px;
  border-radius: 8px;
  margin-bottom: 8px;
}

.bilan-alert.red {
  border-left-color: var(--red-700);
}

.bilan-alert.amber {
  border-left-color: var(--amber);
}

.bilan-alert.blue {
  border-left-color: var(--blue);
}

.small-input {
  width: 80px;
}

@media (max-width: 720px) {
  .viz-donut {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .viz-donut .viz-legend {
    width: 100%;
  }
}

/* Bilan patrimonial (js/views/bilanPatrimonial.js) */
.bilan-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.bilan-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  background: #fff;
  color: var(--gray-700);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.bilan-step span {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gray-100);
  font-size: 11px;
}

.bilan-step.done span {
  background: #e9f7f1;
  color: var(--green);
}

.bilan-step.active {
  border-color: #b41f2a;
  color: #b41f2a;
}

.bilan-step.active span {
  background: #b41f2a;
  color: #fff;
}

.bilan-steps-next {
  margin-left: auto;
}

.bilan-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.bilan-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.bilan-card-head .button {
  margin-left: auto;
}

.bilan-grid {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.bilan-card .select,
.bilan-card .input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.bilan-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 8px;
}

.bilan-checks:empty {
  display: none;
}

.bilan-check,
.field label.bilan-check {
  margin: 0;
  color: var(--gray-700);
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
}

.bilan-add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bilan-recap {
  display: grid;
  gap: 6px;
}

.bilan-recap > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--gray-200);
  font-size: 13px;
}

.bilan-recap.total > div:nth-child(3) {
  border-bottom: 0;
  font-size: 15px;
}

.bilan-objective .bilan-grid {
  margin-top: 8px;
}

.bilan-objective.chosen {
  border-color: #b41f2a;
  background: #fff;
}

.bilan-group-title {
  margin: 16px 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-700);
}

@media (max-width: 720px) {
  .bilan-steps-next {
    margin-left: 0;
    width: 100%;
  }

  .bilan-grid,
  .bilan-card .form-grid {
    grid-template-columns: 1fr;
  }
}

/* Famille & état civil (js/family.js) */
.family-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 18px;
}

.family-group {
  display: grid;
  gap: 4px;
  align-content: start;
}

.family-group.derived {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--gray-200);
}

.family-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  font-size: 13px;
}

.family-role {
  display: inline-block;
  min-width: 92px;
  margin-right: 6px;
  color: var(--gray-700);
  font-size: 12px;
  font-weight: 700;
}

.family-person {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-align: left;
}

button.family-person {
  cursor: pointer;
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.family-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--gray-200);
  font-size: 13px;
}

.family-row:last-child {
  border-bottom: 0;
}

.planned-reminder {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.planned-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  font-size: 12px;
}

.relatives-notes {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.relative-note {
  padding: 8px 10px;
  border: 1px dashed var(--gray-200);
  border-radius: 8px;
  font-size: 13px;
}

.relative-note summary {
  cursor: pointer;
}

.relative-note-body {
  margin: 8px 0;
  white-space: pre-wrap;
  max-height: 260px;
  overflow-y: auto;
}

.family-editor {
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
}

.family-editor .field label.check-row {
  font-size: 13px;
  letter-spacing: normal;
  text-transform: none;
}

.family-editor [hidden] {
  display: none !important;
}

.family-results {
  display: grid;
  gap: 2px;
  margin-top: 4px;
}

.family-result {
  padding: 6px 8px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: var(--gray-100);
  color: inherit;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.family-result:hover {
  border-color: var(--blue);
}

.booking-contact-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.booking-contact-box {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.booking-contact-box .input {
  width: 100%;
}

.booking-contact-row .button {
  flex: 0 0 auto;
}

/* Liste posée au-dessus de la page intégrée, pour ne pas la décaler à chaque frappe. */
.booking-contact-results {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  display: grid;
  gap: 2px;
  max-height: 340px;
  padding: 4px;
  overflow-y: auto;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 10px 24px rgba(23, 24, 28, 0.14);
}

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

.booking-contact-result {
  display: grid;
  gap: 1px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.booking-contact-result span {
  overflow-wrap: anywhere;
}

.booking-contact-result:hover,
.booking-contact-result.active {
  background: var(--red-050);
}

.booking-contact-name {
  font-weight: 700;
}

.booking-contact-empty {
  padding: 8px 9px;
}

.dcd-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #b41f2a;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  vertical-align: middle;
  box-shadow: 0 0 0 0 rgba(180, 31, 42, 0.6);
  animation: dcd-blink 1.1s ease-in-out infinite;
}

.dcd-badge[hidden] {
  display: none;
}

@keyframes dcd-blink {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(180, 31, 42, 0.55);
  }
  50% {
    opacity: 0.25;
    box-shadow: 0 0 0 6px rgba(180, 31, 42, 0);
  }
}

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

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #fff;
  color: #b41f2a;
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
}

.nav-group-toggle .nav-badge-dot {
  margin-left: 8px;
}

/* Température d'un prospect : curseur du froid (bleu) au chaud (rouge) */
.temp-slider { display: grid; gap: 6px; }
.temp-slider-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.temp-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(0,0,0,.08) inset, 0 0 6px rgba(0,0,0,.12); flex: none; }
.temp-dot-wrap { display: inline-flex; align-items: center; gap: 6px; }
.temp-range { -webkit-appearance: none; appearance: none; width: 100%; height: 12px; border-radius: 999px; outline: none; cursor: pointer;
  background: linear-gradient(90deg, #2F6FDB 0%, #60B8E8 25%, #F2C94C 50%, #F28C38 75%, #D6342C 100%); }
.temp-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 3px solid #20242A; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.temp-range::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 3px solid #20242A; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.temp-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--gray-500, #69707d); }

/* Scan de carte de visite (recto / verso / logo) */
.card-scan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.card-slot { display: grid; gap: 8px; align-content: start; padding: 10px; border: 1px solid var(--gray-200, #e3e6eb); border-radius: 10px; }
.card-slot-preview { min-height: 140px; padding: 6px; display: grid; place-items: center; background: var(--gray-100, #f3f4f6); border-radius: 8px; color: var(--gray-500, #69707d); font-size: 13px; overflow: hidden; }
.card-slot-preview img { max-width: 100%; max-height: 280px; object-fit: contain; display: block; }
.card-thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-thumbs figure { margin: 0; text-align: center; font-size: 11px; color: var(--gray-500, #69707d); }
.card-thumbs img { height: 70px; max-width: 150px; object-fit: contain; border: 1px solid var(--gray-200, #e3e6eb); border-radius: 6px; background: #fff; display: block; }
.contact-logo { height: 34px; width: auto; max-width: 110px; object-fit: contain; vertical-align: middle; margin-right: 10px; border-radius: 4px; background: #fff; }

/* Appareil photo intégré (scan de carte de visite) */
body.cam-open { overflow: hidden; }
.cam-overlay { position: fixed; inset: 0; z-index: 10000; background: #000; display: flex; flex-direction: column; color: #fff; }
.cam-top { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; background: rgba(0,0,0,.6); }
.cam-status { font-size: 14px; color: #f5a623; min-height: 20px; }
.cam-status[data-tone="ok"] { color: #2ecc71; }
.cam-status[data-tone="warn"] { color: #ff8a65; }
.cam-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.cam-frame { position: relative; display: inline-block; max-width: 100%; max-height: 100%; line-height: 0; }
.cam-frame video, .cam-frame .cam-review { max-width: 100vw; max-height: calc(100vh - 190px); max-height: calc(100dvh - 190px); display: block; object-fit: contain; background: #111; }
.cam-draw { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cam-bar .button { flex: 1 1 0; min-width: 0; white-space: normal; text-align: center; }
.cam-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: rgba(0,0,0,.7); }
.cam-bar[hidden], .cam-review[hidden], .cam-frame video[hidden], .cam-draw[hidden] { display: none; }
.cam-review-bar { justify-content: center; }
.cam-shutter { flex: none; width: 68px; min-width: 68px; height: 68px; aspect-ratio: 1; padding: 0; border-radius: 50%; border: 5px solid #fff; background: #d6342c; box-shadow: 0 0 0 3px rgba(0,0,0,.4); cursor: pointer; }
.cam-shutter:active { transform: scale(.94); }

/* Doublon : proposition de fusion */
.dup-overlay { position: fixed; inset: 0; z-index: 9000; background: rgba(15, 18, 24, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dup-dialog { background: var(--surface, #fff); color: inherit; border-radius: 14px; padding: 20px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.dup-list { display: grid; gap: 8px; margin: 12px 0; }
.dup-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--gray-200, #e3e6eb); border-radius: 10px; cursor: pointer; }
.dup-diff { display: grid; gap: 10px; margin-bottom: 14px; }
.dup-block { padding: 10px 12px; background: var(--gray-100, #f3f4f6); border-radius: 10px; display: grid; gap: 4px; }
.dup-conflict { display: grid; gap: 2px; padding-top: 6px; }
.dup-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* Réseaux sociaux (Metricool) */
.social-networks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.social-themes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.social-theme {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.social-theme-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
}

.social-post-thumb {
  display: block;
  width: 88px;
  height: 66px;
  object-fit: cover;
  border-radius: 6px;
}

/* Avis Google (dashboard) */
.google-review-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.google-review-stars {
  color: #f5b301;
  letter-spacing: 1px;
}

.google-review-text {
  margin: 6px 0 0;
  white-space: pre-line;
}

.falling-star {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  font-size: 24px;
  line-height: 24px;
  color: #f5b301;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

[data-google-reviews-count] {
  transform-origin: left center;
}

[data-google-reviews-average] {
  display: inline-block;
  transform-origin: left center;
}

.fiscal-param-form { margin-top: 12px; padding: 12px; border: 1px solid var(--line, #e2e8f0); border-radius: 8px; display: grid; gap: 8px; }
.fiscal-param-form[hidden] { display: none; }
.input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.bilan-reference { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; text-transform: none; }

/* Écrans « une page » : tuiles qui ouvrent une rubrique en fenêtre (js/popupTiles.js). La rubrique reste dans le DOM
   à sa place : la fenêtre est la rubrique elle-même, positionnée par-dessus l'écran. Les fenêtres modales du CRM
   (z-index 40) passent au-dessus. */
.popup-section { display: none; }
.popup-section.open {
  display: flex;
  flex-direction: column;
  position: fixed;
  z-index: 36;
  top: 4vh;
  left: calc(264px + (100vw - 264px) / 2);
  transform: translateX(-50%);
  width: min(980px, calc(100vw - 304px));
  max-height: 92vh;
  border-radius: 10px;
  background: var(--white);
  box-shadow: 0 24px 60px rgba(32, 36, 42, 0.28);
  overflow: hidden;
}
.popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-200);
}
.popup-head strong { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; }
.popup-head-actions { display: flex; gap: 8px; }
.popup-body { overflow: auto; padding: 14px 16px 18px; }
.popup-body > .panel { border: 0; padding: 0; box-shadow: none; }
.popup-body > .panel > .section-title:first-child { display: none; }
.popup-body > .mini-card { margin-bottom: 0 !important; }
.popup-backdrop { display: none; }
.popup-backdrop.open {
  display: block;
  position: fixed;
  inset: 0 0 0 264px;
  z-index: 35;
  background: rgba(32, 36, 42, 0.38);
}
.popup-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.popup-tile {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.popup-tile:hover, .popup-tile:focus-visible { border-color: var(--red-600, #b91c1c); box-shadow: 0 4px 14px rgba(32, 36, 42, 0.1); transform: translateY(-1px); }
.popup-tile-icon { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 8px; background: var(--gray-100); }
.popup-tile-icon svg { width: 18px; height: 18px; }
.popup-tile-text { display: grid; gap: 2px; min-width: 0; }
.popup-tile-text strong { font-size: 14px; }
.popup-tile-summary { font-size: 12px; color: var(--gray-600, #6b7280); line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.popup-tile.tone-alert { border-color: #f5c2c2; background: #fff6f6; }
.popup-tile.tone-alert .popup-tile-icon { background: #fde2e2; }
.popup-group { margin-bottom: 14px; }
.popup-group-title { margin: 0 0 8px; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--gray-600, #6b7280); }

/* Fiche client sur un écran : coordonnées à gauche, tuiles des rubriques à droite. */
.contact-onepage { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 14px; align-items: start; }
.contact-onepage .contact-main .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; }
.contact-onepage .contact-main .form-grid .full { grid-column: 1 / -1; }
.contact-onepage .contact-main .section-title { margin: 0 0 10px; }
.contact-onepage .contact-tiles .popup-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.contact-onepage .contact-tiles .popup-tile { min-height: 58px; padding: 8px 10px; }
.contact-onepage .popup-section.open .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 1180px) {
  .contact-onepage { grid-template-columns: 1fr; }
  .contact-onepage .contact-tiles { order: -1; }
  .contact-onepage .contact-tiles .popup-tiles { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
@media (max-width: 820px) {
  .popup-section.open { top: 8px; left: 50%; width: calc(100vw - 16px); max-height: calc(100vh - 96px - env(safe-area-inset-bottom)); }
  .popup-backdrop.open { inset: 0 0 calc(72px + env(safe-area-inset-bottom)) 0; }
  .contact-onepage .contact-main .form-grid,
  .contact-onepage .popup-section.open .form-grid { grid-template-columns: 1fr; }
}
.contact-onepage .contact-main .field,
.contact-onepage .contact-main .field-input-row,
.contact-onepage .contact-main .input,
.contact-onepage .contact-main .select { min-width: 0; max-width: 100%; }
.contact-onepage .contact-main .field-input-row .input { flex: 1 1 auto; width: auto; }
.popup-head strong svg { width: 18px; height: 18px; flex: none; }
/* Le titre est déjà dans l'en-tête de la fenêtre : on masque le titre interne de la rubrique, ses boutons restent. */
.popup-body > .mini-card > .view-header:first-child > strong:first-child,
.popup-body > .panel > .view-header:first-child > strong:first-child { display: none; }
.popup-body > .mini-card > .view-header:first-child,
.popup-body > .panel > .view-header:first-child { justify-content: flex-end; }
.popup-body > .mini-card { border: 0; padding: 0; box-shadow: none; background: transparent; }
@media (max-width: 820px) {
  .popup-head { flex-wrap: wrap; padding: 10px 12px; }
  .popup-head strong { font-size: 15px; flex: 1 1 140px; }
  .popup-head-actions { margin-left: auto; }
}

/* Fiche client : une ligne par thème (identité, coordonnées, état civil, suivi). Le nombre de colonnes suit la largeur
   réelle du formulaire (requêtes de conteneur) : 4 colonnes en grand, 3 puis 2 en fenêtre étroite, 1 sur téléphone. */
.contact-group-title { margin: 10px 0 4px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--red-600); }
.contact-group-title:first-of-type { margin-top: 0; }
.contact-main, .modal-body { container-type: inline-size; }
.form-grid.contact-row,
.contact-onepage .contact-main .form-grid.contact-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.contact-row .contact-wide, .contact-row .contact-company { grid-column: 1 / -1; }
.contact-row .contact-company { margin: 0; }
@container (min-width: 440px) {
  .form-grid.contact-row,
  .contact-onepage .contact-main .form-grid.contact-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-grid.contact-row.contact-row-coords,
  .contact-onepage .contact-main .form-grid.contact-row.contact-row-coords { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (min-width: 580px) {
  .form-grid.contact-row,
  .contact-onepage .contact-main .form-grid.contact-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .contact-row .contact-company { grid-column: span 2; align-self: end; margin-bottom: 10px; }
  .contact-row-follow .contact-referrer { grid-column: span 2; }
  .form-grid.contact-row.contact-row-coords,
  .contact-onepage .contact-main .form-grid.contact-row.contact-row-coords { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (min-width: 820px) {
  .form-grid.contact-row.contact-row-coords,
  .contact-onepage .contact-main .form-grid.contact-row.contact-row-coords { grid-template-columns: 1fr 1fr 2fr; }
  .contact-row-coords .contact-wide { grid-column: auto; }
}
@container (max-width: 300px) {
  .form-grid.contact-row,
  .contact-onepage .contact-main .form-grid.contact-row { grid-template-columns: 1fr; }
}
.contact-onepage { grid-template-columns: minmax(0, 1fr) minmax(250px, 0.62fr); }
.contact-onepage .contact-tiles .popup-tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (max-width: 1000px) {
  .contact-onepage { grid-template-columns: 1fr; }
}

/* Icônes des tuiles en rouge (fiche client et Paramètres). */
.popup-tile-icon { color: var(--red-600); background: rgba(207, 47, 59, 0.08); }
.popup-head strong svg { color: var(--red-600); }

/* Modèles SMS : champs remplis depuis la fiche ($…$) ou à compléter à l'envoi (#…#) */
.sms-field { border-radius: 4px; padding: 0 3px; font-weight: 600; }
.sms-field-contact { background: rgba(33, 180, 182, 0.16); color: inherit; }
.sms-field-free { background: rgba(255, 170, 0, 0.22); color: inherit; }

/* Communication → SMS : sous-menu à gauche et accueil en cartes (disposition de Le SMS Agile, style du CRM) */
.sms-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.sms-menu { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 12px; padding: 8px; border-radius: 12px; background: var(--panel, #fff); border: 1px solid var(--line, #e5e7eb); }
.sms-menu-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.sms-menu-item:hover { background: rgba(31, 122, 92, 0.08); }
.sms-menu-item.active { background: #1f7a5c; color: #fff; font-weight: 600; }
.sms-menu-item svg { flex-shrink: 0; }
.sms-pane { min-width: 0; }
.sms-home { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.sms-card { margin: 0; min-width: 0; }
.sms-card-wide { grid-column: span 2; }
.sms-send-list { display: flex; flex-direction: column; max-height: 340px; overflow: auto; }
.sms-send-item { display: block; width: 100%; text-align: left; padding: 8px 6px; border: 0; border-bottom: 1px solid var(--line, #e5e7eb); background: transparent; color: inherit; font: inherit; cursor: pointer; }
.sms-send-item:hover { background: rgba(31, 122, 92, 0.08); }
.sms-response { padding: 8px 0; border-bottom: 1px solid var(--line, #e5e7eb); }
@media (max-width: 1100px) {
  .sms-home { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .sms-layout { grid-template-columns: 1fr; }
  .sms-menu { position: static; flex-direction: row; overflow-x: auto; }
  .sms-menu-item { white-space: nowrap; }
  .sms-home { grid-template-columns: 1fr; }
  .sms-card-wide { grid-column: auto; }
}
.sms-menu-item svg, .sms-card .section-title svg, .sms-pane .section-title svg { width: 18px; height: 18px; flex-shrink: 0; }
.sms-card .section-title, .sms-pane .section-title { display: flex; align-items: center; justify-content: flex-start; gap: 8px; text-align: left; }

/* Conversation SMS (fiche contact, boîte des réponses) */
.sms-thread { display: flex; flex-direction: column; gap: 8px; padding: 4px 2px; }
.sms-bubble { max-width: 82%; padding: 8px 12px; border-radius: 14px; line-height: 1.35; white-space: pre-wrap; word-break: break-word; }
.sms-bubble.out { align-self: flex-end; background: #1f7a5c; color: #fff; border-bottom-right-radius: 4px; }
.sms-bubble.in { align-self: flex-start; background: var(--gray-100, #f1f3f5); color: inherit; border-bottom-left-radius: 4px; }
.sms-bubble-meta { font-size: 11px; opacity: 0.75; margin-top: 3px; }
.sms-count-warn { color: #b45309; font-weight: 600; }
.sms-unanswered { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: auto; border-radius: 999px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
@media (prefers-color-scheme: dark) { .sms-bubble.in { background: rgba(255, 255, 255, 0.08); } }
