/* Staysy 009.2 · éditeur du contenu d'accueil */
.booklet-overview,
.booklet-metadata-card,
.booklet-section-card,
.booklet-add-section {
    border: 1px solid color-mix(in srgb, var(--border, #d9dfdc) 82%, transparent);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 10px 32px rgba(22, 51, 45, .045);
}

.booklet-overview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    padding: 22px;
    margin-bottom: 18px;
    align-items: start;
    border-top: 4px solid #1e4e45;
}
.booklet-overview-main h2 { margin: 4px 0 8px; font: 600 27px/1.15 Fraunces, serif; color: var(--ink, #173b34); }
.booklet-overview-main p { max-width: 780px; margin: 0; color: var(--ink-soft, #687872); font-size: 13px; line-height: 1.65; }
.booklet-overview-main code { padding: 2px 5px; border-radius: 6px; background: #edf4f1; color: #1e4e45; }
.booklet-overview-kicker { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; font-weight: 850; color: #758982; }
.booklet-overview-status { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.booklet-overview-status small { font-size: 10px; color: #71807b; }
.booklet-overview-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid #e5ebe8; }
.booklet-overview-actions form { display: inline-flex; }

.booklet-metadata-card { padding: 20px; margin-bottom: 18px; }
.booklet-metadata-card > header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid #e5ebe8; padding-bottom: 15px; margin-bottom: 16px; }
.booklet-metadata-card > header > div { display: grid; grid-template-columns: auto 1fr; gap: 4px 11px; }
.booklet-metadata-card > header > div > span { grid-row: 1 / 3; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: #eef5f2; color: #1e4e45; font-weight: 850; font-size: 12px; }
.booklet-metadata-card h2 { margin: 0; font: 600 21px/1.2 Fraunces, serif; color: #173b34; }
.booklet-metadata-card header p { grid-column: 2; margin: 0; font-size: 12px; color: #71807b; }
.booklet-metadata-card header > i { font-size: 25px; color: #8aa99d; }
.booklet-metadata-form { display: grid; grid-template-columns: minmax(240px, 2fr) minmax(160px, 1fr) auto; gap: 12px; align-items: end; }
.booklet-metadata-form label,
.booklet-language-panel label { display: flex; flex-direction: column; gap: 6px; }
.booklet-metadata-form label span,
.booklet-language-panel label span { font-size: 11px; font-weight: 800; color: #687872; }
.booklet-ai-state { display: flex; gap: 11px; align-items: center; margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: #fff6eb; color: #80531e; }
.booklet-ai-state.is-ready { background: #edf8f3; color: #1b654e; }
.booklet-ai-state i { font-size: 20px; }
.booklet-ai-state div { display: flex; flex-direction: column; }
.booklet-ai-state span { font-size: 11px; margin-top: 2px; }

.booklet-order-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin: 0 2px 10px;
    color: #62736d;
    font-size: 11px;
}
.booklet-order-toolbar > span:first-child { display: inline-flex; gap: 6px; align-items: center; }
.booklet-order-status { font-weight: 750; color: #71807b; }
.booklet-order-status.is-saving { color: #8b691e; }
.booklet-order-status.is-success { color: #1b654e; }
.booklet-order-status.is-error { color: #9a382c; }

.booklet-section-list { display: flex; flex-direction: column; gap: 18px; }
.booklet-section-card { overflow: hidden; transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease, border-color .16s ease; }
.booklet-section-card.is-dragging { opacity: .62; transform: scale(.994); box-shadow: 0 22px 52px rgba(22, 51, 45, .18); border-color: #89aa9f; z-index: 4; }
.booklet-section-card.is-drop-target { border-color: #d19a45; box-shadow: 0 0 0 3px rgba(209, 154, 69, .12), 0 10px 32px rgba(22, 51, 45, .06); }
body.booklet-section-dragging { cursor: grabbing; user-select: none; }
.booklet-section-head {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 18px 20px;
    background: linear-gradient(135deg, #f7faf8, #fff);
    border-bottom: 1px solid #e5ebe8;
}
.booklet-drag-handle {
    display: grid;
    place-items: center;
    width: 34px;
    height: 38px;
    border: 1px solid #d8e3de;
    border-radius: 10px;
    background: #fff;
    color: #688078;
    cursor: grab;
    touch-action: none;
}
.booklet-drag-handle:hover,
.booklet-drag-handle:focus { border-color: #87aa9e; color: #1e4e45; background: #edf5f1; outline: 0; }
.booklet-drag-handle:active { cursor: grabbing; }
.booklet-section-number { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 13px; background: #1e4e45; color: #fff; font-size: 11px; font-weight: 850; }
.booklet-section-heading { min-width: 0; }
.booklet-section-heading h2 { margin: 0; font: 600 21px/1.2 Fraunces, serif; color: #173b34; overflow-wrap: anywhere; }
.booklet-section-heading p { margin: 4px 0 0; color: #71807b; font-size: 11px; }
.booklet-section-heading code { color: #50746a; }
.booklet-section-state { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.booklet-section-state small { font-size: 9px; color: #71807b; }

.booklet-source-form { padding: 20px; transition: background .16s ease; }
.booklet-source-form.is-dirty { background: linear-gradient(180deg, rgba(255, 250, 240, .42), transparent 85px); }
.booklet-section-settings { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(150px, 1fr) auto; gap: 12px; align-items: end; margin-bottom: 17px; }
.booklet-section-settings label { display: flex; flex-direction: column; gap: 6px; }
.booklet-section-settings label > span { font-size: 11px; font-weight: 800; color: #687872; }
.booklet-check { flex-direction: row !important; align-items: center; min-height: 42px; gap: 8px !important; }
.booklet-check input { width: 17px; height: 17px; }
.booklet-check span { color: #173b34 !important; }

.booklet-editor-block { border: 1px solid #dfe7e3; border-radius: 15px; overflow: hidden; background: #fff; }
.booklet-editor-label { display: flex; justify-content: space-between; align-items: center; padding: 10px 13px; background: #f6f9f7; border-bottom: 1px solid #dfe7e3; }
.booklet-editor-label strong { font-size: 12px; color: #173b34; }
.booklet-editor-label span { font-size: 10px; color: #7c8c86; }
.booklet-toolbar { display: flex; align-items: center; gap: 4px; padding: 7px 9px; background: #fbfcfb; border-bottom: 1px solid #e5ebe8; }
.booklet-toolbar > span { width: 1px; height: 22px; background: #dde5e1; margin: 0 4px; }
.booklet-toolbar button { display: grid; place-items: center; width: 31px; height: 30px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #38584f; cursor: pointer; }
.booklet-toolbar button:hover,
.booklet-toolbar button:focus { background: #edf4f1; border-color: #d5e2dd; outline: 0; }
.booklet-toolbar button:disabled { opacity: .42; cursor: not-allowed; }
.booklet-toolbar.is-compact { padding: 5px 7px; }
.booklet-toolbar.is-compact button { width: 28px; height: 27px; }
.booklet-editor-surface { min-height: 190px; padding: 16px; outline: none; color: #273c36; font: 14px/1.7 Manrope, sans-serif; overflow-wrap: anywhere; }
.booklet-editor-surface:focus { box-shadow: inset 0 0 0 2px rgba(30, 78, 69, .18); }
.booklet-editor-surface.is-translation { min-height: 135px; border: 1px solid #e5ebe8; border-top: 0; }
.booklet-editor-surface p { margin: 0 0 10px; }
.booklet-editor-surface ul,
.booklet-editor-surface ol { padding-left: 24px; }
.booklet-marker-picker { border-top: 1px solid #e5ebe8; background: #fafcfa; }
.booklet-marker-picker summary { cursor: pointer; padding: 11px 13px; font-size: 11px; font-weight: 800; color: #365c52; list-style: none; }
.booklet-marker-picker summary::-webkit-details-marker { display: none; }
.booklet-marker-picker summary i { margin-right: 6px; }
.booklet-marker-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; padding: 0 13px 14px; }
.booklet-marker-groups > div > strong { display: block; margin-bottom: 6px; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: #798a84; }
.booklet-marker-groups > div > div { display: flex; flex-wrap: wrap; gap: 5px; }
.booklet-marker-chip { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 8px; border: 1px solid #d9e4df; border-radius: 9px; background: #fff; color: #2d5148; cursor: pointer; font-size: 10px; text-align: left; }
.booklet-marker-chip code { font-size: 8px; color: #759188; }
.booklet-marker-chip:hover { border-color: #1e4e45; background: #edf6f2; }
.booklet-marker-chip.is-sensitive { border-color: #ead7ad; background: #fffaf0; }

.booklet-ai-tools { margin-top: 14px; border: 1px solid #dce7e2; border-radius: 15px; background: linear-gradient(135deg, #f4faf7, #fffaf3); overflow: hidden; }
.booklet-ai-tools-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 13px 14px; }
.booklet-ai-tools-head > div { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: center; }
.booklet-ai-tools-head > div > i { grid-row: 1 / 3; color: #b17a1e; font-size: 18px; }
.booklet-ai-tools-head strong { color: #173b34; font-size: 12px; }
.booklet-ai-tools-head span { color: #71807b; font-size: 10px; }
.booklet-ai-model { flex: 0 0 auto; padding: 5px 8px; border-radius: 99px; background: rgba(255,255,255,.8); color: #596d66 !important; font-size: 9px !important; font-weight: 800; }
.booklet-ai-prompt { border-top: 1px solid #e2e9e5; background: rgba(255, 255, 255, .66); }
.booklet-ai-prompt summary { padding: 10px 14px; list-style: none; cursor: pointer; color: #50675f; font-size: 10px; font-weight: 800; }
.booklet-ai-prompt summary::-webkit-details-marker { display: none; }
.booklet-ai-prompt summary i { margin-right: 6px; }
.booklet-ai-prompt label { display: flex; flex-direction: column; gap: 6px; padding: 0 14px 14px; }
.booklet-ai-prompt label span { color: #687872; font-size: 10px; font-weight: 700; line-height: 1.5; }
.booklet-ai-prompt textarea { resize: vertical; min-height: 118px; font-size: 12px; line-height: 1.55; }
.booklet-ai-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; padding: 13px 14px; border-top: 1px solid #e2e9e5; }
.booklet-ai-actions .btn.is-busy,
.booklet-ai-actions .btn.is-loading { opacity: .72; cursor: wait; }
.booklet-ai-progress { flex: 1 1 250px; min-height: 18px; color: #71807b; font-size: 10px; line-height: 1.45; }
.booklet-ai-progress.is-loading { color: #8b691e; }
.booklet-ai-progress.is-success { color: #1b654e; }
.booklet-ai-progress.is-error { color: #9a382c; }
.booklet-ai-progress.is-warning { color: #8b691e; }
.booklet-button-spinner { display: inline-block; width: 12px; height: 12px; margin-right: 7px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -2px; animation: booklet-spin .75s linear infinite; }
@keyframes booklet-spin { to { transform: rotate(360deg); } }

.booklet-form-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 13px; }
.booklet-delete-form { display: flex; justify-content: flex-end; margin: -8px 24px 20px; }

.booklet-translations { border-top: 1px solid #e5ebe8; background: #fafcfa; }
.booklet-translations-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 20px; border-bottom: 1px solid #e5ebe8; }
.booklet-translations-head > div { display: flex; align-items: center; gap: 9px; }
.booklet-translations-head i { color: #4d7469; font-size: 17px; }
.booklet-translations-head strong { color: #173b34; font-size: 12px; }
.booklet-translations-head > span { color: #71807b; font-size: 9px; }
.booklet-language-list { display: flex; flex-direction: column; }
.booklet-language-accordion { background: #fff; border-bottom: 1px solid #e5ebe8; }
.booklet-language-accordion:last-child { border-bottom: 0; }
.booklet-language-accordion > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 13px 20px; list-style: none; cursor: pointer; }
.booklet-language-accordion > summary::-webkit-details-marker { display: none; }
.booklet-language-accordion > summary > i { color: #7d8d87; transition: transform .16s ease; }
.booklet-language-accordion[open] > summary > i { transform: rotate(180deg); }
.booklet-language-accordion[open] > summary { background: #f6faf8; }
.booklet-language-name { display: flex; align-items: center; gap: 9px; min-width: 0; color: #173b34; }
.booklet-language-name strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.booklet-language-name small { display: grid; place-items: center; min-width: 32px; height: 24px; padding: 0 7px; border-radius: 8px; background: #eaf2ee; color: #1e4e45; font-size: 9px; font-weight: 900; }
.booklet-language-status { padding: 4px 8px; border-radius: 99px; background: #f0f2f1; color: #71807b; font-size: 9px; font-weight: 800; white-space: nowrap; }
.booklet-language-accordion.is-current .booklet-language-status { background: #e8f6ef; color: #1b654e; }
.booklet-language-accordion.is-stale .booklet-language-status { background: #fff4dd; color: #805b12; }
.booklet-language-accordion.is-missing .booklet-language-status { background: #f1f2f2; color: #74817d; }
.booklet-language-panel { display: block; padding: 15px 20px 18px; border-top: 1px solid #e5ebe8; background: #fff; }
.booklet-language-panel .form-control { margin-bottom: 9px; }
.booklet-translation-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; }
.booklet-translation-foot span { font-size: 9px; color: #7b8b85; }

.booklet-empty-sections { display: flex; align-items: center; gap: 14px; min-height: 150px; padding: 24px; border: 1px dashed #cfdcd6; border-radius: 18px; background: rgba(255, 255, 255, .62); color: #53645e; }
.booklet-empty-sections > i { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: #eaf2ee; color: #1e4e45; font-size: 24px; }
.booklet-empty-sections > div { display: flex; flex-direction: column; gap: 4px; }
.booklet-empty-sections strong { color: #173b34; font-size: 15px; }
.booklet-empty-sections span { font-size: 11px; }
.booklet-add-section { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 18px; padding: 18px 20px; border: 1px dashed #cfdcd6; background: rgba(255, 255, 255, .62); }
.booklet-add-section form { display: block; min-width: 0; width: auto; margin: 0; }
.booklet-add-section > span { color: #71807b; font-size: 11px; }

.booklet-ai-modal[hidden] { display: none; }
.booklet-ai-modal { position: fixed; inset: 0; z-index: 10020; display: grid; place-items: center; padding: 24px; opacity: 0; pointer-events: none; transition: opacity .18s ease; }
.booklet-ai-modal.is-open { opacity: 1; pointer-events: auto; }
.booklet-ai-modal-backdrop { position: absolute; inset: 0; background: rgba(17, 31, 27, .58); backdrop-filter: blur(4px); }
.booklet-ai-modal-panel { position: relative; z-index: 1; width: min(1080px, 100%); max-height: min(86vh, 920px); display: flex; flex-direction: column; overflow: hidden; border: 1px solid rgba(255,255,255,.5); border-radius: 22px; background: #fff; box-shadow: 0 30px 90px rgba(7, 25, 20, .32); transform: translateY(12px) scale(.985); transition: transform .18s ease; }
.booklet-ai-modal.is-open .booklet-ai-modal-panel { transform: translateY(0) scale(1); }
.booklet-ai-modal-panel > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 18px 20px; border-bottom: 1px solid #e4ebe7; background: linear-gradient(135deg, #f3f9f6, #fff9ef); }
.booklet-ai-modal-panel > header span { color: #7a8a84; font-size: 9px; font-weight: 850; text-transform: uppercase; letter-spacing: .11em; }
.booklet-ai-modal-panel > header h2 { margin: 3px 0 0; color: #173b34; font: 600 23px/1.2 Fraunces, serif; }
.booklet-ai-modal-panel > header button { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #d8e3de; border-radius: 10px; background: #fff; color: #50675f; cursor: pointer; }
.booklet-ai-compare { display: grid; grid-template-columns: 1fr 1fr; min-height: 0; overflow: auto; }
.booklet-ai-compare > article { min-width: 0; padding: 20px; }
.booklet-ai-compare > article + article { border-left: 1px solid #e4ebe7; }
.booklet-ai-compare > article.is-proposal { background: #f9fcfa; }
.booklet-ai-compare article > span { display: inline-flex; margin-bottom: 8px; padding: 4px 8px; border-radius: 99px; background: #eef3f1; color: #62736d; font-size: 9px; font-weight: 850; text-transform: uppercase; letter-spacing: .07em; }
.booklet-ai-compare article.is-proposal > span { background: #e9f7ef; color: #1b654e; }
.booklet-ai-compare h3 { margin: 0 0 14px; color: #173b34; font: 600 20px/1.3 Fraunces, serif; }
.booklet-ai-preview-body { color: #334a43; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.booklet-ai-preview-body p { margin: 0 0 11px; }
.booklet-ai-preview-body ul,
.booklet-ai-preview-body ol { padding-left: 23px; }
.booklet-ai-modal-panel > footer { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 15px 20px; border-top: 1px solid #e4ebe7; background: #fff; }
.booklet-ai-modal-panel > footer > span { max-width: 590px; color: #71807b; font-size: 10px; line-height: 1.5; }
.booklet-ai-modal-panel > footer > div { display: flex; gap: 8px; }
html.booklet-modal-open,
body.booklet-modal-open { overflow: hidden; }

.booklet-toast[hidden] { display: none; }
.booklet-toast { position: fixed; right: 24px; bottom: 24px; z-index: 10040; max-width: min(420px, calc(100vw - 32px)); padding: 12px 15px; border: 1px solid #d7e3de; border-radius: 13px; background: #fff; color: #2f4a42; box-shadow: 0 16px 46px rgba(17, 45, 37, .2); font-size: 11px; font-weight: 750; line-height: 1.5; opacity: 0; transform: translateY(10px); transition: opacity .2s ease, transform .2s ease; }
.booklet-toast.is-visible { opacity: 1; transform: translateY(0); }
.booklet-toast.is-success { border-color: #a9d4c0; background: #f0faf5; color: #175c47; }
.booklet-toast.is-error { border-color: #ebbbb3; background: #fff4f1; color: #8f3025; }
.booklet-toast.is-warning { border-color: #ead39a; background: #fff9ea; color: #765713; }

@media (max-width: 1000px) {
    .booklet-section-settings { grid-template-columns: 1fr 1fr; }
    .booklet-check { align-self: end; }
    .booklet-metadata-form { grid-template-columns: 1fr 1fr; }
    .booklet-metadata-form .btn { grid-column: 2; justify-self: end; }
    .booklet-ai-compare { grid-template-columns: 1fr; }
    .booklet-ai-compare > article + article { border-left: 0; border-top: 1px solid #e4ebe7; }
}

@media (max-width: 720px) {
    .booklet-overview { grid-template-columns: 1fr; }
    .booklet-overview-status { align-items: flex-start; }
    .booklet-order-toolbar { align-items: flex-start; flex-direction: column; }
    .booklet-section-head { grid-template-columns: auto auto minmax(0, 1fr); padding: 14px; }
    .booklet-section-state { grid-column: 1 / -1; align-items: flex-start; }
    .booklet-source-form { padding: 14px; }
    .booklet-section-settings { grid-template-columns: 1fr; }
    .booklet-metadata-form { grid-template-columns: 1fr; }
    .booklet-metadata-form .btn { grid-column: auto; justify-self: stretch; }
    .booklet-editor-label { align-items: flex-start; flex-direction: column; gap: 3px; }
    .booklet-ai-tools-head { align-items: flex-start; flex-direction: column; }
    .booklet-ai-actions { align-items: stretch; flex-direction: column; }
    .booklet-ai-actions .btn { width: 100%; justify-content: center; }
    .booklet-ai-progress { flex-basis: auto; }
    .booklet-form-actions { align-items: stretch; flex-direction: column; }
    .booklet-form-actions .btn { width: 100%; justify-content: center; }
    .booklet-delete-form { margin: -4px 14px 16px; }
    .booklet-translations-head { padding: 12px 14px; }
    .booklet-language-accordion > summary { grid-template-columns: minmax(0, 1fr) auto auto; padding: 11px 14px; }
    .booklet-language-panel { padding: 12px 14px 15px; }
    .booklet-translation-foot { align-items: stretch; flex-direction: column; }
    .booklet-translation-foot .btn { width: 100%; justify-content: center; }
    .booklet-add-section { align-items: stretch; flex-direction: column; }
    .booklet-add-section .btn { width: 100%; justify-content: center; }
    .booklet-ai-modal { padding: 10px; }
    .booklet-ai-modal-panel { max-height: 94vh; border-radius: 17px; }
    .booklet-ai-modal-panel > header { padding: 15px; }
    .booklet-ai-modal-panel > header h2 { font-size: 20px; }
    .booklet-ai-compare > article { padding: 15px; }
    .booklet-ai-modal-panel > footer { align-items: stretch; flex-direction: column; padding: 13px 15px; }
    .booklet-ai-modal-panel > footer > div { display: grid; grid-template-columns: 1fr 1fr; }
    .booklet-toast { right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .booklet-section-card,
    .booklet-ai-modal,
    .booklet-ai-modal-panel,
    .booklet-toast,
    .booklet-button-spinner { transition: none; animation: none; }
}
