/* ============================================================
 * Nature At War — éditeur transversal BBCode
 * Mobile first. Les styles de rendu sont volontairement sobres
 * afin de rester compatibles avec les anciennes pages.
 * ============================================================ */
.naw-editor-toolbar {
    width: 100%;
    margin: 5px 0 7px;
    padding: 5px;
    border: 1px solid rgba(86, 60, 32, .28);
    border-radius: 7px;
    background: rgba(246, 229, 190, .50);
    box-shadow: inset 0 1px rgba(255,255,255,.35);
    box-sizing: border-box;
}

.naw-editor-toolbar__main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.naw-editor-tool,
.naw-editor-select select,
.naw-editor-chat-switch {
    min-height: 22px;
    border: 1px solid rgba(71, 54, 35, .34);
    border-radius: 4px;
    background: rgba(255, 249, 232, .72);
    color: #352817;
    font-size: 9px;
    line-height: 1;
    text-decoration: none;
    box-sizing: border-box;
}

.naw-editor-tool {
    position: relative;
    min-width: 22px;
    width: auto;
    height: 22px;
    padding: 2px 4px;
    cursor: pointer;
    font-family: inherit;
}

.naw-editor-tool--smiley-nav {
    min-width: 19px;
    width: 19px;
    padding-left: 2px;
    padding-right: 2px;
    font-size: 13px;
}

.naw-editor-tool:hover,
.naw-editor-tool:focus,
.naw-editor-select select:focus,
.naw-editor-chat-switch:hover,
.naw-editor-chat-switch:focus {
    outline: none;
    border-color: rgba(38, 105, 86, .62);
    background: rgba(235, 247, 228, .88);
}

.naw-editor-tool.is-premium {
    padding-right: 19px;
    opacity: .82;
}

.naw-editor-tool.is-premium img {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    object-fit: contain;
}

.naw-editor-color-letter {
    color: inherit;
    font-weight: 900;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 1px;
}

.naw-editor-tool--color {
    font-size: 11px;
}

.naw-editor-select {
    margin: 0;
}

.naw-editor-select select {
    max-width: 100px;
    height: 22px;
    padding: 2px 20px 2px 5px;
}

.naw-editor-chat-switch {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 6px;
    font-weight: 700;
}

.naw-editor-toolbar__hint {
    margin-top: 4px;
    text-align: center;
    color: #6b573c;
    font-size: 9px;
    line-height: 1.3;
}

.naw-editor-counter {
    display: block;
    width: 100%;
    margin: 2px 0 4px;
    color: #6b573c;
    text-align: right;
    font-size: 10px;
    line-height: 1.3;
    box-sizing: border-box;
}

.naw-editor-counter.is-warning {
    color: #9a6200;
    font-weight: 700;
}

.naw-editor-counter.is-limit {
    color: #a72d24;
    font-weight: 800;
}

/* Rendu BBCode moderne */
.naw-bbcode-quote {
    margin: 6px 0;
    padding: 6px 8px;
    border-left: 3px solid rgba(84, 111, 68, .72);
    background: rgba(237, 229, 200, .58);
    color: inherit;
    font-size: .84em;
    line-height: 1.35;
}

.naw-bbcode-quote cite {
    display: block;
    margin-bottom: 3px;
    color: #5e4a2e;
    font-size: .86em;
    font-style: normal;
    font-weight: 800;
}

@media (min-width: 620px) {
    .naw-bbcode-quote {
        margin: 8px 0;
        padding: 8px 10px;
        font-size: .94em;
        line-height: 1.42;
    }

    .naw-bbcode-quote cite {
        margin-bottom: 4px;
        font-size: .9em;
    }
}

.naw-bbcode-spoiler {
    margin: 8px 0;
    border: 1px solid rgba(76, 58, 37, .28);
    border-radius: 6px;
    background: rgba(250, 241, 215, .55);
}

