:root {
    --primary: #5A1E2B;
    --primary-light: #7E2A3C;
    --gold: #C5A059;
    --gold-light: #DFB86C;
    --bg-main: #FDFBF8;
    --bg-card: #FFFFFF;
    --text-main: #2C2A29;
    --text-muted: #6B6866;
    --border: #E8E2D9;
    
    --shadow-soft: 0 10px 30px rgba(44, 42, 41, 0.05);
    --shadow-hover: 0 15px 40px rgba(90, 30, 43, 0.1);
    --radius: 4px;
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Lato', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-body);
    color: var(--text-main);
    line-height: 1.7;
    background-color: var(--bg-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { 
    font-family: var(--font-heading); 
    color: var(--primary); 
    font-weight: 600; 
}

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.mt-3 { margin-top: 1rem; } .mt-4 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1.5rem; } .mx-auto { margin-left: auto; margin-right: auto; }
.text-right { text-align: right; }

.divider-gold {
    width: 60px;
    height: 2px;
    background-color: var(--gold);
    margin: 15px 0 20px 0;
}

/* Force le centrage horizontal quand mx-auto est présent */
.divider-gold.mx-auto, .mx-auto {
    margin-left: auto !important;
    margin-right: auto !important;
}

.gold-link { color: var(--gold); text-decoration: none; font-weight: 700; transition: color 0.3s; }
.gold-link:hover { color: var(--primary); }

/* Flash Info Banner */
.flash-banner {
    width: 100%;
    background-color: var(--primary);
    color: #ffffff;
    font-size: 0.9rem;
    padding: 10px 0;
    position: relative;
    z-index: 1001;
    border-bottom: 2px solid var(--gold);
    box-sizing: border-box;
}

.flash-banner.warning {
    background-color: #7E2A3C;
}

.flash-banner.alert {
    background-color: #8B1E1E;
}

.flash-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.flash-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
}

.flash-icon img {
    display: block;
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.flash-message {
    flex: 1;
    text-align: center;
    font-weight: 400;
    color: #ffffff;
}

.flash-link {
    color: var(--gold-light);
    font-weight: 700;
    text-decoration: underline;
    margin-left: 8px;
    transition: color 0.2s;
}

.flash-link:hover {
    color: #ffffff;
}

/* Header */
.site-header { 
    background: var(--bg-card); 
    border-bottom: 1px solid var(--border);
    position: sticky; 
    top: 0; 
    z-index: 1000; 
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}
.header-container { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 15px 20px; }
.site-header .header-container { max-width: 1180px; }
.logo { flex: 0 1 auto; min-width: 0; }
.logo a { display: flex; align-items: center; gap: 15px; text-decoration: none; color: var(--primary); }
.logo-img {
    width: 50px;
    height: 50px;
    object-fit: contain; /* Empêche l'image de se déformer */
}
.logo .logo-title { display: block; font-family: var(--font-heading); color: var(--primary); font-weight: 600; font-size: 2rem; margin: 0 0 5px; line-height: 1; letter-spacing: 1px; }
.logo .logo-subtitle { display: block; max-width: none; white-space: nowrap; font-size: 0.8rem; line-height: 1.35; color: var(--text-muted); font-family: var(--font-body); text-transform: uppercase; letter-spacing: 1px; }

.main-nav { flex: 0 0 auto; }
.main-nav .nav-links { list-style: none; display: flex; align-items: center; gap: 30px; }
.main-nav a { 
    text-decoration: none; 
    color: var(--text-muted); 
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s; 
    padding-bottom: 5px;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.main-nav a:hover, .main-nav a.active { color: var(--primary); border-bottom-color: var(--gold); }
.menu-toggle { display: none; }

/* Main Content */
.site-content { flex: 1; }

/* Buttons */
.btn { 
    display: inline-block; padding: 12px 28px; 
    border-radius: var(--radius); text-decoration: none; 
    font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px;
    transition: all 0.3s ease; text-align: center; border: 1px solid transparent; 
}
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--primary); }
.btn-outline-primary { border-color: var(--primary); color: var(--primary); background: transparent; }
.btn-outline-primary:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Hero Section */
.hero {
    position: relative;
    overflow: hidden;
    background: url('../img/hero-vignoble.webp') no-repeat center center;
    background-color: var(--primary);
    background-size: cover;
    color: #fff;
    text-align: center;
    padding: 100px 20px;
}

/*
 * Couche de transition utilisée par l'easter-egg.
 * L'image alternative est placée dans ::before afin de pouvoir
 * faire varier son opacité sans tenter d'animer background-image.
 */
.hero::before,
.page-header::before {
    content: "";
    position: absolute;
    inset: 0;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    opacity: 0;
    transition: opacity 900ms ease-in-out;
    pointer-events: none;
    z-index: 1;
}

.hero.easter-egg-active::before {
    background-image: url('../img/hero-vignoble-white.webp');
}

.hero.easter-egg-active::before,
.page-header.easter-egg-active::before {
    opacity: 1;
}

