:root { font-family: system-ui, sans-serif; color: #182b3c; background: #f2f5f6; line-height: 1.5; }
* { box-sizing: border-box; }
body { margin: 0; }
.admin-header { background: #fff; border-bottom: 1px solid #dce3e6; box-shadow: 0 3px 12px #102b3b0d; }
.admin-header-inner { max-width: 1200px; margin: 0 auto; padding: .7rem 2rem; display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.admin-brand { display: inline-flex; align-items: center; gap: .7rem; color: #182b3c; text-decoration: none; font-size: .85rem; font-weight: 600; }
.admin-brand img { width: 140px; max-height: 44px; object-fit: contain; }
.admin-navigation { display: flex; flex: 1 1 auto; flex-wrap: wrap; gap: .25rem; margin: 0; }
.admin-navigation a { display: block; padding: .55rem .8rem; border-radius: 6px; color: #344955; font-weight: 600; text-decoration: none; }
.admin-navigation a:hover { color: #a91420; background: #f8ecee; }
.admin-navigation a[aria-current="page"] { color: #a91420; background: #f8ecee; }
.admin-public-home { display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .8rem; border: 1px solid #a91420; border-radius: 6px; color: #a91420; background: white; font-weight: 600; text-decoration: none; white-space: nowrap; }
.admin-public-home:hover { color: white; background: #8f101a; }
.admin-public-home:focus-visible { outline: 3px solid #8f101a; outline-offset: 2px; }
.admin-logout { margin: 0; }
.admin-logout button { margin-top: 0; padding: .45rem .8rem; color: #a91420; background: white; }
.admin-logout button:hover { color: white; background: #8f101a; }
main { max-width: 1200px; margin: 2rem auto; padding: 2rem; background: white; border-radius: 12px; box-shadow: 0 4px 24px #102b3b12; overflow-x: auto; }
main.fierafast-fairs-admin { max-width: 1760px; }
main.fierafast-fairs-admin table.fair-admin-table { width: 100%; table-layout: fixed; }
.fairs-test-mode { margin: 1rem 0; padding: 1rem 1.25rem; border: 2px solid #b56a00; border-radius: 6px; color: #542f00; background: #fff3d6; }
.fairs-test-mode strong { font-size: 1.1rem; }
.fairs-test-mode p { margin: .45rem 0 0; }
h1 { margin: .5rem 0 1rem; color: #102b3b; font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.2; }
a { color: #a91420; text-underline-offset: .2em; }
a:hover { color: #720d16; }
nav { margin-bottom: 1rem; color: #566873; }
label { display: block; font-weight: 600; margin: 1rem 0 .35rem; }
input:not([type="hidden"]), select, textarea { display: block; width: 100%; max-width: 46rem; padding: .65rem .75rem; border: 1px solid #91a1aa; border-radius: 6px; background: white; color: inherit; font: inherit; }
textarea { min-height: 6rem; resize: vertical; }
button { display: inline-block; padding: .6rem 1rem; border: 1px solid #b71420; border-radius: 6px; color: white; background: #b71420; font: inherit; font-weight: 600; cursor: pointer; }
button:hover { background: #8f101a; }
:focus-visible { outline: 3px solid #176a9d; outline-offset: 2px; }
form > button { margin-top: 1rem; }
[role="alert"] { padding: .8rem 1rem; border-left: 4px solid #b71420; background: #fff0f0; color: #74121a; }
.article-filters { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: end; padding: 1rem; margin: 1rem 0; background: #f2f5f6; border-radius: 8px; }
.article-filters label { margin: 0; }
.article-filters input, .article-filters select { width: auto; max-width: 100%; }
.article-filters #article-search { flex: 1 1 20rem; min-width: 12rem; }
.article-filters #article-status { flex: 0 0 auto; }
.admin-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.admin-list-heading h1 { margin: .5rem 0; }
.admin-list-heading .article-actions { margin: 0; }
table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; text-align: left; }
caption { text-align: left; font-weight: 600; margin-bottom: .6rem; }
th, td { padding: .75rem; border-bottom: 1px solid #dce3e6; vertical-align: top; }
th { background: #f2f5f6; }
.article-list-table .table-sort-button { display: inline-flex; align-items: center; gap: .35rem; padding: 0; border: 0; color: inherit; background: transparent; font: inherit; font-weight: inherit; text-align: left; white-space: nowrap; }
.article-list-table .table-sort-button:hover { color: #a91420; background: transparent; }
.table-sort-indicator { color: #667984; font-weight: 400; }
td form { display: inline-block; }
td form button { margin: .25rem 0; }
td a { display: inline-block; margin: .25rem .6rem .25rem 0; }
.article-actions { display: flex; flex-wrap: wrap; align-items: stretch; gap: .4rem; }
.article-actions-cell { min-width: 270px; }
.article-title-cell { min-width: 240px; }
.article-language-cell { width: 1%; white-space: nowrap; }
.article-actions-cell .article-actions { flex-wrap: wrap; }
.article-actions form { display: flex; margin: 0; }
.article-actions .article-publication-form { gap: .35rem; align-items: stretch; }
.article-actions .article-publication-form select { width: auto; max-width: 11rem; padding: .4rem .6rem; font-size: .875rem; }
.article-secondary-actions { display: flex; flex: 0 0 100%; align-items: stretch; gap: .4rem; }
.article-actions .article-action { display: inline-flex; align-items: center; justify-content: center; margin: 0; padding: .45rem .7rem; border: 1px solid #b71420; border-radius: 6px; color: #a91420; background: white; font: inherit; font-size: .875rem; font-weight: 600; line-height: 1.3; text-align: center; text-decoration: none; white-space: nowrap; cursor: pointer; }
.article-actions .article-action:hover { color: white; background: #8f101a; border-color: #8f101a; }
.article-actions .article-delete { padding: .45rem; }
.article-actions .article-delete svg { display: block; width: 18px; height: 18px; }
.feature-page-order-status { margin: .75rem 0; color: #405563; }
.feature-page-order-cell { width: 1%; white-space: nowrap; }
.feature-page-order-controls { display: flex; align-items: center; gap: .25rem; }
.feature-page-position { display: inline-flex; flex: 0 0 1.5rem; align-items: center; justify-content: center; color: #405563; font-weight: 700; font-variant-numeric: tabular-nums; }
.feature-page-order-controls .article-action { min-width: 2.25rem; padding: .4rem .55rem; }
.feature-page-title-cell { cursor: grab; touch-action: none; user-select: none; }
.feature-page-title-cell:active { cursor: grabbing; }
.feature-page-title-cell.is-reorder-disabled { cursor: default; touch-action: auto; }
#feature-page-order-list tr.is-dragging td { background: #fff0f0; box-shadow: inset 0 1px #b71420, inset 0 -1px #b71420; }
#feature-page-order-list tr.is-dragging td:first-child { box-shadow: inset 2px 0 #b71420, inset 0 1px #b71420, inset 0 -1px #b71420; }
#feature-page-order-list tr.is-dragging td:last-child { box-shadow: inset -2px 0 #b71420, inset 0 1px #b71420, inset 0 -1px #b71420; }
body.is-feature-page-reordering { cursor: grabbing; user-select: none; }
.jodit-toolbar-button_fieraEmail svg rect,
.jodit-toolbar-button_fieraEmail svg path { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.jodit-container.jodit-source__mode.jodit_split_mode .jodit-source { display: block !important; flex: 1 1 100%; width: 100%; }
.jodit-container.jodit-source__mode.jodit_split_mode .jodit-wysiwyg,
.jodit-container.jodit-source__mode.jodit_split_mode .jodit-wysiwyg_iframe { display: none !important; }
.jodit-container.jodit-source__mode .jodit-source__mirror { max-width: none; }
.fair-admin-logo { display: block; width: 112px; max-width: 100%; height: 64px; object-fit: contain; background: #fff; }
.fair-admin-no-logo { display: inline-block; max-width: 100%; padding: .35rem .5rem; border: 1px solid #a91420; border-radius: 4px; color: #74121a; background: #fff0f0; font-size: .82rem; font-weight: 700; text-align: center; white-space: normal; overflow-wrap: anywhere; }
.fair-admin-table .fair-column-logo { width: 140px; }
.fair-admin-table .fair-column-name { width: 15%; }
.fair-admin-table .fair-column-location { width: 14%; }
.fair-admin-table .fair-column-when { width: 9%; }
.fair-admin-table .fair-column-description { width: 57%; }
.fair-admin-table .fair-column-actions { width: 5%; }
.fair-admin-table th,
.fair-admin-table td { border-bottom-width: 2px; }
.fair-admin-table tr > :nth-child(odd) { background: #f2f5f6; }
.fair-admin-table tr > :nth-child(even) { background: #fff; }
.fair-admin-location > .fair-admin-divider,
.fair-admin-when > .fair-admin-divider { padding-bottom: .35rem; border-bottom: 1px solid #dce2e6; }
.fair-admin-location > strong,
.fair-admin-when > strong { display: block; }
.fair-admin-location > div + strong,
.fair-admin-when > div + strong { padding-top: .35rem; }
.fair-admin-name { display: block; }
.fair-admin-website { display: block; margin-top: .3rem; font-size: .82rem; font-weight: 400; line-height: 1.35; overflow-wrap: anywhere; word-break: break-word; }
.fair-admin-category { display: flex; align-items: flex-start; gap: .35rem; margin-top: .5rem; padding-top: .45rem; border-top: 1px solid #dce2e6; font-size: .84rem; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.fair-admin-category svg { flex: 0 0 16px; width: 16px; height: 16px; margin-top: .05rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.fair-admin-filters { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem 1rem; margin: 1rem 0; padding: 1rem; border-radius: 8px; background: #f2f5f6; }
.fair-admin-filters > div { flex: 1 1 10rem; }
.fair-admin-filters > div:first-child { flex: 2 1 18rem; }
.fair-admin-filters label { margin: .15rem 0 .35rem; }
.fair-admin-filters input,
.fair-admin-filters select { max-width: none; }
.fair-admin-filters > button { margin-top: 0; }
.fair-admin-pagination { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; margin: 1rem 0; }
.fair-admin-pagination > span { margin-right: auto; }
.fair-admin-pagination form { margin: 0; }
.fair-admin-pagination form > button { margin-top: 0; }
.fair-admin-description { white-space: normal; overflow-wrap: anywhere; }
.fair-admin-description p { margin: 0; }
.fair-admin-icon-button { display: inline-flex; width: 38px; height: 36px; margin: 0 .15rem; padding: .45rem; align-items: center; justify-content: center; vertical-align: middle; margin-bottom:15px; }
.fair-admin-icon-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.button-link { display: inline-block; padding: .45rem .65rem; border-radius: 5px; color: white; background: #a91420; text-decoration: none; font-size: .9rem; font-weight: 600; white-space: nowrap; }
.button-link.fair-admin-icon-button { display: inline-flex; padding: .45rem; }
.fair-admin-icon-button svg { display: block; flex: 0 0 auto; margin: auto; }
.button-link:hover { color: white; background: #720d16; }
button:disabled { cursor: not-allowed; opacity: .55; }
@media (max-width: 700px) { main { margin: 0; padding: 1.2rem; border-radius: 0; min-height: 100vh; } table { min-width: 700px; } .article-filters { display: block; } .article-filters label { margin-top: .75rem; } .article-filters input, .article-filters select { width: 100%; } }
@media (max-width: 700px) { .admin-header-inner { padding: .7rem 1.2rem; gap: .6rem; } .admin-brand { flex: 1; } .admin-navigation { flex-basis: 100%; order: 3; } .admin-navigation a { padding: .45rem .65rem; } }

[hidden] { display: none !important; }

/* Solo nella modifica: campi affiancati quando lo schermo offre spazio. */
.article-edit-form .article-details-grid,
.article-edit-form .article-seo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: .25rem 1.25rem; align-items: start; }
.article-edit-form .article-details-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.article-edit-form .article-header-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .25rem 1.25rem; align-items: start; }
.article-edit-form .article-field-publication-date { grid-column: -2 / -1; grid-row: 1; }
.article-edit-form .article-field-title { grid-column: 1 / span 2; grid-row: 2; }
.article-edit-form .article-field-slug { grid-column: 3 / span 2; grid-row: 2; }
.article-edit-form .article-seo-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr); }
.article-edit-form .seo-description-field textarea { max-width: none; }
.article-edit-form .article-seo-redirects { grid-column: 1 / -1; }
.article-edit-form .article-seo-redirects textarea { width: 100%; max-width: none; }
@media (max-width: 900px) {
  .article-edit-form .article-details-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-edit-form .article-header-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-edit-form .article-field-title { grid-column: 1 / -1; grid-row: 2; }
  .article-edit-form .article-field-slug { grid-column: 1 / -1; grid-row: 3; }
}
@media (max-width: 900px) {
  .article-edit-form .article-seo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-edit-form .seo-description-field { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .article-edit-form .article-seo-grid { grid-template-columns: minmax(0, 1fr); }
}
.article-edit-form .seo-default { margin: .5rem 0; padding: .55rem .7rem; background: #f2f5f6; border-radius: 6px; color: #344955; overflow-wrap: anywhere; font-size: .875rem; }
.article-edit-form .seo-default-description { grid-column: 1 / -1; }
.article-edit-form .article-field { min-width: 0; }
.article-edit-page h1 { font-size: clamp(1.3rem, 2vw, 1.6rem); }
.article-edit-layout > .article-edit-form { min-width: 0; }
.article-section-menu { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: .75rem; border-bottom: 1px solid #dce3e6; padding-bottom: .5rem; }
.article-section-menu button { padding: .55rem .8rem; border: 0; border-radius: 6px; color: #344955; background: transparent; font-size: .875rem; text-align: left; }
.article-section-menu button:hover, .article-section-menu button[aria-selected="true"] { color: #a91420; background: #f8ecee; }
.article-edit-form .article-field-description { grid-column: 1 / -1; }
.article-edit-form .article-publishing-grid { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: .25rem 1.25rem; align-items: start; }
.article-edit-form .article-publishing-grid.is-create { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 800px) { .article-edit-form .article-publishing-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); } }
@media (max-width: 600px) { .article-edit-form .article-publishing-grid.is-create { grid-template-columns: 1fr; } }
.article-edit-form .article-field-categories .category-combobox,
.article-edit-form .article-field-categories .category-suggestions { max-width: none; }
.article-edit-form .article-field input:not([type="hidden"]),
.article-edit-form .article-field select,
.article-edit-form .article-field textarea { max-width: none; }
.article-edit-form .article-field-description textarea { min-height: 2.75rem; height: 2.75rem; }
.article-edit-form .article-field-categories #category-picker p { margin: .2rem 0; font-size: .875rem; }
.article-edit-form .article-details-grid label { margin: .4rem 0 .15rem; }
.article-edit-form .article-details-grid input:not([type="hidden"]),
.article-edit-form .article-details-grid select { padding: .35rem .6rem; }
.article-edit-form .article-details-grid .category-combobox { min-height: 2.2rem; padding: .1rem .4rem; }
.article-edit-form #bodyMarkdown { height: clamp(420px, 55vh, 700px); }
.article-edit-form .article-optional-panel { margin-top: .6rem; border: 1px solid #dce3e6; border-radius: 6px; padding: .55rem .8rem; }
.article-edit-form .article-optional-panel h2 { margin: 0 0 .5rem; font-size: 1.2rem; }
.article-edit-form .article-form-actions { position: fixed; z-index: 25; right: max(1rem, calc((100vw - 1200px) / 2 + 2rem)); bottom: 1rem; }
.article-edit-form .article-form-actions button { box-shadow: 0 4px 15px #102b3b33; }
.article-edit-form .article-form-actions .article-preview { display: inline-flex; align-items: center; gap: .5rem; }
.article-edit-form .article-form-actions { position: fixed; z-index: 25; right: max(1rem, calc((100vw - 1200px) / 2 + 2rem)); bottom: 1rem; display: flex; align-items: center; gap: .25rem; }
.article-edit-form .article-form-actions button { display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 4px 15px #102b3b33; }
.confirm-dialog { width: min(480px, 95vw); border: 0; border-radius: 10px; padding: 1.5rem; color: #182b3c; box-shadow: 0 12px 40px #0003; }
.confirm-dialog::backdrop { background: #102b3b99; }
.confirm-dialog h2 { margin: 0 0 .75rem; color: #102b3b; }
.confirm-dialog-actions { display: flex; justify-content: flex-end; gap: .75rem; margin-top: 1.5rem; }
.confirm-dialog-cancel { color: #182b3c; background: white; border-color: #91a1aa; }
.confirm-dialog-cancel:hover { background: #f2f5f6; }

#coverLibrary { max-width: 46rem; margin: 1rem 0; }
.cover-drop-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; max-width: 46rem; min-height: 11rem; padding: 1.5rem; border: 2px dashed #91a1aa; border-radius: 8px; background: #f2f5f6; text-align: center; }
.cover-drop-zone p { margin: 0; color: #566873; font-size: .9rem; }
.cover-drop-zone.is-dragover { border-color: #b71420; background: #fff0f0; }
.cover-drop-zone[aria-busy="true"] { opacity: .65; }
#coverImagePreview { max-width: 100%; max-height: 240px; object-fit: contain; border-radius: 6px; }
#removeCover { margin-top: .75rem; }
#coverLibrary h2 { font-size: 1rem; }
.cover-library-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; margin: 1rem 0; max-height: 320px; overflow-y: auto; }
.cover-library-item { min-width: 0; padding: .4rem; color: #182b3c; background: #f2f5f6; border: 1px solid #b9c6cd; text-align: left; }
.cover-library-item:hover { background: #dce6eb; }
.cover-library-item[aria-pressed="true"] { border: 3px solid #b71420; }
.cover-library-item img { width: 100%; height: 100px; object-fit: contain; display: block; }
.cover-library-item span { display: block; overflow-wrap: anywhere; font-size: .75rem; }

#category-picker { position: relative; }
.category-combobox { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; min-height: 2.85rem; max-width: 46rem; padding: .3rem .45rem; border: 1px solid #91a1aa; border-radius: 6px; background: white; }
.category-combobox:focus-within { outline: 3px solid #176a9d; outline-offset: 2px; }
.category-selected { display: contents; }
.category-selected-legacy { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
#category-add { margin-top: .5rem; }
#category-picker .category-combobox input { flex: 1 1 8rem; min-width: 6rem; width: auto; max-width: none; padding: .3rem; border: 0; outline: 0; }
.category-suggestions { position: absolute; z-index: 30; left: 0; right: 0; max-width: 46rem; max-height: 13rem; overflow-y: auto; background: white; border: 1px solid #91a1aa; border-radius: 0 0 6px 6px; box-shadow: 0 6px 14px #102b3b26; }
.category-suggestions [role="option"] { padding: .45rem .7rem; cursor: pointer; }
.category-suggestions [role="option"]:hover, .category-suggestions .is-active { color: white; background: #176a9d; }
.category-suggestions [aria-selected="true"]::after { content: " ✓"; }
.category-help { margin: .35rem 0; font-size: .875rem; }
.category-tag { display: inline-flex; align-items: center; gap: .5rem; padding: .2rem .35rem .2rem .7rem; border-radius: 1rem; background: #e8eef1; }
.category-tag button { padding: 0 .4rem; border: 0; border-radius: 50%; color: #182b3c; background: transparent; font-size: 1.2rem; line-height: 1.3; }
.category-tag button:hover { background: #ccd8de; }

/* Il contenuto scorre sotto la barra degli strumenti. */

/* Mantiene visibile il pannello di modifica dei collegamenti. */

.editor-dialog { width: min(560px, 95vw); border: 0; border-radius: 10px; padding: 1.5rem; box-shadow: 0 12px 40px #0003; }
.editor-dialog::backdrop { background: #102b3b99; }
.editor-dialog input, .editor-dialog textarea { width: 100%; }
.editor-dialog button { margin: 1rem .5rem 0 0; }

.admin-home-list { display: grid; justify-items: start; gap: .75rem; margin-left: 1rem; padding: 0; list-style: none; }
.admin-home-list li { display: flex; align-items: center; gap: .375rem; margin: 0; }
.admin-home-list .article-action:hover { color: white; background: #8f101a; border-color: #8f101a; }
.admin-home-list .article-action { display: inline-flex; align-items: center; justify-content: center; margin: 0; padding: .45rem .7rem; border: 1px solid #b71420; border-radius: 6px; color: #a91420;
                                   background: white; font: inherit; font-size: .875rem; font-weight: 600; line-height: 1.3; text-align: center; text-decoration: none; white-space: nowrap;  cursor: pointer; }
.admin-home-front-link { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; width: 2rem; height: 2rem; border: 1px solid #b71420; border-radius: 6px; color: #a91420; background: white; }
.admin-home-front-link:hover { color: white; background: #8f101a; border-color: #8f101a; }
.admin-home-front-link svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