.naw-bbcode-spoiler summary {
    padding: 7px 9px;
    cursor: pointer;
    font-weight: 700;
}

.naw-bbcode-spoiler > div {
    padding: 0 9px 9px;
}

.naw-bbcode-list {
    margin: 7px 0 7px 22px;
    padding: 0;
}

.naw-bbcode-list li {
    margin: 2px 0;
}

.naw-bbcode-justify {
    text-align: justify;
}

.naw-bbcode-title,
.naw-bbcode-subtitle {
    margin: 9px 0 5px;
    color: inherit;
    line-height: 1.25;
}

.naw-bbcode-title { font-size: 1.28em; }
.naw-bbcode-subtitle { font-size: 1.13em; }
.naw-bbcode-paragraph { margin: 6px 0; }

.naw-bbcode-hr {
    height: 1px;
    margin: 10px 0;
    border: 0;
    background: linear-gradient(90deg, transparent, rgba(73, 54, 31, .55), transparent);
}

.naw-bbcode-table-wrap {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 8px 0;
    overflow-x: auto;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
    /* Le contenu du tableau BBCode ne doit jamais participer au calcul
       de largeur du tableau de forum qui le contient. */
    contain: inline-size;
}

.naw-bbcode-table {
    width: max-content;
    min-width: 100%;
    max-width: none;
    border-collapse: collapse;
    background: rgba(252, 243, 216, .52);
}

.naw-bbcode-table th,
.naw-bbcode-table td {
    padding: 6px 8px;
    border: 1px solid rgba(72, 53, 31, .28);
    text-align: left;
    vertical-align: top;
}

.naw-bbcode-table th {
    background: rgba(105, 127, 80, .16);
    font-weight: 800;
}

/* Un message de forum est lui-même rendu dans un tableau historique.
   Les largeurs sont définies par <colgroup> : le premier <tr> possède un
   colspan=2 et ne doit donc jamais pouvoir forcer une répartition 50/50.
   Le tableau BBCode reste isolé et scrollable dans la colonne message. */
.naw-forum-thread-table {
    width: 100%;
    table-layout: fixed;
}

.naw-forum-thread-table .naw-forum-author-col {
    width: 120px;
}

.naw-forum-thread-table .naw-forum-message-col {
    width: auto;
}

.naw-forum-message-body {
    min-width: 0;
    max-width: 100%;
}

.naw-forum-message-body > .naw-bbcode-table-wrap {
    max-width: 100%;
}

.naw-bbcode-size-80 { font-size: 80%; }
.naw-bbcode-size-90 { font-size: 90%; }
.naw-bbcode-size-100 { font-size: 100%; }
.naw-bbcode-size-110 { font-size: 110%; }
.naw-bbcode-size-125 { font-size: 125%; }
.naw-bbcode-size-150 { font-size: 150%; }

.naw-bbcode-font-naw { font-family: inherit; }
.naw-bbcode-font-arial { font-family: Arial, sans-serif; }
.naw-bbcode-font-verdana { font-family: Verdana, Geneva, sans-serif; }
.naw-bbcode-font-trebuchet { font-family: "Trebuchet MS", Arial, sans-serif; }
.naw-bbcode-font-georgia { font-family: Georgia, "Times New Roman", serif; }
.naw-bbcode-font-courier { font-family: "Courier New", Courier, monospace; }

@media (min-width: 600px) {
    .naw-editor-toolbar {
        padding: 5px 6px;
    }

    .naw-editor-tool,
    .naw-editor-select select,
    .naw-editor-chat-switch {
        min-height: 24px;
        font-size: 10px;
    }

    .naw-editor-tool {
        min-width: 24px;
        height: 24px;
        padding: 2px 5px;
    }

    .naw-editor-tool--smiley-nav {
        min-width: 21px;
        width: 21px;
    }

    .naw-editor-select select {
        height: 24px;
    }

    .naw-editor-toolbar__hint {
        font-size: 10px;
    }
}