.hero-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(rgba(44, 42, 41, 0.7), rgba(90, 30, 43, 0.85));
    z-index: 2;
}

.hero-content { position: relative; z-index: 10; display: flex; flex-direction: column; align-items: center; }
.hero-subtitle { font-family: var(--font-body); text-transform: uppercase; letter-spacing: 3px; color: var(--gold); font-size: 0.9rem; margin-bottom: 10px; }
.hero h1 { color: #fff; font-size: 3.5rem; margin-bottom: 10px; font-weight: 400; line-height: 1.2; }
.hero p { font-size: 1.1rem; max-width: 600px; color: #f0f0f0; }

/* Home Alerts */
.home-alerts { margin-top: 20px; position: relative; z-index: 20; }
.alert-box { 
    background: var(--bg-card); 
    border-radius: var(--radius); 
    padding: 40px; 
    box-shadow: var(--shadow-soft); 
    border-top: 4px solid var(--gold);
    text-align: center;
}
.alert-label { display: inline-block; background: var(--bg-main); color: var(--primary); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 2px; padding: 4px 12px; border: 1px solid var(--border); margin-bottom: 15px; }
.alert-meta { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 20px; }
.dates-wrapper { display: flex; justify-content: center; flex-wrap: wrap; gap: 15px; margin: 20px 0; }
.date-badge { 
    border: 1px solid var(--gold); 
    color: var(--primary); 
    padding: 8px 20px; 
    font-weight: 700;
    font-size: 1.1rem;
    background: #fff;
    box-shadow: 0 2px 5px rgba(197, 160, 89, 0.1);
}
.reminder { font-family: var(--font-heading); font-style: italic; color: var(--primary-light); font-size: 1.1rem; border-top: 1px solid var(--border); padding-top: 20px; margin-top: 20px; }

/* Grid */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }

/* Cards */
.quick-links { padding: 45px 20px 80px; }
.elegant-card { 
    background: var(--bg-card); 
    padding: 50px 40px; 
    border: 1px solid var(--border);
    text-align: center; 
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.elegant-card:hover { 
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--gold-light);
}
.card-icon { font-size: 3rem; margin-bottom: 20px; opacity: 0.8; }
.elegant-card h3 { font-size: 1.6rem; margin-bottom: 15px; }
.elegant-card p { margin-bottom: 30px; color: var(--text-muted); }

/* Style de base des entêtes de page */
.page-header {
    position: relative;
    overflow: hidden;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    background-color: var(--primary);
    padding: 60px 20px;
    margin-bottom: 0;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

/* Alignement typographique strict avec la page d'accueil */
.page-header h1 { 
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff; 
    margin-bottom: 10px; 
}

.page-header p { 
    font-family: var(--font-body);
    font-size: 1.1rem;
    color: #e0e0e0; 
    font-weight: 400;
}

/* Image spécifique pour chaque page avec le filtre sombre */
.page-header.header-plans {
    background-image: linear-gradient(rgba(44, 42, 41, 0.75), rgba(90, 30, 43, 0.85)), url('../img/header-plans.webp');
}

.page-header.header-docs {
    background-image: linear-gradient(rgba(44, 42, 41, 0.75), rgba(90, 30, 43, 0.85)), url('../img/header-docs.webp');
}

.page-header.header-contact {
    background-image: linear-gradient(rgba(44, 42, 41, 0.75), rgba(90, 30, 43, 0.85)), url('../img/header-contact.webp');
}

/* Les contenus restent au-dessus de la couche d'image alternative. */
.page-header > .container {
    position: relative;
    z-index: 10;
}

/* Images alternatives utilisées par l'easter-egg, avec le même filtre visuel. */
.page-header.header-plans.easter-egg-active::before {
    background-image: linear-gradient(rgba(44, 42, 41, 0.75), rgba(90, 30, 43, 0.85)), url('../img/header-plans-white.webp');
}

.page-header.header-docs.easter-egg-active::before {
    background-image: linear-gradient(rgba(44, 42, 41, 0.75), rgba(90, 30, 43, 0.85)), url('../img/header-docs-white.webp');
}

.page-header.header-contact.easter-egg-active::before {
    background-image: linear-gradient(rgba(44, 42, 41, 0.75), rgba(90, 30, 43, 0.85)), url('../img/header-contact-white.webp');
}

/* Editorial context added for clarity and search understanding */
.home-intro {
    position: relative;
    z-index: 30;
    margin-top: -58px;
    padding: 0 20px 15px;
}
.home-intro__content,
.page-intro {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #ffffff 0%, #ffffff 76%, #faf6ee 100%);
    border: 1px solid var(--border);
    border-radius: 7px;
    box-shadow: 0 12px 34px rgba(44, 42, 41, 0.06);
}
.home-intro__content {
    max-width: 1060px;
    margin-left: auto;
    margin-right: auto;
    padding: 38px 42px 36px;
}
.page-intro {
    width: 100%;
    max-width: none;
    margin: 0 0 38px;
    padding: 31px 34px 29px;
}

/* Les trois encadrés éditoriaux des pages secondaires mordent sur leur image d’en-tête, comme celui de l’accueil. */
.page-header.header-plans + .page-section,
.page-header.header-docs + .page-section,
.page-header.header-contact + .page-section {
    position: relative;
    z-index: 30;
    margin-top: -58px;
}

/* Les pages de déclaration ne doivent pas hériter du chevauchement des encadrés éditoriaux. */
.declaration-page {
    padding-top: 42px;
}
.home-intro__kicker,
.page-intro__kicker {
    display: inline-block;
    position: relative;
    z-index: 1;
    margin-bottom: 7px;
    color: var(--gold);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
}
.home-intro h2,
.page-intro h2 {
    position: relative;
    z-index: 1;
    line-height: 1.25;
}
.home-intro h2 { font-size: 2rem; margin-bottom: 18px; }
.page-intro h2 { font-size: 1.55rem; margin-bottom: 15px; }
.home-intro p,
.page-intro p {
    position: relative;
    z-index: 1;
    max-width: 920px;
    color: var(--text-muted);
    margin-bottom: 14px;
}
.home-intro p:last-child,
.page-intro p:last-child { margin-bottom: 0; }

.mentions-legales h2 { font-size: 1.17em; }

/* Tables */
.page-section { margin-bottom: 80px; }
.table-container { background: var(--bg-card); border: 1px solid var(--border); box-shadow: var(--shadow-soft); }
.elegant-table { width: 100%; border-collapse: collapse; }
.elegant-table th, .elegant-table td { padding: 20px; border-bottom: 1px solid var(--border); }
.elegant-table th { background: var(--bg-main); font-family: var(--font-heading); font-size: 1.1rem; font-weight: 600; color: var(--primary); text-align: left; }
.elegant-table tr:hover { background: #faf8f5; }
.appellation-name { font-weight: 700; color: var(--text-main); font-size: 1.05rem; }
.version-badge { background: var(--bg-main); border: 1px solid var(--border); padding: 4px 10px; font-size: 0.85rem; color: var(--text-muted); font-family: monospace; }
.btn-download { color: var(--gold); text-decoration: none; font-weight: 700; text-transform: uppercase; font-size: 0.85rem; letter-spacing: 1px; transition: color 0.3s; }
.btn-download:hover { color: var(--primary); }

/* Document Lists */
.doc-card, .contact-card { background: var(--bg-card); padding: 40px; border: 1px solid var(--border); }
.doc-card.full-width { grid-column: 1 / -1; }
.doc-card h2, .contact-card h2, .contact-card h3 { font-size: 1.5rem; border-bottom: 1px solid var(--border); padding-bottom: 15px; margin-bottom: 25px; }
.note { font-style: italic; color: var(--text-muted); margin-bottom: 20px; }
.note a { color: var(--primary); font-weight: bold; }

.elegant-list { list-style: none; }
.elegant-list li { margin-bottom: 15px; position: relative; padding-left: 20px; }
.elegant-list li::before { content: "•"; color: var(--gold); position: absolute; left: 0; font-size: 1.2rem; top: -2px; }
.elegant-list a { color: var(--text-main); text-decoration: none; transition: color 0.3s; }
.elegant-list a:hover { color: var(--primary); }

.mentions-legales { background: transparent; border-top: 1px solid var(--border); padding-top: 40px; font-size: 0.9rem; color: var(--text-muted); }

/* Footer */
.site-footer { background: var(--text-main); color: #fff; padding-top: 60px; margin-top: auto; border-top: 4px solid var(--primary); }
.footer-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; margin-bottom: 40px; }
.footer-col h3 { color: var(--gold); font-size: 1.3rem; margin-bottom: 20px; }
.footer-col p { margin-bottom: 10px; color: #d0d0d0; }

/* Liens standard dans le footer */
.footer-col a:not(.btn-link) { 
    color: #fff; 
    text-decoration: none; 
    transition: color 0.3s; 
    border-bottom: 1px solid transparent; 
}
.footer-col a:not(.btn-link):hover { 
    color: var(--gold); 
    border-bottom-color: var(--gold); 
}

/* Bouton spécifique dans le footer (Fix de la bordure du bas) */
.footer-col a.btn-link, .btn-link { 
    display: inline-block; 
    margin-top: 15px; 
    padding: 10px 18px; 
    border: 1px solid var(--gold) !important; 
    font-size: 0.85rem; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    color: var(--gold) !important; 
    text-decoration: none;
    transition: all 0.3s ease;
    box-sizing: border-box;
}
.footer-col a.btn-link:hover, .btn-link:hover { 
    background: var(--gold); 
    color: var(--text-main) !important; 
    border-color: var(--gold) !important;
}

.footer-bottom { background: #22201f; padding: 20px 0; text-align: center; font-size: 0.85rem; color: #888; }
.footer-bottom a { color: #aaa; text-decoration: none; }

/* Navigation: bascule avant que les libellés du menu ne puissent se chevaucher */
@media (max-width: 1120px) {
    .header-container { padding: 10px 15px; }

    .menu-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 1.6rem;
        color: var(--primary);
        cursor: pointer;
        padding: 5px;
        line-height: 1;
    }

    .main-nav .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--bg-card);
        flex-direction: column;
        align-items: stretch;
        padding: 0;
        gap: 0;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
        border-bottom: 3px solid var(--gold);
        z-index: 999;
    }

    .main-nav .nav-links.active { display: flex; }
    .main-nav .nav-links li { width: 100%; border-bottom: 1px solid var(--border); }
    .main-nav .nav-links li:last-child { border-bottom: none; }
    .main-nav a { display: block; padding: 12px 20px; font-size: 0.9rem; border-bottom: none !important; }
}

/* Responsive Mobile Toggle Overlay */
@media (max-width: 768px) {
    .flash-banner { padding: 12px 0; }
    .flash-container { padding: 0 15px; }
    .flash-message { font-size: 0.825rem; text-align: left; line-height: 1.35; }
    .header-container { padding: 10px 15px; }
    .logo .logo-title { font-size: 1.3rem; }
    .logo .logo-subtitle { display: none; }

    .menu-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 1.6rem;
        color: var(--primary);
        cursor: pointer;
        padding: 5px;
        line-height: 1;
    }

    .main-nav .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--bg-card);
        flex-direction: column;
        padding: 0;
        gap: 0;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
        border-bottom: 3px solid var(--gold);
        z-index: 999;
    }

    .main-nav .nav-links.active {
        display: flex;
    }

    .main-nav .nav-links li {
        width: 100%;
        border-bottom: 1px solid var(--border);
    }

    .main-nav .nav-links li:last-child {
        border-bottom: none;
    }

    .main-nav a {
        display: block;
        padding: 12px 20px;
        font-size: 0.9rem;
        border-bottom: none !important;
    }

    .home-intro { margin-top: -28px; padding: 0 15px 8px; }
    .home-intro__content { padding: 29px 22px 25px; }
    .home-intro h2 { font-size: 1.55rem; }
    .page-intro { padding: 26px 20px 23px; margin-bottom: 28px; }
    .page-header.header-plans + .page-section,
    .page-header.header-docs + .page-section,
    .page-header.header-contact + .page-section { margin-top: -28px; }
    .declaration-page { padding-top: 28px; }
    .page-intro h2 { font-size: 1.35rem; margin-bottom: 13px; }
    .hero { padding: 40px 15px; }
    .hero h1 { font-size: 1.8rem; }
    .page-header { padding: 35px 15px; margin-bottom: 0; }
    .page-header h1 { font-size: 1.6rem; }
    .page-header p { font-size: 0.95rem; line-height: 1.4; }
    .grid-2 { grid-template-columns: 1fr; gap: 20px; }
    .alert-box { padding: 20px 15px; }
    .elegant-card { padding: 30px 20px; }
    .elegant-table th, .elegant-table td { padding: 10px; font-size: 0.9rem; }
    .hero { padding: 40px 15px 50px 15px; }
    .home-alerts { margin-top: 22px; }
    .quick-links { padding: 32px 15px 55px; }
}

