:root {
  --ink: #263e60;
  --muted: #626b73;
  --paper: #fffdf8;
  --cream: #f5f0e6;
  --sand: #e8ddcc;
  --sage: #879da0;
  --sage-dark: #3e557e;
  --terracotta: #994b56;
  --danger: #a7443a;
  --border: rgba(62, 85, 126, .2);
  --shadow: 0 18px 50px rgba(62, 85, 126, .12);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: radial-gradient(circle at 8% 3%, #fff 0, transparent 28%), var(--cream);
  font: 16px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 76px;
  padding: 10px clamp(18px, 4vw, 60px);
  background: rgba(255, 253, 248, .94);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(16px);
}
.portal-brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.portal-brand img { width: 54px; height: 54px; object-fit: contain; }
.portal-brand b { display: block; font-family: Georgia, serif; font-size: 1.15rem; }
.portal-brand small { color: var(--muted); }
.portal-topbar nav { display: flex; gap: 10px; align-items: center; }
.text-link { color: var(--sage-dark); font-weight: 700; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 17px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 750;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: var(--sage-dark); box-shadow: 0 8px 20px rgba(54, 93, 82, .2); }
.button-secondary { color: var(--ink); background: white; border-color: var(--border); }
.button-danger { color: white; background: var(--danger); }
.button-quiet { color: var(--sage-dark); background: #e8f0ec; }
.icon-button { width: 42px; height: 42px; padding: 0; border-radius: 50%; border: 1px solid var(--border); background: white; }

.auth-page {
  min-height: calc(100vh - 76px);
  display: grid;
  place-items: center;
  padding: 40px 18px;
}
.auth-card {
  width: min(100%, 560px);
  padding: clamp(26px, 5vw, 46px);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 30px;
  box-shadow: var(--shadow);
}
.eyebrow { margin: 0 0 6px; color: var(--terracotta); text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 800; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.15; }
h1 { margin: 0 0 12px; font-size: clamp(2rem, 5vw, 3.15rem); font-weight: 500; }
h2 { margin: 0 0 14px; font-size: clamp(1.45rem, 3vw, 2rem); font-weight: 500; }
h3 { margin: 0 0 8px; font-size: 1.2rem; }
.muted { color: var(--muted); }
.auth-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 26px 0 20px; padding: 5px; border-radius: 999px; background: var(--cream); }
.auth-switch button { padding: 10px; border: 0; border-radius: 999px; color: var(--muted); background: transparent; font-weight: 750; }
.auth-switch button.active { color: var(--ink); background: white; box-shadow: 0 4px 14px rgba(43, 61, 55, .08); }

.stack { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; color: var(--ink); font-weight: 700; }
.field small { color: var(--muted); font-weight: 500; }
.field input, .field textarea, .field select,
.toolbar input, .toolbar select, .inline-input {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid #cfc9bc;
  border-radius: 12px;
  color: var(--ink);
  background: white;
  outline: none;
}
.field textarea { min-height: 104px; resize: vertical; }
.required-mark { color: var(--terracotta); font-weight: 800; }
.animal-required-note { margin: 0; color: var(--muted); font-size: .88rem; font-weight: 500; }
.animal-required-note span { color: var(--terracotta); font-weight: 800; }
.field input:focus, .field textarea:focus, .field select:focus,
.toolbar input:focus, .toolbar select:focus, .inline-input:focus { border-color: var(--sage); box-shadow: 0 0 0 4px rgba(120, 150, 138, .14); }
.password-control { display: flex; align-items: center; min-height: 46px; border: 1px solid #cfc9bc; border-radius: 12px; background: white; }
.password-control:focus-within { border-color: var(--sage); box-shadow: 0 0 0 4px rgba(120, 150, 138, .14); }
.password-control input { flex: 1; width: 100%; min-width: 0; min-height: 44px; padding: 11px 13px; border: 0; border-radius: 11px 0 0 11px; background: transparent; outline: none; }
.password-control input:focus { border-color: transparent; box-shadow: none; }
.password-toggle { flex: 0 0 44px; display: grid; width: 44px; height: 44px; place-items: center; padding: 0; border: 0; border-radius: 0 11px 11px 0; color: var(--sage-dark); background: transparent; }
.password-toggle:hover { background: #e8f0ec; }
.password-toggle:focus-visible { outline: 3px solid rgba(120, 150, 138, .45); outline-offset: -3px; }
.password-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.field input:disabled { color: var(--muted); background: #f1efe9; }
.check-field { display: flex; gap: 10px; align-items: flex-start; font-weight: 650; }
.check-field input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--sage-dark); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.span-two { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.notice { padding: 12px 14px; border-radius: 12px; background: #e8f0ec; color: #294c42; }
.notice.error { background: #fae7e3; color: #7e2f29; }
.notice.warning { background: #fbefd7; color: #72531b; }

.portal-shell { min-height: calc(100vh - 76px); display: grid; grid-template-columns: 265px minmax(0, 1fr); }
.portal-sidebar {
  padding: 28px 18px;
  color: #f7f4ed;
  background: #294c42;
  position: sticky;
  top: 76px;
  height: calc(100vh - 76px);
  overflow-y: auto;
}
.portal-sidebar h2 { padding: 0 10px; font-size: 1.3rem; }
.portal-nav { display: grid; gap: 7px; margin-top: 22px; }
.portal-nav button, .portal-nav a {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 13px;
  border: 0;
  border-radius: 12px;
  color: inherit;
  background: transparent;
  text-align: left;
  text-decoration: none;
}
.portal-nav button:hover, .portal-nav a:hover, .portal-nav .active { background: rgba(255, 255, 255, .14); }
.portal-nav .logout { margin-top: 18px; color: #ffd9d2; }
.portal-main { min-width: 0; padding: clamp(24px, 4vw, 58px); }
.portal-main > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.portal-main > header h1 { margin-bottom: 5px; }
.mobile-menu { display: none; }

.panel { padding: clamp(20px, 3vw, 32px); background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(43, 61, 55, .06); }
.panel + .panel { margin-top: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-head h2 { margin: 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); gap: 16px; }
.data-card { padding: 18px; border: 1px solid var(--border); border-radius: 16px; background: white; }
.data-card h3 { display: flex; justify-content: space-between; gap: 12px; }
.data-card p { margin: 5px 0; }
.data-card footer { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.empty { padding: 36px 20px; border: 1px dashed #c9c1b3; border-radius: 16px; text-align: center; color: var(--muted); }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.summary-card { padding: 18px; border-radius: 16px; color: white; background: var(--sage-dark); }
.summary-card:nth-child(2) { background: var(--terracotta); }
.summary-card:nth-child(3) { background: #6c7d9b; }
.summary-card:nth-child(4) { background: #6c675d; }
.summary-card strong { display: block; font: 2rem Georgia, serif; }
.summary-card span { opacity: .86; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tabs button { padding: 9px 14px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); background: white; font-weight: 750; }
.tabs button.active { color: white; border-color: var(--sage-dark); background: var(--sage-dark); }
.status { display: inline-flex; align-items: center; width: fit-content; padding: 5px 9px; border-radius: 999px; color: #555; background: #ece9e2; font-size: .82rem; font-weight: 800; }
.status.pending, .status.manual_review { color: #73530d; background: #f7e7b7; }
.status.accepted { color: #245247; background: #d8ece5; }
.status.refused, .status.cancelled { color: #7e2f29; background: #f6dcd6; }
.status.in_progress { color: #284b75; background: #dbe8f6; }
.status.completed { color: #464646; background: #dedede; }
.reservation-card { display: grid; grid-template-columns: minmax(200px, 1.4fr) minmax(160px, .8fr) auto; gap: 18px; align-items: center; padding: 18px; border: 1px solid var(--border); border-radius: 16px; background: white; }
.reservation-card + .reservation-card { margin-top: 12px; }
.reservation-card p, .reservation-card small { display: block; margin: 3px 0; }
.money { font-weight: 850; white-space: nowrap; }

.toolbar { display: grid; grid-template-columns: minmax(200px, 1fr) auto auto; gap: 10px; margin-bottom: 18px; }
.list-table { overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: white; }
.list-row { display: grid; grid-template-columns: minmax(220px, 1.2fr) minmax(160px, .7fr) minmax(150px, .7fr) auto; gap: 15px; align-items: center; padding: 15px 17px; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-row small { display: block; color: var(--muted); }
.list-row button { justify-self: end; }

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(27, 42, 37, .56);
}
.dialog {
  width: min(760px, 100%);
  max-height: 92vh;
  overflow: auto;
  padding: clamp(20px, 4vw, 34px);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .25);
}
.dialog.wide { width: min(1050px, 100%); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.dialog-head h2 { margin: 0; }
.detail-section { padding: 18px 0; border-top: 1px solid var(--border); }
.detail-section:first-of-type { border-top: 0; }
.detail-section dl { display: grid; grid-template-columns: 180px 1fr; gap: 6px 14px; }
.detail-section dt { color: var(--muted); font-weight: 700; }
.detail-section dd { margin: 0; white-space: pre-wrap; }
.admin-editor { display: grid; gap: 14px; }
.admin-editor article { padding: 16px; border: 1px solid var(--border); border-radius: 15px; background: white; }
.admin-editor .row { display: grid; grid-template-columns: 1fr 140px 140px; gap: 10px; align-items: end; }
.danger-zone { margin-top: 20px; padding: 18px; border: 1px solid #e3bab5; border-radius: 16px; background: #fff7f5; }
.danger-zone .form-actions { margin-top: 12px; }
.cancellation-request { margin-top:12px; padding:10px 12px; border-left:4px solid #a466aa; border-radius:9px; background:#f2e8f4; color:#653d69; font-size:.9rem; }

.legal-main { width: min(960px, calc(100% - 36px)); margin: 44px auto 80px; }
.legal-main .panel { margin-bottom: 18px; }
.legal-main li + li { margin-top: 8px; }
.legal-callout { padding: 18px; border-left: 5px solid var(--terracotta); border-radius: 0 14px 14px 0; background: #fff5ed; }
.site-footer { padding: 30px 18px; color: #e9eee9; background: #294c42; text-align: center; }

.loading { min-height: 45vh; display: grid; place-items: center; color: var(--muted); }
.loading::before { content: ""; width: 36px; height: 36px; border: 4px solid #d8d4ca; border-top-color: var(--sage-dark); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1050px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .reservation-card { grid-template-columns: 1fr 1fr; }
  .reservation-card > :last-child { grid-column: 1 / -1; }
  .list-row { grid-template-columns: 1fr 1fr auto; }
  .list-row > :nth-child(3) { display: none; }
}

@media (max-width: 780px) {
  .portal-topbar { position: relative; min-height: 68px; padding: 8px 14px; }
  .portal-brand img { width: 46px; height: 46px; }
  .portal-topbar nav .hide-mobile { display: none; }
  .portal-shell { display: block; }
  .portal-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(84vw, 310px); height: 100vh; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 15px 0 50px rgba(0, 0, 0, .25); }
  .portal-sidebar.open { transform: translateX(0); }
  .mobile-menu { display: inline-flex; }
  .portal-main { padding: 24px 15px 50px; }
  .portal-main > header { align-items: center; }
  .form-grid, .summary-grid { grid-template-columns: 1fr; }
  .reservation-card, .list-row { grid-template-columns: 1fr; }
  .reservation-card > :last-child { grid-column: auto; }
  .list-row > :nth-child(3) { display: block; }
  .list-row button { justify-self: start; }
  .toolbar { grid-template-columns: 1fr; }
  .detail-section dl { grid-template-columns: 1fr; }
  .detail-section dd { margin-bottom: 8px; }
  .admin-editor .row { grid-template-columns: 1fr; }
}

/* Intégration espace client — la navigation publique reste le point d’entrée
   principal, tandis que le portail conserve sa navigation secondaire. */
body.client-portal-route > .site-header,
body.client-portal-route > .full-footer,
body.client-portal-route > .skip-link {
  display: revert !important;
}
body.client-portal-route > .site-header { display: flex !important; }
body.client-portal-route > .full-footer { display: grid !important; }
body.client-portal-route > #main-content { display: block !important; }
body.client-portal-route .client-reference-page { display: block !important; }
body.client-portal-route .client-reference-page > .portal-topbar { display: none !important; }

body.client-portal-route > .site-header {
  position: relative;
  z-index: 50;
}
body.client-portal-route > .full-footer {
  position: relative;
  z-index: 1;
}

.client-reference-page {
  color: var(--ink);
  background:
    radial-gradient(circle at 96% 0%, rgba(244, 218, 207, .48), transparent 28rem),
    #fbf5ec;
}
.client-reference-page .auth-page {
  min-height: min(760px, calc(100vh - 80px));
  padding: clamp(42px, 7vw, 84px) 18px;
  background: transparent;
}
.client-reference-page .auth-card {
  width: min(100%, 720px);
  border-color: rgba(62, 85, 126, .2);
  border-radius: 28px;
  box-shadow: 0 24px 70px rgba(62, 85, 126, .12);
}
.client-reference-page .auth-card .eyebrow { color: var(--terracotta); }
.client-reference-page .auth-card h1 { color: var(--ink); }
.client-reference-page .auth-switch {
  background: #f3e7de;
}
.client-reference-page .auth-switch button.active {
  color: var(--ink);
  box-shadow: 0 5px 16px rgba(62, 85, 126, .12);
}
.client-reference-page .field input,
.client-reference-page .field textarea,
.client-reference-page .field select,
.client-reference-page .password-control {
  border-color: rgba(62, 85, 126, .24);
}
.client-reference-page .field input:focus,
.client-reference-page .field textarea:focus,
.client-reference-page .field select:focus,
.client-reference-page .password-control:focus-within {
  border-color: var(--sage-dark);
  box-shadow: 0 0 0 4px rgba(62, 85, 126, .13);
}
.client-reference-page .button-primary,
.client-reference-page .portal-nav .active {
  background: var(--sage-dark);
}

.client-reference-page .portal-shell {
  min-height: calc(100vh - 80px);
  grid-template-columns: 190px minmax(0, 1fr);
  background: transparent;
}
.client-reference-page .portal-sidebar {
  top: 0;
  height: auto;
  min-height: calc(100vh - 80px);
  position: relative;
  overflow-x: hidden;
  padding: 22px 12px;
  color: #fffaf3;
  background: var(--sage-dark);
  box-shadow: inset -1px 0 rgba(255, 255, 255, .08);
}
.client-reference-page .portal-sidebar h2 { color: #fffaf3; }
.client-reference-page .portal-nav { margin-top: 20px; }
.client-reference-page .portal-nav button,
.client-reference-page .portal-nav a { min-height: 44px; }
.client-reference-page .portal-nav button:hover,
.client-reference-page .portal-nav a:hover,
.client-reference-page .portal-nav .active {
  background: rgba(255, 255, 255, .16);
}
.client-reference-page .portal-nav .logout {
  color: #ffd9d2;
  border-top: 1px solid rgba(255, 255, 255, .15);
  border-radius: 0;
  padding-top: 18px;
}
.client-reference-page .portal-main {
  max-width: 1360px;
  padding: clamp(28px, 5vw, 64px);
}
.client-reference-page .portal-main > header {
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(62, 85, 126, .14);
}
.client-reference-page .portal-main > header .eyebrow { color: var(--terracotta); }
.client-reference-page .panel,
.client-reference-page .data-card,
.client-reference-page .reservation-card,
.client-reference-page .list-table {
  border-color: rgba(62, 85, 126, .18);
  box-shadow: 0 12px 30px rgba(62, 85, 126, .06);
}
.client-reference-page .panel { background: rgba(255, 253, 248, .9); }
.client-reference-page .data-card,
.client-reference-page .reservation-card,
.client-reference-page .list-table { background: #fffdf8; }

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.dashboard-card {
  display: flex;
  min-height: 170px;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border: 1px solid rgba(62, 85, 126, .16);
  border-radius: 20px;
  background: #fffdf8;
  box-shadow: 0 12px 30px rgba(62, 85, 126, .06);
}
.dashboard-card h2,
.dashboard-card h3,
.dashboard-card p { margin-top: 0; }
.dashboard-card h2 { margin-bottom: 8px; }
.dashboard-card h3 { margin-bottom: 8px; }
.dashboard-card p { margin-bottom: 0; }
.dashboard-card--next { grid-column: span 7; background: linear-gradient(135deg, #3e557e, #526c98); color: #fffaf3; }
.dashboard-card--next h2,
.dashboard-card--next h3,
.dashboard-card--next .dashboard-value { color: #fffaf3 !important; }
.dashboard-card--next .eyebrow,
.dashboard-card--next .muted { color: rgba(255, 250, 243, .8); }
.dashboard-card--action { grid-column: span 5; background: #f4ddd5; }
.dashboard-card--stat { grid-column: span 4; min-height: 150px; }
.dashboard-card--stat .dashboard-value { color: var(--sage-dark); font: 2.25rem/1 Georgia, serif; }
.dashboard-card--next .dashboard-value { font: 1.35rem/1.25 Georgia, serif; }
.dashboard-card .button { align-self: flex-start; }
.dashboard-card--next .button { color: var(--sage-dark); background: #fffaf3; }

@media (min-width: 1200px) {
  body.client-portal-route > .site-header .menu-button { display: none !important; }
  body.client-portal-route > .site-header nav,
  body.client-portal-route > .site-header nav.open {
    display: flex !important;
    position: static;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }
  body.client-portal-route > .site-header nav a {
    display: inline !important;
    min-height: 0;
    padding: 0;
  }
}

@media (max-width: 780px) {
  body.client-portal-route .client-reference-page > .portal-topbar:has(.mobile-menu) {
    display: flex !important;
    min-height: 56px;
    padding: 6px 15px;
    border: 0;
    background: transparent;
    backdrop-filter: none;
  }
  .client-reference-page > .portal-topbar:has(.mobile-menu) .portal-brand,
  .client-reference-page > .portal-topbar:has(.mobile-menu) nav { display: none; }
  .client-reference-page > .portal-topbar:has(.mobile-menu) .mobile-menu {
    display: inline-flex;
    width: auto;
    min-width: 88px;
    padding: 0 13px;
    border-radius: 999px;
    font-size: 0;
    color: var(--sage-dark);
    background: #fffdf8;
  }
  .client-reference-page > .portal-topbar:has(.mobile-menu) .mobile-menu::before {
    content: "☰";
    font-size: 17px;
    line-height: 1;
  }
  .client-reference-page > .portal-topbar:has(.mobile-menu) .mobile-menu::after {
    content: "Compte";
    font-size: 11px;
    font-weight: 800;
  }
  .client-reference-page .portal-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    top: 0;
    left: 0;
    height: 100vh;
    min-height: 100vh;
  }
  .client-reference-page .portal-main { padding: 28px 15px 50px; }
  .profile-addresses .panel-head { align-items: flex-start; flex-wrap: wrap; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-card--next,
  .dashboard-card--action,
  .dashboard-card--stat { grid-column: auto; min-height: 0; }
}

body.client-portal-route > .full-footer {
  min-height: 0 !important;
  height: auto !important;
  align-content: initial !important;
}

@media (max-width: 420px) {
  body.client-portal-route > .site-header .site-account-control::before {
    content: "Mon espace";
    font-size: 10px;
  }
}