/* Phase 2 — compteur intégré au champ et lisibilité des sélecteurs */
.naw-editor-field-shell {
    position: relative;
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.naw-editor-field-shell > textarea,
.naw-editor-field-shell > input[type="text"] {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.naw-editor-field-shell > .has-naw-editor-counter {
    padding-right: 64px !important;
}

.naw-editor-counter {
    position: absolute;
    z-index: 3;
    top: 4px;
    right: 6px;
    display: inline-flex;
    width: auto;
    margin: 0;
    padding: 2px 5px;
    border-radius: 4px;
    background: rgba(33, 26, 18, .66);
    color: #f7edd3;
    font-size: 9px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: .01em;
    pointer-events: none;
    box-sizing: border-box;
}

.naw-editor-counter.is-warning {
    background: rgba(126, 77, 8, .88);
    color: #fff7df;
}

.naw-editor-counter.is-limit {
    background: rgba(139, 32, 25, .92);
    color: #fff;
}

.naw-editor-select select option {
    background: #fff9e8;
    color: #352817;
}

.naw-editor-tool--smiley {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.naw-editor-smiley-button-icon {
    display: block;
    width: 14px;
    height: 14px;
    object-fit: contain;
}

@media (min-width: 600px) {
    .naw-editor-smiley-button-icon {
        width: 15px;
        height: 15px;
    }
}

/* ============================================================
 * Phase 3 — formulaires riches Forum / Sondages
 * ============================================================ */
.naw-forum-compose__content {
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    padding: 9px 7px 12px;
    box-sizing: border-box;
}

.naw-forum-compose__field {
    display: block;
    width: 100%;
    margin: 0 0 8px;
}

.naw-forum-compose__label {
    display: block;
    margin: 0 0 4px;
    color: #49351f;
    font-size: 12px;
    font-weight: 800;
}

.naw-forum-compose__field input,
.naw-forum-compose__field textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.naw-forum-compose__field--message textarea {
    min-height: 180px;
    resize: vertical;
}

.naw-forum-compose__editor {
    margin: -2px 0 10px;
}

.naw-forum-compose__type {
    margin: 10px 0;
    padding: 8px;
    border: 1px solid rgba(80, 57, 31, .26);
    border-radius: 8px;
    background: rgba(235, 216, 172, .28);
}

.naw-forum-compose__type legend {
    width: auto;
    margin: 0;
    padding: 0 5px;
    border: 0;
    color: #4b3822;
    font-size: 12px;
    font-weight: 800;
}

.naw-forum-compose__type-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.naw-forum-compose__type-option {
    position: relative;
    display: block;
    margin: 0;
    cursor: pointer;
}

.naw-forum-compose__type-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.naw-forum-compose__type-option span {
    display: flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 8px;
    border: 1px solid rgba(74, 53, 31, .28);
    border-radius: 7px;
    background: rgba(255, 248, 227, .58);
    color: #49351f;
    font-size: 12px;
    font-weight: 700;
    box-sizing: border-box;
}

.naw-forum-compose__type-option span img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.naw-forum-compose__type-option input:checked + span {
    border-color: rgba(49, 107, 78, .65);
    background: rgba(197, 224, 184, .55);
    box-shadow: inset 0 0 0 1px rgba(49, 107, 78, .12);
}

.naw-forum-poll-compose {
    margin: 10px 0;
    padding: 9px;
    border: 1px solid rgba(83, 61, 34, .28);
    border-radius: 9px;
    background: linear-gradient(145deg, rgba(240, 225, 188, .48), rgba(218, 196, 151, .22));
    box-sizing: border-box;
}

.naw-forum-poll-compose__head {
    display: flex;
    margin-bottom: 8px;
}

.naw-forum-poll-compose__head strong,
.naw-forum-poll-compose__head span {
    display: block;
}

.naw-forum-poll-compose__head strong {
    color: #3e2f1e;
    font-size: 13px;
}

.naw-forum-poll-compose__head span {
    margin-top: 2px;
    color: #6b5638;
    font-size: 10px;
    line-height: 1.4;
}

.naw-forum-poll-compose textarea {
    min-height: 88px;
    resize: vertical;
}

.naw-forum-poll-compose__answers {
    margin-top: 10px;
}

.naw-forum-poll-compose__answers-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 6px;
}

.naw-forum-poll-compose__answers-head b {
    color: #44321d;
    font-size: 12px;
}

.naw-forum-poll-compose__answers-head span {
    color: #715b3d;
    font-size: 10px;
}

.naw-forum-poll-compose__answers-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
}

.naw-forum-poll-compose__answers-grid label {
    display: block;
    margin: 0;
}

.naw-forum-poll-compose__answers-grid label > span {
    display: block;
    margin-bottom: 3px;
    color: #5b452c;
    font-size: 10px;
    font-weight: 700;
}

.naw-forum-poll-compose__answers-grid input {
    width: 100%;
    box-sizing: border-box;
}

.naw-forum-poll-compose__add {
    width: 100%;
    margin-top: 8px;
}

.naw-forum-compose__footer {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-top: 12px;
}

.naw-forum-compose__footer small {
    color: #6d583b;
    font-size: 10px;
    line-height: 1.4;
}

.naw-forum-compose__footer .btn {
    width: 100%;
    min-height: 40px;
}

.naw-forum-poll-question {
    margin: 0 0 5px;
    font-weight: 700;
}

.naw-forum-poll-meta {
    display: block;
    margin-bottom: 7px;
    color: #765f42;
    font-size: 10px;
    font-style: italic;
}

@media (min-width: 620px) {
    .naw-forum-compose__content {
        padding: 12px 14px 16px;
    }

    .naw-forum-compose__field--message textarea {
        min-height: 205px;
    }

    .naw-forum-poll-compose {
        padding: 12px;
    }

    .naw-forum-poll-compose__answers-head,
    .naw-forum-compose__footer {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .naw-forum-poll-compose__answers-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .naw-forum-poll-compose__add {
        width: auto;
        min-width: 180px;
    }

    .naw-forum-compose__footer .btn {
        width: auto;
        min-width: 160px;
    }
}

@media (min-width: 1000px) {
    .naw-forum-compose__content {
        padding-top: 15px;
    }

    .naw-forum-compose__field--message textarea {
        min-height: 230px;
    }

    .naw-forum-poll-compose__answers-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}


/* ============================================================
 * Phase 4 — Profil / Alliance / Changelog
 * ============================================================ */
.naw-content-editor-card,
.naw-profile-editor {
    width: 100%;
    max-width: 980px;
    margin: 10px auto 14px;
    padding: 10px;
    border: 1px solid rgba(75, 55, 31, .24);
    border-radius: 10px;
    background: rgba(244, 228, 190, .26);
    box-shadow: 0 5px 16px rgba(49, 35, 20, .06);
    box-sizing: border-box;
}

.naw-content-editor-card__head {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 8px;
}

.naw-content-editor-card__head h3 {
    margin: 1px 0 0;
    color: #49351f;
    font-size: 16px;
    line-height: 1.25;
}

.naw-content-editor-card__head small {
    color: #725e43;
    font-size: 10px;
    line-height: 1.35;
}

.naw-content-editor-kicker {
    color: #49735e;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.naw-content-editor-form,
.naw-content-editor-field {
    width: 100%;
}

.naw-content-editor-field > label,
.naw-content-editor-inline-field > label {
    display: block;
    margin-bottom: 4px;
    color: #4b3822;
    font-size: 11px;
    font-weight: 800;
}

.naw-content-editor-field textarea,
.naw-profile-editor textarea {
    width: 100%;
    min-height: 170px;
    max-width: 100%;
    resize: vertical;
    box-sizing: border-box;
}

.naw-content-editor-options {
    margin: 10px 0 0;
    padding: 8px;
    border: 1px solid rgba(77, 57, 33, .20);
    border-radius: 8px;
    background: rgba(255, 250, 235, .38);
}

.naw-content-editor-options legend {
    width: auto;
    margin: 0;
    padding: 0 4px;
    border: 0;
    color: #49351f;
    font-size: 11px;
    font-weight: 800;
}

.naw-content-editor-options__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.naw-content-editor-options__grid > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.naw-content-editor-options__grid strong {
    grid-column: 1 / -1;
    color: #675238;
    font-size: 10px;
}

.naw-content-editor-options__grid label {
    display: flex;
    min-height: 34px;
    align-items: center;
    gap: 5px;
    margin: 0;
    padding: 5px 7px;
    border: 1px solid rgba(75, 55, 31, .18);
    border-radius: 6px;
    background: rgba(255, 249, 230, .48);
    font-size: 11px;
    cursor: pointer;
    box-sizing: border-box;
}

.naw-content-editor-inline-field {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    margin-top: 9px;
}

.naw-content-editor-inline-field select {
    width: 100%;
    max-width: 260px;
    color: #fff;
}

.naw-content-editor-inline-field select option {
    background: #fff9e8;
    color: #352817;
}

.naw-content-editor-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.naw-content-editor-actions .btn {
    width: auto;
    max-width: 100%;
}

.naw-content-editor-feedback {
    margin-top: 6px;
    text-align: right;
}

.naw-content-editor-preview {
    margin-top: 12px;
    border-top: 1px solid rgba(75, 55, 31, .18);
    padding-top: 8px;
}

.naw-content-editor-preview summary {
    cursor: pointer;
    color: #5c4931;
    font-size: 11px;
    font-weight: 800;
}

.naw-content-editor-preview > div {
    margin-top: 8px;
}

.admin-changelog-form > .naw-editor-toolbar {
    margin-top: 4px;
    margin-bottom: 7px;
}

@media (min-width: 600px) {
    .naw-content-editor-card,
    .naw-profile-editor {
        padding: 14px 16px;
    }

    .naw-content-editor-card__head {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
        gap: 16px;
    }

    .naw-content-editor-card__head small {
        max-width: 360px;
        text-align: right;
        font-size: 11px;
    }

    .naw-content-editor-options__grid {
        grid-template-columns: 1fr 1fr;
    }

    .naw-content-editor-inline-field {
        grid-template-columns: minmax(130px, 190px) minmax(180px, 260px);
        align-items: center;
    }

    .naw-content-editor-inline-field > label {
        margin: 0;
    }
}


/* ============================================================
 * Phase 5 — Support / modération / formulaires restants
 * ============================================================ */
.naw-ticket-compose {
    width: 100%;
    max-width: 980px;
    margin: 10px auto 14px;
    padding: 10px;
    border: 1px solid rgba(75, 55, 31, .22);
    border-radius: 10px;
    background: rgba(244, 228, 190, .24);
    box-shadow: 0 5px 16px rgba(49, 35, 20, .06);
    box-sizing: border-box;
}

.naw-ticket-compose__form > label {
    display: block;
    margin: 8px 0 4px;
    color: #4b3822;
    font-size: 11px;
    font-weight: 800;
}

.naw-ticket-compose__form > input[type="text"],
.naw-ticket-compose__form > textarea,
.naw-ticket-compose__form .naw-editor-field-shell {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.naw-ticket-compose__form > textarea {
    min-height: 140px;
    resize: vertical;
}

.naw-ticket-compose .type-ticket-sanction {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 10px 0 2px;
}

.naw-ticket-compose .type-ticket-sanction > div {
    min-width: 0;
}

.naw-ticket-compose .type-ticket-sanction label {
    margin-bottom: 3px;
    color: #5d472e;
    font-size: 10px;
    font-weight: 800;
}

.naw-ticket-compose .type-ticket-sanction select,
.naw-ticket-compose .type-ticket-sanction .naw-fakeselect,
.naw-ticket-compose .type-ticket-sanction .naw-fakeselect__btn {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.naw-ticket-compose__actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.naw-ticket-compose__actions .btn {
    width: auto;
    min-width: 140px;
    max-width: 100%;
}

.naw-ticket-reply .naw-editor-toolbar {
    margin-top: 0;
}

.overview-poll-admin-decision .naw-editor-toolbar {
    margin: 5px 0 6px;
}

@media (min-width: 620px) {
    .naw-ticket-compose {
        padding: 14px 16px;
    }

    .naw-ticket-compose .type-ticket-sanction {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px 12px;
    }
}

@media (min-width: 920px) {
    .naw-ticket-compose .type-ticket-sanction {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ============================================================
 * Phase finale — Sélecteur GIF GIPHY
 * ============================================================ */
.naw-editor-tool--giphy {
    min-width: 31px;
    padding-inline: 4px;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: .03em;
}

body.naw-giphy-open {
    overflow: hidden;
}

.naw-giphy-modal {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: rgba(20, 14, 8, .55);
    backdrop-filter: blur(1.5px);
    box-sizing: border-box;
}

.naw-giphy-modal.is-open {
    display: flex;
}

.naw-giphy-modal__dialog {
    display: flex;
    flex-direction: column;
    width: min(92vw, 390px);
    max-height: min(70vh, 520px);
    overflow: hidden;
    border: 1px solid rgba(100, 73, 38, .42);
    border-radius: 11px;
    background: #efe1bd;
    box-shadow: 0 12px 32px rgba(24, 16, 8, .32);
    color: #3f2d1b;
    box-sizing: border-box;
}

.naw-giphy-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px 5px;
    border-bottom: 1px solid rgba(83, 59, 30, .16);
    background: linear-gradient(180deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, 0));
}

.naw-giphy-modal__eyebrow {
    display: block;
    margin-bottom: 1px;
    color: #775f3e;
    font-size: 7px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.naw-giphy-modal__head h3 {
    margin: 0;
    color: #3c2a19;
    font-size: 13px;
    line-height: 1.15;
}

.naw-giphy-modal__close {
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid rgba(85, 60, 31, .24);
    border-radius: 50%;
    background: rgba(255, 255, 255, .28);
    color: #4f3821;
    font-size: 19px;
    line-height: 23px;
    cursor: pointer;
}

.naw-giphy-modal__search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px;
    padding: 6px 7px 4px;
}

.naw-giphy-modal__search input {
    width: 100%;
    min-width: 0;
    height: 30px;
    padding: 4px 7px;
    border: 1px solid rgba(79, 57, 31, .28);
    border-radius: 6px;
    background: rgba(255, 255, 255, .72);
    color: #302216;
    font-size: 11px;
    box-sizing: border-box;
}

.naw-giphy-modal__trending {
    min-height: 30px;
    padding: 4px 7px;
    border: 1px solid rgba(79, 57, 31, .25);
    border-radius: 6px;
    background: rgba(83, 62, 36, .08);
    color: #4a351f;
    font-size: 8px;
    font-weight: 800;
    cursor: pointer;
}

.naw-giphy-modal__status {
    min-height: 15px;
    padding: 0 8px 3px;
    color: #6a5437;
    font-size: 8px;
    line-height: 1.25;
}

.naw-giphy-modal__status.is-error {
    color: #8a2f25;
    font-weight: 800;
}

.naw-giphy-modal__grid {
    display: grid;
    flex: 1 1 auto;
    min-height: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    max-height: 36vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 6px 6px;
}

.naw-giphy-result {
    position: relative;
    min-width: 0;
    height: 68px;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(54, 39, 23, .15);
    border-radius: 6px;
    background: rgba(48, 35, 22, .08);
    cursor: pointer;
}

.naw-giphy-result img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.naw-giphy-result:focus-visible,
.naw-giphy-result:hover {
    outline: 2px solid rgba(111, 77, 33, .7);
    outline-offset: -2px;
}

.naw-giphy-modal__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-height: 34px;
    padding: 4px 7px;
    border-top: 1px solid rgba(83, 59, 30, .16);
}

.naw-giphy-modal__more {
    width: auto;
    min-width: 86px;
    min-height: 26px;
    margin: 0;
    padding: 3px 7px;
    font-size: 8px;
}

.naw-giphy-modal__attribution {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    padding: 3px 5px;
    border-radius: 4px;
    background: #111;
    color: #fff !important;
    text-decoration: none !important;
    white-space: nowrap;
}

.naw-giphy-modal__attribution span {
    font-size: 6px;
    opacity: .82;
}

.naw-giphy-modal__attribution strong {
    font-size: 9px;
    letter-spacing: .05em;
}

.naw-bbcode-giphy {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 120px;
    margin: 5px auto;
    border: 1px solid rgba(73, 52, 29, .2);
    border-radius: 7px;
    box-shadow: 0 3px 9px rgba(41, 28, 15, .1);
    object-fit: contain;
}

.naw-bbcode-giphy--xs { max-height: 60px; }
.naw-bbcode-giphy--sm { max-height: 80px; }
.naw-bbcode-giphy--md { max-height: 100px; }
.naw-bbcode-giphy--lg { max-height: 120px; }
.naw-bbcode-giphy--xl { max-height: 200px; }

@media (min-width: 620px) {
    .naw-editor-tool--giphy {
        min-width: 34px;
        font-size: 9px;
    }

    .naw-giphy-modal__dialog {
        width: min(86vw, 440px);
        max-height: min(72vh, 550px);
    }

    .naw-giphy-modal__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 5px;
        max-height: 38vh;
        padding-inline: 7px;
    }

    .naw-giphy-result {
        height: 76px;
    }
}

@media (min-width: 900px) {
    .naw-giphy-modal__dialog {
        width: 470px;
        max-width: 470px;
    }

    .naw-giphy-result {
        height: 82px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .naw-giphy-modal *,
    .naw-giphy-modal *::before,
    .naw-giphy-modal *::after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important;
    }
}

/* Derniers formulaires rattachés au système central. */
.naw-alliance-application {
    width: min(100%, 760px);
    margin: 10px auto;
    padding: 10px;
    border: 1px solid rgba(76, 55, 30, .2);
    border-radius: 10px;
    background: rgba(244, 228, 190, .18);
    box-sizing: border-box;
}

.naw-alliance-application__head {
    margin-bottom: 7px;
}

.naw-alliance-application__head strong,
.naw-alliance-application__head span {
    display: block;
}

.naw-alliance-application__head strong {
    color: #44301c;
    font-size: 13px;
}

.naw-alliance-application__head span {
    margin-top: 2px;
    color: #715a3c;
    font-size: 10px;
    line-height: 1.4;
}

.naw-alliance-application textarea,
.naw-alliance-application .naw-editor-field-shell {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.naw-alliance-application textarea {
    min-height: 120px;
    resize: vertical;
}

.naw-alliance-application__actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.naw-alliance-application__actions .btn {
    width: auto;
    max-width: 100%;
}

.naw-chat-report-feedback {
    min-height: 18px;
    margin: 6px 0 3px;
    font-size: 10px;
    line-height: 1.35;
}

.modal .question.has-naw-editor-counter {
    padding-right: 58px !important;
}

@media (min-width: 620px) {
    .naw-alliance-application {
        padding: 13px 15px;
    }

    .naw-alliance-application__head strong {
        font-size: 14px;
    }
}

/* Forum alliance : les formulaires d'action vivent dans les cellules du tableau
   (HTML valide) afin que les champs de modification restent bien associés au submit. */
.naw-forum-inline-action {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin: 2px 0 0;
}

.naw-forum-edit-form {
    margin: 0;
}


.naw-chat-send-feedback {
    min-height: 0;
    margin: 3px 2px 0;
    font-size: 11px;
    line-height: 1.3;
    text-align: right;
}

.naw-chat-send-feedback.is-error {
    color: #8f2f26;
    font-weight: 700;
}

/* Chats : les GIF GIPHY restent dans la ligne du message, juste après l'auteur. */
.table-chat .naw-bbcode-giphy {
    display: inline-block;
    width: auto;
    max-width: 160px;
    margin: 0 3px 1px;
    vertical-align: middle;
}

@media (max-width: 419px) {
    .table-chat .naw-bbcode-giphy {
        max-width: 120px;
    }
}

/* Phase 21 — GIPHY simplifié + aperçu agrandi des GIF */
.naw-giphy-modal__head--compact {
    justify-content: flex-end;
    min-height: 32px;
    padding: 3px 5px 0;
    border-bottom: 0;
    background: transparent;
}

.naw-giphy-modal__search {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 2px;
}

.naw-bbcode-giphy {
    cursor: zoom-in;
}

body.naw-gif-viewer-open {
    overflow: hidden;
}

.naw-gif-viewer {
    position: fixed;
    inset: 0;
    z-index: 12100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: rgba(12, 9, 5, .78);
    backdrop-filter: blur(2px);
    box-sizing: border-box;
}

.naw-gif-viewer.is-open {
    display: flex;
}

.naw-gif-viewer__dialog {
    position: relative;
    width: fit-content;
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    overflow: auto;
    border: 0;
    border-radius: 7px;
    background: transparent;
    box-shadow: none;
}

.naw-gif-viewer__close {
    position: absolute;
    z-index: 2;
    top: 5px;
    right: 5px;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .26);
    border-radius: 50%;
    background: rgba(20, 15, 10, .78);
    color: #fff2d4;
    font-size: 21px;
    line-height: 1;
    cursor: pointer;
}

.naw-gif-viewer__stage {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    max-width: none;
    max-height: none;
    overflow: visible;
    padding: 0;
    background: transparent;
    box-sizing: border-box;
    overscroll-behavior: contain;
}

.naw-gif-viewer__image {
    display: block;
    width: auto;
    max-width: min(92vw, 900px);
    height: auto;
    max-height: 82vh;
    border: 1px solid rgba(230, 210, 168, .2);
    border-radius: 7px;
    object-fit: contain;
    box-shadow: 0 14px 42px rgba(0, 0, 0, .48);
    cursor: zoom-in;
    transition: max-width .18s ease, max-height .18s ease, transform .18s ease;
}

.naw-gif-viewer__dialog.is-zoomed .naw-gif-viewer__image {
    max-width: none;
    max-height: none;
    cursor: zoom-out;
}

@media (max-width: 479px) {
    .naw-gif-viewer {
        padding: 6px;
    }

    .naw-gif-viewer__dialog {
        width: fit-content;
        max-width: calc(100vw - 12px);
        max-height: calc(100vh - 12px);
    }

    .naw-gif-viewer__stage {
        width: fit-content;
        padding: 0;
    }

    .naw-gif-viewer__image {
        max-width: 94vw;
        max-height: 84vh;
    }
}

@media (prefers-reduced-motion: reduce) {
    .naw-gif-viewer__image {
        transition: none;
    }
}

/* Forum alliance : les formulaires d'action vivent dans les cellules du tableau
   (HTML valide) afin que les champs de modification restent bien associés au submit. */
.naw-forum-inline-action {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin: 2px 0 0;
}

.naw-forum-edit-form {
    margin: 0;
}