/* Accessibilité : respecter la préférence utilisateur pour réduire les animations. */
@media (prefers-reduced-motion: reduce) {
    .hero::before,
    .page-header::before {
        transition: none;
    }
}

@media (max-width: 768px) {
  .date-calendar-trigger {
    appearance:none; -webkit-appearance:none; border:0; cursor:pointer;
    font:inherit; color:inherit;
  }
  .calendar-modal { position:fixed; inset:0; z-index:9999; display:none; }
  .calendar-modal.is-open { display:block; }
  .calendar-modal__backdrop { position:absolute; inset:0; background:rgba(0,0,0,.55); }
  .calendar-modal__panel {
    position:absolute; left:16px; right:16px; bottom:16px;
    background:#fff; border-radius:16px; padding:24px;
    box-shadow:0 12px 40px rgba(0,0,0,.25);
  }
  .calendar-modal__close {
    position:absolute; top:8px; right:12px; border:0; background:transparent;
    font-size:30px; line-height:1; color:#555;
  }
  .calendar-modal__add {
    width:100%; margin-top:18px; padding:13px 16px;
    border:0; border-radius:8px; font:inherit; font-weight:700;
  }
}


@media (min-width: 769px) {
  .date-calendar-trigger {
    cursor: default;
    pointer-events: none;
  }

  .calendar-modal {
    display: none !important;
  }
}

/* Déclaration de conditionnement */
.declaration-page-header {
    background-image: linear-gradient(rgba(44, 42, 41, 0.78), rgba(90, 30, 43, 0.88)), url('../img/header-docs.webp');
}
.declaration-page { max-width: 1100px; }
.form-kicker, .section-eyebrow {
    display: inline-block;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.76rem;
    font-weight: 700;
}
.form-kicker { margin-bottom: 8px; }
.declaration-intro {
    display: flex;
    justify-content: space-between;
    gap: 25px;
    align-items: center;
    margin-bottom: 30px;
}
.declaration-intro h2 { font-size: 1.9rem; margin: 3px 0 5px; }
.declaration-intro p { color: var(--text-muted); margin: 0; }
.form-stepper {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.form-stepper__item {
    flex: 1 1 0;
    min-width: 130px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    font: inherit;
    cursor: pointer;
}
.form-stepper__item span {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    background: #fff;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 700;
}
.form-stepper__item strong { font-size: 0.78rem; font-weight: 700; }
.form-stepper__item.is-active { color: var(--primary); }
.form-stepper__item.is-active span { border-color: var(--gold); background: var(--gold); color: #fff; }
.form-stepper__item.is-complete span { background: var(--primary); border-color: var(--primary); color: #fff; }
.form-stepper__line { height: 1px; background: var(--border); flex: 0 0 40px; }
.declaration-form { background: transparent; }
.form-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    padding: 32px;
}
.form-panel[hidden] { display: none; }
.form-panel__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 18px;
    margin-bottom: 24px;
}
.form-panel__header h3 { font-size: 1.5rem; margin-top: 3px; }
.required-hint { color: var(--text-muted); font-size: 0.8rem; }
.required-hint span, .field label span, .form-block__label > span[aria-hidden="true"] { color: var(--primary); }
.form-grid { display: grid; gap: 18px; margin-bottom: 22px; }
.form-grid--two { grid-template-columns: 1.5fr 1fr; }
.form-grid--contact { grid-template-columns: minmax(220px, .7fr) minmax(0, 1.3fr); }
.field--telephone { min-width: 0; }
.field--email { min-width: 0; }
.form-grid--four { grid-template-columns: repeat(4, 1fr); }
.field--wide { grid-column: span 1; }
.field--small { max-width: 180px; }
.field label { display: block; margin-bottom: 7px; color: var(--text-main); font-size: 0.84rem; font-weight: 700; }
.field input, .date-declaration-input {
    width: 100%;
    min-height: 46px;
    padding: 10px 13px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-main);
    font: inherit;
    border-radius: var(--radius);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .date-declaration-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(197,160,89,.12); }
.field input:invalid:not(:placeholder-shown) { border-color: #a43e3e; }
.field small { color: var(--text-muted); font-size: 0.72rem; }
.source-note { color: var(--text-muted); background: #faf8f5; border-left: 3px solid var(--gold); padding: 11px 13px; font-size: 0.78rem; line-height: 1.6; }
.form-helper { color: var(--text-muted); margin: -10px 0 20px; font-size: 0.9rem; }
.text-button { border: 0; background: none; color: var(--primary); font: inherit; font-weight: 700; cursor: pointer; }
.text-button:hover { color: var(--gold); }
.form-feedback { min-height: 1px; }
.lot-table-wrap { overflow: visible; border: 0; padding-left: 38px; }
.lot-table { width: 100%; min-width: 0; table-layout: fixed; border-collapse: collapse; }
.lot-table th, .lot-table td { border: 1px solid var(--border); border-bottom: 0; padding: 8px; vertical-align: top; overflow-wrap: anywhere; word-break: break-word; }
.lot-table th:last-child, .lot-table td:last-child { border-right: 1px solid var(--border); }
.lot-table tr:last-child td { border-bottom: 1px solid var(--border); }
.lot-table th { background: #faf8f5; color: var(--primary); font-family: var(--font-heading); font-size: .8rem; font-weight: 600; text-align: left; line-height: 1.35; }
.lot-table td { background: #fff; }
.lot-table th:nth-child(1), .lot-table td:nth-child(1) { width: 10%; }
.lot-table th:nth-child(2), .lot-table td:nth-child(2) { width: 9%; }
.lot-table th:nth-child(3), .lot-table td:nth-child(3) { width: 11%; }
.lot-table th:nth-child(4), .lot-table td:nth-child(4) { width: 12%; }
.lot-table th:nth-child(5), .lot-table td:nth-child(5) { width: 10%; }
.lot-table th:nth-child(6), .lot-table td:nth-child(6) { width: 18%; }
.lot-table th:nth-child(7), .lot-table td:nth-child(7) { width: 14%; }
.lot-table th:nth-child(8), .lot-table td:nth-child(8) { width: 16%; }
.lot-table input { width: 100%; min-width: 0; box-sizing: border-box; min-height: 42px; border: 1px solid transparent; padding: 8px; font: inherit; color: var(--text-main); background: transparent; }
.lot-table input:focus { border-color: var(--gold); background: #fff; outline: none; }
.lot-input--number { text-align: right; }
.lot-table td:first-child { position: relative; }
.remove-lot {
    position: absolute;
    left: -42px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border: 0;
    background: transparent;
    color: #b42318;
    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
}
.remove-lot:hover { color: #7b2e2e; }
.remove-lot:disabled { opacity: .28; cursor: not-allowed; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--border); background: #fff; color: var(--primary); font-size: 1.2rem; cursor: pointer; }
.icon-button:disabled { opacity: .3; cursor: not-allowed; }
.source-notes-grid { display: grid; grid-template-columns: 1fr 1.5fr; gap: 12px; margin-top: 16px; }
.form-block { border-top: 1px solid var(--border); padding-top: 20px; margin-top: 20px; }
.form-block__label { font-weight: 700; color: var(--text-main); margin-bottom: 12px; }
.form-block__hint { color: var(--text-muted); font-weight: 400; font-size: .82rem; }
.choice-row { display: flex; gap: 12px; flex-wrap: wrap; }
.choice-card { position: relative; cursor: pointer; }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-card__box { display: inline-flex; align-items: center; justify-content: center; min-width: 105px; min-height: 46px; padding: 8px 18px; border: 1px solid var(--border); background: #fff; color: var(--text-main); font-weight: 700; transition: all .2s; }
.choice-card input:checked + .choice-card__box { background: var(--primary); color: #fff; border-color: var(--primary); }
.choice-card input:focus-visible + .choice-card__box { outline: 3px solid rgba(197,160,89,.35); outline-offset: 2px; }
.signature-pad { border: 1px solid var(--border); background: #fff; }
.signature-pad canvas { display: block; width: 100%; height: 160px; touch-action: none; cursor: crosshair; background: linear-gradient(to bottom, transparent 93%, #eee8df 93%, #eee8df 94%, transparent 94%); }
.signature-pad__toolbar { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 9px 12px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: .76rem; }
.date-declaration-input { max-width: 260px; }
.form-navigation { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.form-navigation__spacer { flex: 1; }
.generation-notice { background: #faf8f5; border: 1px solid var(--border); padding: 16px; margin-bottom: 18px; }
.generation-notice strong { color: var(--primary); }
.generation-notice p { color: var(--text-muted); margin: 3px 0 0; font-size: .86rem; }
.form-alert { padding: 13px 15px; margin-top: 14px; border-left: 4px solid; font-size: .86rem; }
.form-alert--error { background: #fff5f4; border-color: #a43e3e; color: #7b2e2e; }
.form-alert--success { background: #f3faf5; border-color: #548463; color: #365a40; }
.review-card { display: grid; gap: 16px; }
.review-card__group { border: 1px solid var(--border); background: #fff; padding: 16px; }
.review-card__group > strong { display: block; margin: 3px 0 5px; color: var(--primary); }
.review-card__group p { margin: 2px 0; color: var(--text-muted); font-size: .88rem; overflow-wrap: anywhere; }
.review-label { display: block; color: var(--gold); text-transform: uppercase; letter-spacing: 1px; font-size: .7rem; font-weight: 700; }
.review-card__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
.review-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; margin-top: 10px; }
.review-fields--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.review-field { min-width: 0; margin: 0 !important; }
.review-field--wide { grid-column: 1 / -1; }
.review-field > strong { color: var(--text-main); }
.review-field--identity .review-field__value { color: var(--primary); font-weight: 700; }
.review-lot { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); font-size: .83rem; }
.review-lot:first-of-type { border-top: 0; padding-top: 0; }
.review-lot__title { display: block; margin-bottom: 7px; color: var(--primary); font-size: .9rem; }
.review-lot .review-fields { margin-top: 7px; }
.review-subtitle { margin: 12px 0 6px; color: var(--primary); font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.review-table-wrap { width: 100%; overflow-x: auto; margin-top: 6px; }
.review-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .82rem; }
.review-table th, .review-table td { padding: 7px 9px; border: 1px solid var(--border); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.review-table th { background: #faf8f5; color: var(--primary); font-weight: 700; }
.review-table-wrap .eff-review-table { margin-top: 0; }
.review-card + .generation-notice { margin-top: 18px; }
.doc-online-badge { display: inline-block; margin-left: 8px; padding: 3px 7px; border: 1px solid var(--gold); color: var(--primary); font-size: .68rem; text-transform: uppercase; letter-spacing: .7px; }

@media (max-width: 768px) {
    .declaration-intro { align-items: flex-start; flex-direction: column; margin-bottom: 20px; }
    .declaration-intro h2 { font-size: 1.55rem; }
    .form-stepper { gap: 6px; margin-right: -15px; padding-right: 15px; }
    .form-stepper__item { min-width: 104px; }
    .form-stepper__item strong { font-size: .7rem; }
    .form-stepper__line { flex-basis: 16px; }
    .form-panel { padding: 20px 16px; }
    .form-panel__header { flex-direction: column; gap: 8px; }
    .form-grid--two, .form-grid--contact, .form-grid--four { grid-template-columns: 1fr; }
    .field--small { max-width: none; }
    .source-notes-grid { grid-template-columns: 1fr; }
    .lot-table-wrap { overflow: visible; border: 0; padding-left: 0; }
    .lot-table, .lot-table tbody, .lot-table tr, .lot-table td { display: block; width: 100%; }
    .lot-table { min-width: 0; }
    .lot-table thead { display: none; }
    .lot-table tr { background: #fff; border: 1px solid var(--border); margin-bottom: 14px; padding: 8px; position: relative; }
    .lot-table td { border: 0; padding: 4px 0; display: grid; grid-template-columns: 42% 58%; align-items: center; }
    .lot-table td::before { content: attr(data-label); color: var(--primary); font-weight: 700; font-size: .75rem; padding-right: 7px; }
    .lot-table input { min-width: 0; border: 1px solid var(--border); background: #fff; }
    .remove-lot { left: -32px; top: 25px; transform: none; }
    .review-card__grid, .review-fields, .review-fields--three { grid-template-columns: 1fr; }
    .review-fields { gap: 6px; }
    .review-card .review-table { font-size: .76rem; }
    .review-card .review-table th, .review-card .review-table td { padding: 6px; }
    .form-navigation { flex-wrap: wrap; }
    .form-navigation__spacer { display: none; }
    .form-navigation .btn { flex: 1 1 46%; }
    .form-navigation .btn:only-child { flex-basis: 100%; }
    .form-navigation #prevStep { order: 1; }
    .form-navigation #nextStep, .form-navigation #generatePdf { order: 2; }
    .signature-pad canvas { height: 130px; }
    .doc-online-badge { display: block; width: fit-content; margin: 5px 0 0; }
}

/* Déclaration de conditionnement — ajustements UX */
.required-hint { color: #b42318; font-weight: 700; }
.required-hint span,
.field label span,
.form-block__label > span[aria-hidden="true"] { color: #b42318; }
    min-height: 72px;
    height: 72px;
    resize: none;
    padding: 10px 12px;
}
.lot-actions {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 24px;
    margin-bottom: 14px;
    text-align: right;
}
.btn-add-lot {
    display: inline-flex;
    width: auto;
    align-items: center;
    justify-content: center;
    padding-inline: 16px;
}
.confirm-modal[hidden] { display: none; }
.confirm-modal { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 20px; }
.confirm-modal__backdrop { position: absolute; inset: 0; background: rgba(26, 22, 20, .48); }
.confirm-modal__dialog { position: relative; width: min(520px, 100%); background: #fff; border: 1px solid var(--border); box-shadow: 0 18px 50px rgba(26, 22, 20, .2); padding: 28px; }
.confirm-modal__dialog h3 { color: var(--primary); margin: 0 0 10px; font-size: 1.35rem; }
.confirm-modal__dialog p { margin: 0; color: var(--text-muted); line-height: 1.6; }
.confirm-modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* Certification finale commune aux déclarations en ligne */
.certification-modal__dialog {
    width: min(660px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}
.certification-modal__intro {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.6;
}
.certification-modal__grid {
    display: grid;
    grid-template-columns: minmax(190px, .75fr) minmax(260px, 1.25fr);
    gap: 18px;
    margin-top: 20px;
}
.certification-modal__check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 50px;
    margin-top: 18px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    line-height: 1.4;
}
.certification-modal__check input {
    flex: 0 0 auto;
    width: 19px;
    height: 19px;
    margin: 0;
    accent-color: var(--primary);
}
.certification-modal__check input:focus-visible {
    outline: 3px solid rgba(197,160,89,.35);
    outline-offset: 3px;
}
.certification-modal__required { color: #b42318; font-weight: 700; }
.certification-modal__error { margin-top: 16px; }
.certification-modal__submit:disabled {
    background: #c9c6c2 !important;
    border-color: #c9c6c2 !important;
    color: #fff !important;
    cursor: not-allowed;
    opacity: .8;
    box-shadow: none;
    transform: none;
}
@media (max-width: 768px) {
    .lot-actions {
        justify-content: flex-end;
        margin-top: 20px;
    }
    .btn-add-lot { width: auto; }
    .confirm-modal__dialog { padding: 22px; }
    .confirm-modal__actions { flex-direction: column-reverse; }
    .confirm-modal__actions .btn { width: 100%; }
    .certification-modal__grid { grid-template-columns: 1fr; gap: 14px; }
    .certification-modal__check { align-items: flex-start; }
}
.required-star { color: #b42318; }

/* Description du lot — contenants */
.lot-card {
    position: relative;
    border: 1px solid var(--border);
    background: #fff;
    margin-bottom: 18px;
    box-shadow: var(--shadow-soft);
}
.lot-card__header {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    padding: 18px 20px;
    background: #faf8f5;
    border-bottom: 1px solid var(--border);
}
.lot-card__header .section-eyebrow { margin-bottom: 4px; }
.lot-card__title { margin: 0; color: var(--primary); font-size: 1.1rem; }
.remove-lot {
    position: static;
    transform: none;
    width: auto;
    height: auto;
    border: 1px solid #e3c0bc;
    background: #fff7f6;
    color: #9b3d36;
    font-size: .8rem;
    font-weight: 700;
    line-height: 1.2;
    padding: 8px 11px;
    border-radius: var(--radius);
}
.remove-lot:hover { color: #7b2e2e; background: #fff0ee; }
.remove-lot:disabled { opacity: .45; cursor: not-allowed; }
.lot-card__body { padding: 20px; }
.lot-common-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.lot-common-grid .field--wide { grid-column: 1 / -1; }
.color-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.color-badge {
    min-height: 42px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--text-main);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: border-color .2s, background-color .2s, color .2s, box-shadow .2s, transform .2s;
}
.color-badge:hover { transform: translateY(-1px); }
.color-badge:focus-visible { outline: 3px solid rgba(197,160,89,.35); outline-offset: 2px; }
.color-badge.is-active { box-shadow: 0 0 0 2px rgba(255,255,255,.95) inset, 0 0 0 2px currentColor; }
.color-badge--rouge { color: #8e2f3a; background: #fff1f3; border-color: #d9a0a9; }
.color-badge--rouge.is-active { background: #8e2f3a; color: #fff; border-color: #8e2f3a; }
.color-badge--blanc { color: #5f5a55; background: #fbfaf8; border-color: #cfc7bf; }
.color-badge--blanc.is-active { background: #efebe5; color: #3f3a36; border-color: #8f867d; }
.color-badge--rose { color: #a04470; background: #fff0f7; border-color: #d7a0ba; }
.color-badge--rose.is-active { background: #a04470; color: #fff; border-color: #a04470; }
.color-badge--gris { color: #4c5560; background: #f0f2f4; border-color: #aeb6bf; }
.color-badge--gris.is-active { background: #4c5560; color: #fff; border-color: #4c5560; }

.lot-type-fieldset {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 24px 0 0;
    padding: 20px 0 0;
}
.lot-type-fieldset legend { padding: 0; color: var(--text-main); font-weight: 700; margin-bottom: 10px; }
.lot-type-choice { display: inline-flex; align-items: center; gap: 8px; margin-right: 14px; cursor: pointer; font-weight: 700; }
.lot-type-choice input { accent-color: var(--primary); }

.container-section,
.composition-section {
    border-top: 1px solid var(--border);
    margin-top: 24px;
    padding-top: 20px;
}
.container-section__header,
.composition-section__header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.container-section__header h5,
.composition-section__header h5 { margin: 3px 0 0; color: var(--text-main); font-size: 1rem; }
.container-list { display: grid; gap: 10px; }
.container-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 180px 40px;
    gap: 10px;
    align-items: end;
}
.container-row__field label,
.composition-row__field label { display: block; margin-bottom: 6px; color: var(--text-main); font-size: .78rem; font-weight: 700; }
.container-row select,
.container-row input,
.composition-row input {
    width: 100%;
    box-sizing: border-box;
    min-height: 42px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-main);
    font: inherit;
    border-radius: var(--radius);
    padding: 9px 11px;
}
.container-row select:focus,
.container-row input:focus,
.composition-row input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(197,160,89,.12); outline: none; }
.container-row .icon-button { align-self: end; }
.btn-add-container,
.btn-add-millesime { margin-top: 12px; }
.composition-list { display: grid; gap: 10px; }
.composition-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px; gap: 10px; align-items: end; }
.lot-total { display: flex; justify-content: flex-end; gap: 12px; align-items: baseline; margin-top: 14px; color: var(--text-muted); }
.lot-total strong { color: var(--primary); font-size: 1rem; }

@media (max-width: 768px) {
    .lot-card__header { padding: 16px; }
    .lot-card__body { padding: 16px; }
    .lot-common-grid { grid-template-columns: 1fr; }
    .lot-common-grid .field--wide { grid-column: auto; }
    .container-row { grid-template-columns: minmax(0, 1fr) 110px 38px; gap: 8px; }
    .composition-row { grid-template-columns: 1fr 110px 38px; gap: 8px; }
    .container-row__field label,
    .composition-row__field label { font-size: .72rem; }
    .color-badge { flex: 1 1 calc(50% - 8px); min-width: 0; }
    .lot-card__header .remove-lot { font-size: .75rem; padding: 7px 9px; }
}

/* Controles composition : état caché réellement prioritaire */
.btn-add-millesime[hidden] { display: none !important; }
.composition-remove { pointer-events: auto; cursor: pointer; }


/* Autocomplétion commune / code postal — composants partagés */
.location-autocomplete { position: relative; }
.location-suggestions {
    position: absolute;
    z-index: 40;
    top: calc(100% - 1px);
    left: 0;
    width: 100%;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-top: 0;
    border-radius: 0 0 var(--radius) var(--radius);
    background: #fff;
    box-shadow: 0 12px 26px rgba(54, 40, 34, .12);
}
.location-suggestions[hidden] { display: none; }
.location-suggestion {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 0;
    border-top: 1px solid var(--border);
    background: #fff;
    color: var(--text-main);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.location-suggestion:first-child { border-top: 0; }
.location-suggestion:hover,
.location-suggestion:focus-visible { background: #faf8f5; outline: none; }
.location-suggestion__name { font-weight: 700; }
.location-suggestion__postal { flex: 0 0 auto; color: var(--primary); font-size: .82rem; font-weight: 700; }
.location-suggestion__department { display: block; margin-top: 2px; color: var(--text-muted); font-size: .72rem; font-weight: 400; }

@media (max-width: 768px) {
    .location-suggestions { max-height: 220px; }
    .location-suggestion { padding: 11px 10px; }
}
@media (min-width: 769px) {
    .field--small .location-suggestions { min-width: 330px; }
}
