
.bcm-grid-root{max-width:100%;overflow-x:auto}
.bcm-grid-wrap{border:1px solid #cdd6e1;background:#fff;font-family:Arial,sans-serif;font-size:14px;overflow:hidden;width:auto;max-width:none;resize:both}
.bcm-grid-toolbar{display:flex;justify-content:space-between;align-items:center;gap:16px;background:#2f5ea7;color:#fff;padding:10px 14px;flex-wrap:wrap}
.bcm-grid-count{font-weight:700}
.bcm-grid-search{display:flex;gap:8px;align-items:center;flex:1;justify-content:flex-end}
.bcm-grid-search input{width:100%;max-width:340px;min-width:240px;padding:7px 10px;border:1px solid #9bb3d6;border-radius:3px}
.bcm-grid-table-wrap{overflow:auto;max-height:none;min-height:240px;height:100%}
.bcm-grid-table{width:100%;border-collapse:collapse;min-width:900px}
.bcm-grid-table thead th{position:sticky;top:0;background:#eef3f9;color:#1d3557;text-transform:uppercase;font-size:12px;letter-spacing:.03em;border-bottom:1px solid #cdd6e1;padding:10px 12px;text-align:left}
.bcm-grid-table td{padding:10px 12px;border-bottom:1px solid #e6ebf2;vertical-align:top}
.bcm-grid-table tbody tr:nth-child(even){background:#fafcff}
.bcm-grid-table tbody tr:hover{background:#f0f6ff}
.bcm-grid-action{display:inline-block;padding:5px 9px;border:1px solid #cdd6e1;border-radius:3px;text-decoration:none}
.bcm-grid-empty{text-align:center;color:#6b7280;padding:24px}
.bcm-grid-footer{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:12px 14px;border-top:1px solid #e6ebf2;background:#f8fafc;flex-wrap:wrap}
.bcm-grid-pagination{display:flex;gap:6px;flex-wrap:wrap}
.bcm-grid-page{display:inline-block;min-width:32px;text-align:center;padding:6px 10px;border:1px solid #cdd6e1;background:#fff;text-decoration:none;border-radius:3px}
.bcm-grid-page.is-active{background:#2f5ea7;color:#fff;border-color:#2f5ea7}


.bcm-grid-actions{display:flex;align-items:center;gap:6px;flex-wrap:nowrap;white-space:nowrap}
.bcm-grid-add-button{padding:7px 12px;border:1px solid #244b85;background:#fff;color:#244b85;border-radius:3px;cursor:pointer;font-weight:600}
.bcm-modal-open{overflow:hidden}
.bcm-modal[hidden]{display:none !important}
.bcm-modal{position:fixed;inset:0;z-index:99999;display:flex;align-items:center;justify-content:center;padding:24px}
.bcm-modal__backdrop{position:absolute;inset:0;background:rgba(17,24,39,.45)}
.bcm-modal__dialog{position:relative;background:#fff;border-radius:8px;box-shadow:0 20px 60px rgba(0,0,0,.18);width:min(520px,100%);max-height:90vh;overflow:auto}
.bcm-modal__dialog--large{width:min(980px,100%)}
.bcm-modal__header{display:flex;justify-content:space-between;align-items:center;padding:10px 14px;border-bottom:1px solid #244b85;background:#2f5ea7;color:#fff}
.bcm-modal__title{margin:0;font-size:14px;font-weight:700;color:#fff;text-transform:none}
.bcm-modal__close{border:0;background:transparent;font-size:28px;line-height:1;cursor:pointer;color:#fff}
.bcm-modal__body{padding:20px}
.bcm-modal-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 16px}
.bcm-modal-field{display:flex;flex-direction:column;gap:6px;font-weight:600;color:#334155}
.bcm-modal-field input,.bcm-modal-field textarea{width:100%;padding:9px 10px;border:1px solid #cbd5e1;border-radius:4px;font:inherit}
.bcm-modal-field textarea{min-height:86px;resize:vertical}
.bcm-modal__footer{display:flex;align-items:center;justify-content:flex-end;gap:10px;padding:16px 20px;border-top:1px solid #e5e7eb;flex-wrap:wrap}
.bcm-button-primary,.bcm-button-secondary,.bcm-button-danger{padding:9px 14px;border-radius:4px;cursor:pointer;border:1px solid transparent}
.bcm-button-primary{background:#2f5ea7;color:#fff;border-color:#244b85}
.bcm-button-secondary{background:#fff;color:#334155;border-color:#cbd5e1}
.bcm-button-danger{background:#b91c1c;color:#fff;border-color:#991b1b}
.bcm-modal__notice{margin-right:auto;color:#b91c1c;font-size:13px}
.bcm-modal__text{margin:0 0 8px}
.bcm-modal__highlight{font-weight:700;margin:0}
@media (max-width: 768px){.bcm-modal-grid{grid-template-columns:1fr}}


.bcm-grid-action{display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
.bcm-grid-action-view::before{content:"👁️"}
.bcm-grid-action-edit::before{content:"✏️"}
.bcm-grid-action-delete::before{content:"🗑️"}

.bcm-grid-table th:last-child,.bcm-grid-table td:last-child{position:sticky;right:0;background:#fff;z-index:2;box-shadow:-2px 0 5px rgba(0,0,0,.05)}
.bcm-grid-table thead th:last-child{background:#eef3f9;z-index:4}
.bcm-grid-table tbody tr:nth-child(even) td:last-child{background:#fafcff}
.bcm-grid-table tbody tr:hover td:last-child{background:#f0f6ff}
.bcm-grid-actions .bcm-grid-action{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto}


/* v0.2.46 - Coerenza modali con la grid */
.bcm-modal__dialog{font-family:Arial,sans-serif;font-size:14px;line-height:1.4;border:1px solid #cdd6e1;border-radius:6px}
.bcm-modal__header{background:#2f5ea7;color:#fff;padding:10px 14px;border-bottom:1px solid #244b85;min-height:42px}
.bcm-modal__title{margin:0;font-size:14px;line-height:1.3;font-weight:700;letter-spacing:.01em}
.bcm-modal__close{color:#fff;font-size:22px;line-height:1;padding:0 2px}
.bcm-modal__body{padding:12px 14px;font-size:14px;line-height:1.4}
.bcm-modal-grid{gap:10px 12px}
.bcm-modal-field{gap:4px;font-size:14px;line-height:1.35;font-weight:600;color:#334155}
.bcm-modal-field input,.bcm-modal-field textarea,.bcm-modal-field select{width:100%;min-height:34px;padding:7px 10px;border:1px solid #cbd5e1;border-radius:3px;font:inherit;line-height:1.35;background:#fff;color:#1f2937;box-sizing:border-box}
.bcm-modal-field textarea{min-height:86px;padding-top:8px;padding-bottom:8px}
.bcm-modal-field input:focus,.bcm-modal-field textarea:focus,.bcm-modal-field select:focus{outline:none;border-color:#9bb3d6;box-shadow:0 0 0 2px rgba(47,94,167,.10)}
.bcm-modal__text,.bcm-modal__highlight,.bcm-modal__notice{font-size:14px;line-height:1.4}
.bcm-modal__text{margin:0 0 6px}
.bcm-modal__highlight{margin:0}
.bcm-modal__footer{padding:10px 14px;border-top:1px solid #e6ebf2;gap:8px;background:#f8fafc}
.bcm-button-primary,.bcm-button-secondary,.bcm-button-danger{min-height:34px;padding:7px 12px;border-radius:3px;font:inherit;font-weight:600;line-height:1.2}
.bcm-grid-actions{display:flex;align-items:center;gap:6px;flex-wrap:nowrap;white-space:nowrap}
.bcm-grid-table td:last-child{white-space:nowrap}


.bcm-delete-summary{margin-top:10px;padding:10px 12px;border:1px solid #d7e0ec;background:#f8fafc;border-radius:3px}
.bcm-delete-summary__list{margin:0;padding:0;list-style:none;display:grid;gap:6px}
.bcm-delete-summary__item{display:grid;grid-template-columns:minmax(110px,160px) 1fr;gap:10px;align-items:start}
.bcm-delete-summary__label{font-weight:700;color:#1d3557}
.bcm-delete-summary__value{color:#334155;word-break:break-word}
@media (max-width: 640px){.bcm-delete-summary__item{grid-template-columns:1fr}}


.bcm-button-danger.is-disabled,
.bcm-button-danger:disabled{opacity:.55;cursor:not-allowed}

.bcm-grid-wrap.is-loading{position:relative}
.bcm-grid-wrap.is-loading .bcm-grid-table-wrap{opacity:.55;pointer-events:none}
.bcm-grid-status{padding:0 14px}
.bcm-grid-status:empty{display:none}
.bcm-grid-status__notice{margin:10px 0 0;padding:10px 12px;border:1px solid #d8e2f0;border-radius:4px;background:#f8fbff;color:#244b85;font-weight:600}
.bcm-grid-status__notice.is-loading{background:#fff8e6;border-color:#ead39c;color:#7a5a00}
.bcm-grid-status__notice.is-empty{background:#fff7f7;border-color:#efc7c7;color:#8b2e2e}

.bcm-lookup-control {
    display: flex;
    gap: 8px;
    align-items: center;
}

.bcm-lookup-control select {
    flex: 1 1 auto;
}

.bcm-lookup-add-inline {
    flex: 0 0 auto;
    white-space: nowrap;
}

.bcm-lookup-inline-notice {
    margin-top: 6px;
    font-size: 12px;
    min-height: 18px;
}

.bcm-lookup-inline-notice.is-error {
    color: #b42318;
}

.bcm-lookup-inline-notice.is-success {
    color: #027a48;
}

.bcm-lookup-inline-notice.is-loading {
    color: #475467;
}

/* v0.2.96 - CRUD Libri realmente a larghezza viewport */
.bcm-grid-root[data-grid-type="book"]{
    box-sizing:border-box;
    width:calc(100vw - 32px);
    max-width:none;
    margin-left:calc(50% - 50vw + 16px);
    margin-right:0;
    overflow:visible;
    padding-bottom:4px;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-wrap{
    box-sizing:border-box;
    width:100% !important;
    max-width:none !important;
    min-width:0 !important;
    resize:none;
    overflow:hidden;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-toolbar{
    width:100%;
    box-sizing:border-box;
    display:grid;
    grid-template-columns:auto minmax(280px,1fr) auto;
    align-items:center;
    gap:16px;
    position:relative;
    left:auto;
    min-width:0;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-count{white-space:nowrap}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-search{justify-content:stretch;min-width:0}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-search input{width:100%;max-width:none;min-width:0}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table-wrap{
    width:100%;
    overflow-x:auto;
    overflow-y:auto;
    scrollbar-gutter:stable;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table{
    width:2600px !important;
    min-width:2600px !important;
    table-layout:fixed;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table thead th{padding:6px 8px;font-size:11px;white-space:nowrap}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table td{padding:5px 8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table th:nth-child(1),
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table td:nth-child(1){width:320px}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table th:nth-child(2),
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table td:nth-child(2){width:540px}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table th:nth-child(3),
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table td:nth-child(3){width:85px}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table th:nth-child(4),
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table td:nth-child(4){width:120px}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table th:nth-child(5),
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table td:nth-child(5){width:300px}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table th:nth-child(6),
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table td:nth-child(6){width:180px}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table th:nth-child(7),
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table td:nth-child(7){width:170px}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table th:nth-child(8),
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table td:nth-child(8){width:170px}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table th:nth-child(9),
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table td:nth-child(9),
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table th:nth-child(10),
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table td:nth-child(10){width:90px}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table th:nth-child(11),
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table td:nth-child(11){width:230px}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table th:nth-child(12),
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table td:nth-child(12){width:130px}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table th:last-child,
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table td:last-child{width:260px;min-width:260px}
.bcm-grid-count-separator{display:inline-block;margin:0 8px;opacity:.75}
@media (max-width:780px){
    .bcm-grid-root[data-grid-type="book"]{width:100vw;margin-left:calc(50% - 50vw)}
    .bcm-grid-root[data-grid-type="book"] .bcm-grid-toolbar{grid-template-columns:1fr;gap:8px}
    .bcm-grid-root[data-grid-type="book"] .bcm-grid-add-button{justify-self:start}
}

/* 0.2.97 - azioni CRUD compatte a icona */
.bcm-grid-action{
    display:inline-flex !important;
    align-items:center;
    justify-content:center;
    width:28px;
    height:28px;
    min-width:28px;
    padding:0 !important;
    border:1px solid #cdd6e1;
    border-radius:4px;
    background:#fff;
    color:#244b85;
    text-decoration:none;
    font-size:17px;
    line-height:1;
    cursor:pointer;
    box-sizing:border-box;
}
.bcm-grid-action:hover,.bcm-grid-action:focus{background:#f0f5fb;border-color:#8da7ca}
.bcm-grid-action-delete{color:#b42318}
.bcm-grid-actions{gap:4px !important}

/* 0.2.98 - selettore ordinamento catalogo */
.bcm-grid-sort{display:flex;align-items:center;min-width:220px}
.bcm-grid-sort select{width:100%;min-height:36px;padding:5px 28px 5px 9px;border:1px solid #cdd6e1;border-radius:3px;background:#fff;color:#24364d}

/* 0.2.99 - rifinitura larghezze CRUD e colonna azioni */
.bcm-grid-scroll table.bcm-grid-table th:last-child,
.bcm-grid-scroll table.bcm-grid-table td:last-child{
    width:112px !important;
    min-width:112px !important;
    max-width:112px !important;
    padding-left:6px !important;
    padding-right:6px !important;
    box-sizing:border-box;
}
.bcm-grid-scroll table.bcm-grid-table th:nth-last-child(2),
.bcm-grid-scroll table.bcm-grid-table td:nth-last-child(2){
    width:110px !important;
    min-width:110px !important;
    max-width:110px !important;
}
.bcm-grid-actions{
    width:100%;
    display:flex !important;
    align-items:center;
    justify-content:center;
    gap:4px !important;
    flex-wrap:nowrap !important;
    white-space:nowrap;
}
.bcm-grid-action{
    flex:0 0 26px !important;
    width:26px !important;
    height:26px !important;
    min-width:26px !important;
    max-width:26px !important;
    padding:0 !important;
    margin:0 !important;
    font-size:15px !important;
    line-height:24px !important;
    overflow:hidden;
}
.bcm-grid-action span{
    display:block;
    width:100%;
    text-align:center;
    line-height:24px;
}
/* Più spazio ai dati bibliografici principali. */
.bcm-grid-scroll table.bcm-grid-table th:nth-child(1),
.bcm-grid-scroll table.bcm-grid-table td:nth-child(1){min-width:300px !important;}
.bcm-grid-scroll table.bcm-grid-table th:nth-child(2),
.bcm-grid-scroll table.bcm-grid-table td:nth-child(2){min-width:560px !important;}
.bcm-grid-scroll table.bcm-grid-table th:nth-child(5),
.bcm-grid-scroll table.bcm-grid-table td:nth-child(5){min-width:320px !important;}
.bcm-grid-scroll table.bcm-grid-table th:nth-child(11),
.bcm-grid-scroll table.bcm-grid-table td:nth-child(11){min-width:260px !important;}


/* 0.3.00 - finestra modifica libro compatta e completa */
.bcm-book-modal{padding:12px !important;align-items:center}
.bcm-book-modal .bcm-modal__dialog--large{
    width:min(1240px,calc(100vw - 24px)) !important;
    height:min(900px,calc(100vh - 24px));
    max-height:calc(100vh - 24px) !important;
    overflow:hidden !important;
    display:flex;
    flex-direction:column;
}
.bcm-book-modal .bcm-modal__header{flex:0 0 auto;position:relative;z-index:4}
.bcm-book-modal .bcm-book-form{
    padding:0 !important;
    overflow:hidden;
    min-height:0;
    display:flex;
    flex-direction:column;
    flex:1 1 auto;
}
.bcm-book-form-sections{padding:12px 14px 16px;overflow:auto;min-height:0;flex:1 1 auto;background:#fff}
.bcm-book-form-section{border:1px solid #d8e2ef;border-radius:5px;margin:0 0 12px;background:#fbfdff}
.bcm-book-form-section__title{margin:0;padding:7px 10px;background:#eef4fb;border-bottom:1px solid #d8e2ef;color:#244b85;font-size:13px;font-weight:700}
.bcm-book-form-section .bcm-modal-grid{padding:10px;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px 10px}
.bcm-book-modal .bcm-modal-field{font-size:12px;gap:3px}
.bcm-book-modal .bcm-modal-field input,.bcm-book-modal .bcm-modal-field textarea,.bcm-book-modal .bcm-modal-field select{min-height:32px;padding:5px 8px;font-size:13px}
.bcm-book-modal .bcm-modal-field textarea{min-height:54px;resize:vertical}
.bcm-book-modal .bcm-modal-field--titolo,.bcm-book-modal .bcm-modal-field--titolo_originale,.bcm-book-modal .bcm-modal-field--sottotitolo,.bcm-book-modal .bcm-modal-field--sottotitolo2,.bcm-book-modal .bcm-modal-field--note{grid-column:span 2}
.bcm-book-modal .bcm-modal-field--note{grid-column:1 / -1}
.bcm-book-modal .bcm-lookup-control{display:grid;grid-template-columns:minmax(0,1fr) 34px;gap:5px}
.bcm-book-modal .bcm-lookup-add-inline{width:34px;min-width:34px;padding:0 !important;font-size:0;border-radius:3px}
.bcm-book-modal .bcm-lookup-add-inline::before{content:"+";font-size:20px;line-height:1}
.bcm-book-modal .bcm-modal__footer{flex:0 0 auto;position:sticky;bottom:0;z-index:5;padding:9px 14px;background:#f6f9fd;box-shadow:0 -2px 6px rgba(0,0,0,.06)}
@media (max-width:1000px){.bcm-book-form-section .bcm-modal-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:640px){.bcm-book-modal{padding:4px !important}.bcm-book-modal .bcm-modal__dialog--large{width:calc(100vw - 8px)!important;height:calc(100vh - 8px);max-height:calc(100vh - 8px)!important}.bcm-book-form-section .bcm-modal-grid{grid-template-columns:1fr}.bcm-book-modal .bcm-modal-field--titolo,.bcm-book-modal .bcm-modal-field--titolo_originale,.bcm-book-modal .bcm-modal-field--sottotitolo,.bcm-book-modal .bcm-modal-field--sottotitolo2,.bcm-book-modal .bcm-modal-field--note{grid-column:auto}}
\n\n/* 0.3.01 - colonne CRUD libri senza sovrapposizioni */\n.bcm-grid-root[data-grid-type="book"] .bcm-grid-table{\n    width:2505px !important;\n    min-width:2505px !important;\n    table-layout:fixed !important;\n}\n/* La colonna azioni non deve coprire le colonne catalografiche durante lo scroll. */\n.bcm-grid-root[data-grid-type="book"] .bcm-grid-table th.bcm-col-actions,\n.bcm-grid-root[data-grid-type="book"] .bcm-grid-table td.bcm-col-actions{\n    position:static !important;\n    right:auto !important;\n    z-index:auto !important;\n    box-shadow:none !important;\n    width:110px !important;\n    min-width:110px !important;\n    max-width:110px !important;\n    background:inherit !important;\n    overflow:visible !important;\n}\n.bcm-grid-root[data-grid-type="book"] .bcm-grid-table thead th.bcm-col-actions{background:#eef3f9 !important;}\n.bcm-grid-root[data-grid-type="book"] .bcm-grid-table .bcm-col-autore{width:320px !important;}\n.bcm-grid-root[data-grid-type="book"] .bcm-grid-table .bcm-col-titolo{width:540px !important;}\n.bcm-grid-root[data-grid-type="book"] .bcm-grid-table .bcm-col-anno{width:85px !important;}\n.bcm-grid-root[data-grid-type="book"] .bcm-grid-table .bcm-col-edizione{width:120px !important;}\n.bcm-grid-root[data-grid-type="book"] .bcm-grid-table .bcm-col-editore{width:300px !important;}\n.bcm-grid-root[data-grid-type="book"] .bcm-grid-table .bcm-col-citta{width:180px !important;}\n.bcm-grid-root[data-grid-type="book"] .bcm-grid-table .bcm-col-def_oggett{width:170px !important;}\n.bcm-grid-root[data-grid-type="book"] .bcm-grid-table .bcm-col-livello{width:170px !important;}\n.bcm-grid-root[data-grid-type="book"] .bcm-grid-table .bcm-col-scaffale{width:80px !important;}\n.bcm-grid-root[data-grid-type="book"] .bcm-grid-table .bcm-col-ripiano{width:80px !important;}\n.bcm-grid-root[data-grid-type="book"] .bcm-grid-table .bcm-col-tipografia{width:230px !important;}\n.bcm-grid-root[data-grid-type="book"] .bcm-grid-table .bcm-col-catalogo_n{width:110px !important;}\n.bcm-grid-root[data-grid-type="book"] .bcm-grid-table td.bcm-col-actions{padding-left:5px !important;padding-right:5px !important;}\n

/* 0.3.02 - form libro compatto e ordinato come il CRUD */
.bcm-book-form-sections{padding:8px 10px 10px !important;}
.bcm-book-form-section{margin-bottom:8px !important;}
.bcm-book-form-section__title{padding:5px 8px !important;font-size:12px !important;}
.bcm-book-form-section .bcm-modal-grid{padding:7px 9px !important;gap:5px 9px !important;}
.bcm-book-modal .bcm-modal-field{gap:2px !important;font-size:11px !important;}
.bcm-book-modal .bcm-modal-field > span{line-height:1.15 !important;margin:0 !important;}
.bcm-book-modal .bcm-modal-field input,.bcm-book-modal .bcm-modal-field select{height:26px !important;min-height:26px !important;max-height:26px !important;padding:2px 6px !important;font-size:12px !important;line-height:20px !important;box-sizing:border-box !important;}
.bcm-book-modal .bcm-lookup-control{grid-template-columns:minmax(0,1fr) 28px !important;gap:4px !important;}
.bcm-book-modal .bcm-lookup-add-inline{width:28px !important;min-width:28px !important;height:26px !important;min-height:26px !important;}
.bcm-book-modal .bcm-lookup-add-inline::before{font-size:16px !important;}
.bcm-book-modal .bcm-modal-field textarea{min-height:40px !important;height:40px;padding:4px 6px !important;font-size:12px !important;line-height:1.25 !important;}
.bcm-book-modal .bcm-modal-field--note{grid-column:1 / -1 !important;}
.bcm-book-modal .bcm-modal-field--note textarea{min-height:64px !important;height:64px;}
.bcm-book-modal .bcm-modal-field--titolo{grid-column:auto !important;}
.bcm-book-modal .bcm-modal-field--titolo_originale,.bcm-book-modal .bcm-modal-field--sottotitolo,.bcm-book-modal .bcm-modal-field--sottotitolo2{grid-column:span 2 !important;}
.bcm-book-modal .bcm-modal__footer{padding:6px 12px !important;}

/* 0.3.03 - ricerca compatta ed export CRUD */
.bcm-grid-root[data-grid-type="book"] .bcm-grid-toolbar{
    align-items:center;
    gap:8px;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-search{
    flex:0 1 50% !important;
    width:50% !important;
    max-width:50% !important;
    min-width:260px !important;
    justify-content:flex-start !important;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-search input{
    width:100% !important;
    height:26px !important;
    min-height:26px !important;
    max-height:26px !important;
    padding:2px 8px !important;
    font-size:13px !important;
    line-height:20px !important;
    box-sizing:border-box !important;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-sort select{
    height:30px;
    min-height:30px;
    padding-top:2px;
    padding-bottom:2px;
}
.bcm-grid-export{display:flex;gap:5px;align-items:center;white-space:nowrap}
.bcm-grid-export-button{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    height:28px;
    min-width:44px;
    padding:0 8px;
    border:1px solid #fff;
    border-radius:3px;
    background:#fff;
    color:#244b85;
    text-decoration:none;
    font-weight:700;
    font-size:12px;
    box-sizing:border-box;
}
.bcm-grid-export-button:hover,.bcm-grid-export-button:focus{background:#eef4fb;color:#173b70}
@media (max-width:900px){
    .bcm-grid-root[data-grid-type="book"] .bcm-grid-search{flex-basis:100% !important;width:100% !important;max-width:100% !important;min-width:0 !important}
}


/* 0.3.05 - toolbar CRUD su una sola riga */
.bcm-grid-root[data-grid-type="book"] .bcm-grid-toolbar{
    display:flex !important;
    flex-wrap:nowrap !important;
    justify-content:flex-start !important;
    align-items:center !important;
    gap:7px !important;
    overflow-x:auto;
    overflow-y:hidden;
    white-space:nowrap;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-count{
    flex:0 0 auto;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-search{
    flex:0 1 42% !important;
    width:42% !important;
    max-width:680px !important;
    min-width:260px !important;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-add-button{
    flex:0 0 auto !important;
    height:28px !important;
    min-height:28px !important;
    padding:0 12px !important;
    margin:0 !important;
    white-space:nowrap;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-export{
    flex:0 0 auto;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-sort{
    flex:0 0 330px;
    min-width:330px !important;
    margin-left:auto;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-sort select{
    width:100%;
}
@media (max-width:900px){
    .bcm-grid-root[data-grid-type="book"] .bcm-grid-toolbar{flex-wrap:nowrap !important;}
    .bcm-grid-root[data-grid-type="book"] .bcm-grid-search{flex:0 0 360px !important;width:360px !important;max-width:360px !important;min-width:360px !important;}
}

.bcm-book-cover-editor{display:flex;align-items:center;gap:12px;padding:8px 10px}
.bcm-book-cover-preview{width:92px;height:122px;border:1px solid #c8d2df;background:#f7f9fc;display:flex;align-items:center;justify-content:center;overflow:hidden}
.bcm-book-cover-preview img{width:100%;height:100%;object-fit:contain;background:#fff}
.bcm-book-cover-empty{font-size:11px;line-height:1.25;text-align:center;color:#68778c;padding:6px}
.bcm-book-cover-actions{display:flex;gap:8px;flex-wrap:wrap}


/* 0.3.41 - correzione lato destro CRUD e icone azioni */
.bcm-grid-action-view::before,
.bcm-grid-action-edit::before,
.bcm-grid-action-delete::before{
    content:none !important;
    display:none !important;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table-wrap{
    scrollbar-gutter:auto !important;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table th.bcm-col-actions,
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table td.bcm-col-actions{
    position:static !important;
    right:auto !important;
    width:84px !important;
    min-width:84px !important;
    max-width:84px !important;
    padding:3px 4px !important;
    overflow:hidden !important;
    box-shadow:none !important;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-actions{
    width:76px !important;
    min-width:76px !important;
    max-width:76px !important;
    justify-content:flex-start !important;
    gap:3px !important;
    margin:0 !important;
    padding:0 !important;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-action{
    flex:0 0 23px !important;
    width:23px !important;
    min-width:23px !important;
    max-width:23px !important;
    height:23px !important;
    min-height:23px !important;
    max-height:23px !important;
    border-radius:3px !important;
    font-family:Arial,sans-serif !important;
    font-size:14px !important;
    line-height:21px !important;
    overflow:hidden !important;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-action span{
    display:block !important;
    width:100% !important;
    height:21px !important;
    line-height:21px !important;
    text-align:center !important;
    margin:0 !important;
    padding:0 !important;
}
/* La tabella termina realmente con Azioni: niente spazio artificiale a destra. */
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table{
    width:2469px !important;
    min-width:2469px !important;
}


/* 0.3.41 - CRUD frontend Tabelle realmente uniformi al catalogo Libri */
.bcm-grid-root[data-grid-type="lookup"]{
    box-sizing:border-box;
    width:calc(100vw - 32px) !important;
    max-width:none !important;
    margin-left:calc(50% - 50vw + 16px) !important;
    margin-right:0 !important;
    overflow:visible !important;
}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-wrap{
    width:100% !important;
    max-width:none !important;
    min-width:0 !important;
    overflow:hidden !important;
    resize:none !important;
}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-toolbar{
    width:100% !important;
    box-sizing:border-box !important;
    display:flex !important;
    flex-wrap:nowrap !important;
    justify-content:flex-start !important;
    align-items:center !important;
    gap:7px !important;
    padding:8px 12px !important;
    overflow-x:auto !important;
    overflow-y:hidden !important;
    white-space:nowrap !important;
}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-count{flex:0 0 auto !important;white-space:nowrap !important}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-search{
    flex:0 1 42% !important;
    width:42% !important;
    max-width:680px !important;
    min-width:260px !important;
    justify-content:stretch !important;
}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-search input{
    width:100% !important;
    max-width:none !important;
    min-width:0 !important;
    height:28px !important;
    min-height:28px !important;
    padding:3px 9px !important;
    box-sizing:border-box !important;
}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-add-button,
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-export-button,
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-sort select,
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-order select{
    height:28px !important;
    min-height:28px !important;
    box-sizing:border-box !important;
    margin:0 !important;
}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-add-button{padding:0 12px !important;white-space:nowrap !important}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-export{display:flex !important;gap:4px !important;flex:0 0 auto !important}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-sort{flex:0 0 250px !important;min-width:180px !important;margin-left:auto !important}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-sort select{width:100% !important}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-order{flex:0 0 92px !important}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-order select{width:92px !important}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-table-wrap{
    width:100% !important;
    height:58vh !important;
    min-height:360px !important;
    max-height:620px !important;
    overflow:auto !important;
    scrollbar-gutter:auto !important;
}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-table--lookup{
    width:100% !important;
    table-layout:fixed !important;
    border-collapse:collapse !important;
}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-table--lookup th,
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-table--lookup td{
    height:32px !important;
    padding:5px 8px !important;
    box-sizing:border-box !important;
    white-space:nowrap !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
    vertical-align:middle !important;
}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-table--lookup thead th{
    height:32px !important;
    font-size:11px !important;
    position:sticky !important;
    top:0 !important;
    z-index:3 !important;
}
/* Campi brevi: occupano solo lo spazio necessario; il campo descrittivo assorbe il resto. */
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-table--lookup .bcm-col-codice{width:120px !important}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-table--lookup .bcm-col-provincia{width:120px !important}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-table--lookup .bcm-col-cap{width:100px !important}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-table--lookup .bcm-col-prefisso{width:100px !important}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-table--lookup .bcm-col-sort_order{width:100px !important}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-table--lookup .bcm-col-id{width:80px !important}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-table--lookup .bcm-col-nome,
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-table--lookup .bcm-col-citta{width:auto !important;min-width:280px !important}
/* Azioni sempre ultima colonna reale, senza spazio fantasma. */
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-table--lookup th.bcm-col-actions,
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-table--lookup td.bcm-col-actions{
    position:static !important;
    width:62px !important;
    min-width:62px !important;
    max-width:62px !important;
    padding:3px 4px !important;
    overflow:hidden !important;
    border-right:0 !important;
}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-actions{
    width:54px !important;
    min-width:54px !important;
    max-width:54px !important;
    display:flex !important;
    flex-wrap:nowrap !important;
    justify-content:flex-start !important;
    align-items:center !important;
    gap:4px !important;
    margin:0 !important;
    padding:0 !important;
}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-action{
    flex:0 0 25px !important;
    width:25px !important;
    min-width:25px !important;
    max-width:25px !important;
    height:25px !important;
    min-height:25px !important;
    max-height:25px !important;
    padding:0 !important;
    margin:0 !important;
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
    font-family:Arial,sans-serif !important;
    font-size:15px !important;
    line-height:23px !important;
    border-radius:3px !important;
    overflow:hidden !important;
}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-action span{display:block !important;width:100% !important;line-height:23px !important;text-align:center !important}
.bcm-grid-root[data-grid-type="lookup"] .bcm-grid-footer{width:100% !important;box-sizing:border-box !important}
@media(max-width:900px){
    .bcm-grid-root[data-grid-type="lookup"] .bcm-grid-toolbar{min-width:920px !important}
    .bcm-grid-root[data-grid-type="lookup"] .bcm-grid-search{flex:0 0 340px !important;width:340px !important;min-width:340px !important}
}

.bcm-grid-crud-selector select,.bcm-crud-switcher-standalone select{height:30px;min-width:190px;max-width:260px;padding:2px 28px 2px 8px}
.bcm-grid-crud-selector{flex:0 0 auto}
.bcm-crud-switcher-standalone{display:flex;align-items:center;gap:8px;background:#3264aa;color:#fff;padding:7px 10px;max-width:none}
.bcm-crud-host{width:100%}

/* 0.3.41 - Azioni Libri bloccate a destra e pulsanti raddoppiati */
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table th.bcm-col-actions,
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table td.bcm-col-actions{
    position:sticky !important;
    right:0 !important;
    width:154px !important;
    min-width:154px !important;
    max-width:154px !important;
    padding:4px 6px !important;
    overflow:visible !important;
    box-shadow:-4px 0 8px rgba(0,0,0,.09) !important;
    border-left:1px solid #cdd6e1 !important;
    box-sizing:border-box !important;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table th.bcm-col-actions{
    z-index:12 !important;
    background:#eef3f9 !important;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table td.bcm-col-actions{
    z-index:7 !important;
    background:#fff !important;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-actions{
    width:140px !important;
    min-width:140px !important;
    max-width:140px !important;
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    flex-wrap:nowrap !important;
    gap:4px !important;
    margin:0 auto !important;
    padding:0 !important;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-action{
    flex:0 0 44px !important;
    width:44px !important;
    min-width:44px !important;
    max-width:44px !important;
    height:44px !important;
    min-height:44px !important;
    max-height:44px !important;
    padding:0 !important;
    margin:0 !important;
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
    border-radius:5px !important;
    font-size:22px !important;
    line-height:42px !important;
    box-sizing:border-box !important;
    overflow:hidden !important;
}
.bcm-grid-root[data-grid-type="book"] .bcm-grid-action span{
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    width:100% !important;
    height:42px !important;
    line-height:42px !important;
    text-align:center !important;
    font-size:22px !important;
}
/* Compensa la maggiore larghezza della colonna Azioni mantenendo le altre colonne invariate. */
.bcm-grid-root[data-grid-type="book"] .bcm-grid-table{
    width:2539px !important;
    min-width:2539px !important;
}


/* 0.3.41 - righe CRUD dimezzate in altezza, carattere invariato */
.bcm-grid-table th,
.bcm-grid-table td,
.bcm-lookup-table th,
.bcm-lookup-table td,
.bcm-unified-table th,
.bcm-unified-table td {
    padding-top: 3px !important;
    padding-bottom: 3px !important;
    line-height: 1.15 !important;
    height: auto !important;
    min-height: 0 !important;
    vertical-align: middle !important;
}

/* Tabelle WordPress/legacy inglobate nei CRUD */
.bcm-grid-root table.widefat th,
.bcm-grid-root table.widefat td,
.bcm-grid-root .wp-list-table th,
.bcm-grid-root .wp-list-table td {
    padding-top: 3px !important;
    padding-bottom: 3px !important;
    line-height: 1.15 !important;
    height: auto !important;
}

/* Azioni compatte verticalmente senza ridurre la dimensione delle icone/testo */
.bcm-grid-actions,
.bcm-lookup-actions,
.bcm-table-actions {
    min-height: 0 !important;
    align-items: center !important;
}

/* Le azioni grandi del CRUD libri restano leggibili ma non impongono altezza alla riga */
.bcm-grid-table .bcm-grid-actions {
    height: auto !important;
}
.bcm-grid-table .bcm-grid-action {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* CRUD lookup: elimina altezze minime residue */
.bcm-lookup-table tr,
.bcm-grid-table tr,
.bcm-unified-table tr {
    height: auto !important;
    min-height: 0 !important;
}


/* 0.3.41 - dimensionamento dinamico della grid caricata dalla listbox */
.bcm-crud-host,
.bcm-crud-host > .bcm-grid-root,
.bcm-crud-host > .bcm-lookup-root,
.bcm-crud-switcher-standalone + .bcm-grid-root,
.bcm-crud-switcher-standalone + .bcm-lookup-root {
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
}

.bcm-crud-host .bcm-grid-shell,
.bcm-crud-host .bcm-grid-table-wrap,
.bcm-crud-host .bcm-lookup-shell,
.bcm-crud-host .bcm-lookup-table-wrap {
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
}

/* Tabelle piccole: usa la larghezza disponibile senza lasciare il vecchio box stretto. */
.bcm-crud-host table {
    width: 100% !important;
}

/* Altezza coerente con il CRUD principale e adattata alla finestra. */
.bcm-crud-host .bcm-grid-table-wrap,
.bcm-crud-host .bcm-lookup-table-wrap,
.bcm-crud-host .bcm-unified-table-wrap {
    height: clamp(360px, 58vh, 620px) !important;
    max-height: calc(100vh - 245px) !important;
    overflow: auto !important;
}

/* Il selettore archivio segue esattamente la larghezza della grid sottostante. */
.bcm-crud-switcher-standalone {
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
}


/* 0.3.41 - CRUD selezionati sempre centrati e dimensionati correttamente */
.bcm-crud-host {
    width: min(96vw, 1840px) !important;
    max-width: 1840px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

.bcm-crud-host > .bcm-grid-root,
.bcm-crud-host > .bcm-lookup-root,
.bcm-crud-host .bcm-grid-root,
.bcm-crud-host .bcm-lookup-root {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

/* Il selettore Archivio fa parte dello stesso blocco centrato della griglia. */
.bcm-crud-switcher-standalone {
    width: min(96vw, 1840px) !important;
    max-width: 1840px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

/* Anche il CRUD Libri originario resta centrato quando non è dentro bcm-crud-host. */
.bcm-grid-root[data-grid-type="book"] {
    width: min(96vw, 1840px) !important;
    max-width: 1840px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Lookup piccoli: la toolbar e la tabella occupano tutto il blocco, non una colonna laterale. */
.bcm-crud-host .bcm-grid-wrap,
.bcm-crud-host .bcm-lookup-wrap,
.bcm-crud-host .bcm-grid-shell,
.bcm-crud-host .bcm-lookup-shell,
.bcm-crud-host .bcm-grid-table-wrap,
.bcm-crud-host .bcm-lookup-table-wrap,
.bcm-crud-host .bcm-unified-table-wrap {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}

/* La tabella si adatta al contenitore; resta scrollabile solo se le colonne lo richiedono. */
.bcm-crud-host table.bcm-grid-table,
.bcm-crud-host table.bcm-lookup-table,
.bcm-crud-host table.bcm-unified-table {
    width: 100% !important;
    max-width: none !important;
}

/* Centra anche eventuali contenitori dinamici creati dopo un cambio archivio. */
.bcm-crud-host + .bcm-crud-host,
.bcm-crud-switcher-standalone + .bcm-crud-host {
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Su schermi più piccoli conserva margini laterali minimi. */
@media (max-width: 900px) {
    .bcm-crud-host,
    .bcm-crud-switcher-standalone,
    .bcm-grid-root[data-grid-type="book"] {
        width: calc(100vw - 16px) !important;
        max-width: calc(100vw - 16px) !important;
    }
}


/* 0.3.41 - pacchetto grafico CRUD uniforme */

/* Toolbar: tutti i controlli con la stessa altezza e allineamento */
.bcm-grid-toolbar,
.bcm-lookup-toolbar,
.bcm-unified-toolbar {
    display:flex !important;
    align-items:center !important;
    gap:6px !important;
    min-height:42px !important;
    padding:6px 8px !important;
    box-sizing:border-box !important;
}

.bcm-grid-toolbar input[type="text"],
.bcm-grid-toolbar select,
.bcm-grid-toolbar button,
.bcm-grid-toolbar a,
.bcm-lookup-toolbar input[type="text"],
.bcm-lookup-toolbar select,
.bcm-lookup-toolbar button,
.bcm-lookup-toolbar a,
.bcm-unified-toolbar input[type="text"],
.bcm-unified-toolbar select,
.bcm-unified-toolbar button,
.bcm-unified-toolbar a {
    min-height:30px !important;
    height:30px !important;
    box-sizing:border-box !important;
    display:inline-flex !important;
    align-items:center !important;
}

/* Totali come badge compatto */
.bcm-grid-count,
.bcm-lookup-count,
.bcm-unified-count {
    display:inline-flex !important;
    align-items:center !important;
    min-height:28px !important;
    padding:0 8px !important;
    border-radius:4px !important;
    background:rgba(255,255,255,.12) !important;
    white-space:nowrap !important;
}

/* Ricerca più pulita */
.bcm-grid-search,
.bcm-lookup-search,
.bcm-unified-search {
    position:relative !important;
    flex:1 1 320px !important;
    max-width:520px !important;
}
.bcm-grid-search input,
.bcm-lookup-search input,
.bcm-unified-search input {
    width:100% !important;
    padding-left:28px !important;
    padding-right:26px !important;
}
.bcm-grid-search::before,
.bcm-lookup-search::before,
.bcm-unified-search::before {
    content:"⌕";
    position:absolute;
    left:9px;
    top:50%;
    transform:translateY(-50%);
    z-index:2;
    font-size:15px;
    opacity:.65;
    pointer-events:none;
}

/* Tabelle: righe alternate e hover */
.bcm-grid-table tbody tr:nth-child(even),
.bcm-lookup-table tbody tr:nth-child(even),
.bcm-unified-table tbody tr:nth-child(even),
.bcm-grid-root table.widefat tbody tr:nth-child(even) {
    background:rgba(47,96,161,.035) !important;
}
.bcm-grid-table tbody tr:hover,
.bcm-lookup-table tbody tr:hover,
.bcm-unified-table tbody tr:hover,
.bcm-grid-root table.widefat tbody tr:hover {
    background:rgba(47,96,161,.10) !important;
}

/* Intestazioni più nette */
.bcm-grid-table thead th,
.bcm-lookup-table thead th,
.bcm-unified-table thead th,
.bcm-grid-root table.widefat thead th {
    font-weight:700 !important;
    border-bottom:1px solid #9eb1c8 !important;
    vertical-align:middle !important;
}

/* Prima colonna sticky a sinistra nei CRUD */
.bcm-grid-table thead th:first-child,
.bcm-grid-table tbody td:first-child,
.bcm-lookup-table thead th:first-child,
.bcm-lookup-table tbody td:first-child,
.bcm-unified-table thead th:first-child,
.bcm-unified-table tbody td:first-child {
    position:sticky !important;
    left:0 !important;
    z-index:3 !important;
    background:inherit !important;
    box-shadow:2px 0 3px rgba(0,0,0,.05);
}
.bcm-grid-table thead th:first-child,
.bcm-lookup-table thead th:first-child,
.bcm-unified-table thead th:first-child {
    z-index:5 !important;
}

/* Azioni sticky a destra */
.bcm-grid-table thead th:last-child,
.bcm-grid-table tbody td:last-child,
.bcm-lookup-table thead th:last-child,
.bcm-lookup-table tbody td:last-child,
.bcm-unified-table thead th:last-child,
.bcm-unified-table tbody td:last-child {
    position:sticky !important;
    right:0 !important;
    z-index:4 !important;
    background:#fff !important;
    box-shadow:-2px 0 3px rgba(0,0,0,.06);
}
.bcm-grid-table thead th:last-child,
.bcm-lookup-table thead th:last-child,
.bcm-unified-table thead th:last-child {
    z-index:6 !important;
}

/* Mantiene l'alternanza anche sulle celle sticky */
.bcm-grid-table tbody tr:nth-child(even) td:first-child,
.bcm-grid-table tbody tr:nth-child(even) td:last-child,
.bcm-lookup-table tbody tr:nth-child(even) td:first-child,
.bcm-lookup-table tbody tr:nth-child(even) td:last-child,
.bcm-unified-table tbody tr:nth-child(even) td:first-child,
.bcm-unified-table tbody tr:nth-child(even) td:last-child {
    background:#f8fafc !important;
}
.bcm-grid-table tbody tr:hover td:first-child,
.bcm-grid-table tbody tr:hover td:last-child,
.bcm-lookup-table tbody tr:hover td:first-child,
.bcm-lookup-table tbody tr:hover td:last-child,
.bcm-unified-table tbody tr:hover td:first-child,
.bcm-unified-table tbody tr:hover td:last-child {
    background:#eef4fb !important;
}

/* Azioni uniformi */
.bcm-grid-actions,
.bcm-lookup-actions,
.bcm-table-actions {
    display:flex !important;
    justify-content:center !important;
    align-items:center !important;
    gap:5px !important;
    white-space:nowrap !important;
}
.bcm-grid-action,
.bcm-lookup-action,
.bcm-table-action {
    border-radius:5px !important;
    border:1px solid #c5d1df !important;
    background:#fff !important;
    box-shadow:none !important;
}
.bcm-grid-action:hover,
.bcm-lookup-action:hover,
.bcm-table-action:hover {
    background:#edf4fb !important;
    border-color:#8ca8c9 !important;
}

/* Paginazione più compatta */
.bcm-grid-pagination,
.bcm-lookup-pagination,
.bcm-unified-pagination {
    min-height:38px !important;
    padding:5px 8px !important;
    display:flex !important;
    align-items:center !important;
    gap:5px !important;
}
.bcm-grid-pagination a,
.bcm-grid-pagination button,
.bcm-lookup-pagination a,
.bcm-lookup-pagination button,
.bcm-unified-pagination a,
.bcm-unified-pagination button {
    min-width:30px !important;
    height:30px !important;
    padding:0 8px !important;
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
}

/* Riduce spazio tra titolo pagina, selettore e grid */
.bcm-crud-switcher-standalone {
    margin-top:8px !important;
    margin-bottom:0 !important;
    padding-top:6px !important;
    padding-bottom:6px !important;
}
.bcm-crud-host {
    margin-top:0 !important;
}

/* Modali coerenti e più "gestionali" */
.bcm-modal__dialog {
    border-radius:6px !important;
    overflow:hidden !important;
    box-shadow:0 12px 40px rgba(0,0,0,.22) !important;
}
.bcm-modal__header {
    min-height:38px !important;
    padding:6px 12px !important;
}
.bcm-modal__footer {
    min-height:42px !important;
    padding:6px 10px !important;
}
.bcm-modal-field > span {
    font-weight:600 !important;
}

/* Stato vuoto / nessun risultato */
.bcm-grid-empty,
.bcm-lookup-empty,
.bcm-unified-empty,
.bcm-grid-status__notice.is-empty {
    text-align:center !important;
    padding:28px 12px !important;
    color:#5f6f82 !important;
    font-style:italic !important;
}

/* Responsive: evita spezzature disordinate */
@media (max-width: 1100px) {
    .bcm-grid-toolbar,
    .bcm-lookup-toolbar,
    .bcm-unified-toolbar {
        flex-wrap:nowrap !important;
        overflow-x:auto !important;
    }
    .bcm-grid-search,
    .bcm-lookup-search,
    .bcm-unified-search {
        min-width:240px !important;
    }
}


/* 0.3.41 - pulsante X funzionale per azzerare la ricerca */
.bcm-grid-search,
.bcm-lookup-search,
.bcm-unified-search {
    position: relative !important;
}

.bcm-search-clear {
    position:absolute !important;
    right:5px !important;
    top:50% !important;
    transform:translateY(-50%) !important;
    width:22px !important;
    height:22px !important;
    min-width:22px !important;
    min-height:22px !important;
    padding:0 !important;
    margin:0 !important;
    border:0 !important;
    border-radius:50% !important;
    background:transparent !important;
    color:#66758a !important;
    font-size:18px !important;
    line-height:20px !important;
    display:none !important;
    align-items:center !important;
    justify-content:center !important;
    cursor:pointer !important;
    z-index:3 !important;
}

.bcm-search-clear.is-visible {
    display:inline-flex !important;
}

.bcm-search-clear:hover,
.bcm-search-clear:focus {
    background:#e8eef6 !important;
    color:#1f3f68 !important;
    outline:none !important;
}

.bcm-grid-search input[type="text"],
.bcm-lookup-search input[type="text"],
.bcm-unified-search input[type="text"] {
    padding-right:32px !important;
}


/* 0.3.41 - responsive tablet per tutti i CRUD */
@media (max-width: 1180px) {
    .bcm-crud-host,
    .bcm-crud-switcher-standalone,
    .bcm-grid-root,
    .bcm-lookup-root {
        width: calc(100vw - 20px) !important;
        max-width: calc(100vw - 20px) !important;
        margin-left:auto !important;
        margin-right:auto !important;
        box-sizing:border-box !important;
    }

    .bcm-grid-toolbar,
    .bcm-lookup-toolbar,
    .bcm-unified-toolbar {
        display:flex !important;
        flex-wrap:wrap !important;
        align-items:center !important;
        gap:5px !important;
        height:auto !important;
        min-height:42px !important;
        overflow:visible !important;
    }

    .bcm-grid-crud-selector,
    .bcm-crud-switcher-standalone select {
        flex:0 1 230px !important;
    }

    .bcm-grid-search,
    .bcm-lookup-search,
    .bcm-unified-search {
        flex:1 1 260px !important;
        min-width:200px !important;
        max-width:none !important;
    }

    .bcm-grid-table-wrap,
    .bcm-lookup-table-wrap,
    .bcm-unified-table-wrap,
    .bcm-crud-host .bcm-grid-table-wrap,
    .bcm-crud-host .bcm-lookup-table-wrap {
        width:100% !important;
        max-width:100% !important;
        overflow-x:auto !important;
        overflow-y:auto !important;
        -webkit-overflow-scrolling:touch !important;
        touch-action:pan-x pan-y !important;
        height:clamp(330px, 58vh, 570px) !important;
    }

    .bcm-grid-table,
    .bcm-lookup-table,
    .bcm-unified-table {
        min-width:max-content !important;
    }

    /* Prima colonna e azioni sempre raggiungibili anche su tablet */
    .bcm-grid-table th:first-child,
    .bcm-grid-table td:first-child,
    .bcm-lookup-table th:first-child,
    .bcm-lookup-table td:first-child,
    .bcm-unified-table th:first-child,
    .bcm-unified-table td:first-child {
        position:sticky !important;
        left:0 !important;
    }
    .bcm-grid-table th:last-child,
    .bcm-grid-table td:last-child,
    .bcm-lookup-table th:last-child,
    .bcm-lookup-table td:last-child,
    .bcm-unified-table th:last-child,
    .bcm-unified-table td:last-child {
        position:sticky !important;
        right:0 !important;
    }

    .bcm-modal__dialog,
    .bcm-book-modal .bcm-modal__dialog {
        width:calc(100vw - 24px) !important;
        max-width:calc(100vw - 24px) !important;
        max-height:calc(100vh - 24px) !important;
        margin:12px auto !important;
    }

    .bcm-modal__body,
    .bcm-book-form-sections {
        overflow-y:auto !important;
        -webkit-overflow-scrolling:touch !important;
    }

    .bcm-book-form-section .bcm-modal-grid,
    .bcm-modal-grid {
        grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    }

    button,
    .bcm-button,
    .bcm-grid-action,
    .bcm-lookup-action {
        touch-action:manipulation !important;
    }

    .bcm-grid-pagination,
    .bcm-lookup-pagination,
    .bcm-unified-pagination {
        flex-wrap:wrap !important;
        height:auto !important;
    }
}

/* Tablet verticale / telefoni grandi */
@media (max-width: 780px) {
    .bcm-crud-host,
    .bcm-crud-switcher-standalone,
    .bcm-grid-root,
    .bcm-lookup-root {
        width:calc(100vw - 12px) !important;
        max-width:calc(100vw - 12px) !important;
    }

    .bcm-grid-toolbar,
    .bcm-lookup-toolbar,
    .bcm-unified-toolbar {
        padding:5px !important;
    }

    .bcm-grid-crud-selector,
    .bcm-grid-crud-selector select,
    .bcm-crud-switcher-standalone select,
    .bcm-grid-search,
    .bcm-lookup-search,
    .bcm-unified-search {
        flex:1 1 100% !important;
        width:100% !important;
        min-width:0 !important;
        max-width:none !important;
    }

    .bcm-grid-toolbar input,
    .bcm-grid-toolbar select,
    .bcm-grid-toolbar button,
    .bcm-grid-toolbar a,
    .bcm-lookup-toolbar input,
    .bcm-lookup-toolbar select,
    .bcm-lookup-toolbar button,
    .bcm-lookup-toolbar a {
        min-height:36px !important;
        height:36px !important;
    }

    .bcm-book-form-section .bcm-modal-grid,
    .bcm-modal-grid {
        grid-template-columns:1fr !important;
    }
    .bcm-book-modal .bcm-modal-field--titolo_originale,
    .bcm-book-modal .bcm-modal-field--sottotitolo,
    .bcm-book-modal .bcm-modal-field--sottotitolo2,
    .bcm-book-modal .bcm-modal-field--note {
        grid-column:1 !important;
    }

    .bcm-grid-table-wrap,
    .bcm-lookup-table-wrap,
    .bcm-unified-table-wrap {
        height:calc(100vh - 280px) !important;
        min-height:300px !important;
    }

    /* target touch sufficient senza modificare il font */
    .bcm-grid-action,
    .bcm-lookup-action,
    .bcm-table-action {
        min-width:38px !important;
        min-height:38px !important;
    }
}


/* 0.3.41 - controllo completo form Nuovo/Modifica frontend */
.bcm-modal__dialog,
.bcm-book-modal .bcm-modal__dialog {
    width:min(760px,96vw) !important;
    max-height:94vh !important;
    display:flex !important;
    flex-direction:column !important;
}
.bcm-book-modal .bcm-modal__dialog--large {
    width:min(1380px,97vw) !important;
}
.bcm-modal__body {
    min-height:0 !important;
    overflow:auto !important;
}
.bcm-book-form,
.bcm-lookup-form {
    display:flex !important;
    flex-direction:column !important;
}
.bcm-book-form-sections {
    flex:1 1 auto !important;
    min-height:0 !important;
    overflow:auto !important;
}
.bcm-book-modal .bcm-modal__footer,
.bcm-lookup-modal .bcm-modal__footer {
    position:sticky !important;
    bottom:0 !important;
    z-index:8 !important;
    background:#fff !important;
    border-top:1px solid #dbe3ec !important;
}
.bcm-modal-field input,
.bcm-modal-field select {
    width:100% !important;
    height:28px !important;
    min-height:28px !important;
    box-sizing:border-box !important;
}
.bcm-modal-field textarea {
    width:100% !important;
    min-height:56px !important;
    box-sizing:border-box !important;
    resize:vertical !important;
}
.bcm-modal-grid--lookup {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
}
.bcm-lookup-modal .bcm-modal__dialog {
    width:min(720px,94vw) !important;
}
.bcm-modal__footer button,
.bcm-book-cover-actions button {
    min-height:32px !important;
}
@media(max-width:900px){
    .bcm-book-modal .bcm-modal__dialog--large,
    .bcm-modal__dialog,
    .bcm-lookup-modal .bcm-modal__dialog{
        width:calc(100vw - 20px) !important;
        max-width:calc(100vw - 20px) !important;
        max-height:calc(100vh - 20px) !important;
        margin:10px auto !important;
    }
    .bcm-book-form-section .bcm-modal-grid,
    .bcm-modal-grid--lookup{
        grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    }
}
@media(max-width:650px){
    .bcm-book-form-section .bcm-modal-grid,
    .bcm-modal-grid--lookup{
        grid-template-columns:1fr !important;
    }
    .bcm-modal-field,
    .bcm-book-modal .bcm-modal-field--titolo_originale,
    .bcm-book-modal .bcm-modal-field--sottotitolo,
    .bcm-book-modal .bcm-modal-field--sottotitolo2,
    .bcm-book-modal .bcm-modal-field--note{
        grid-column:1 !important;
    }
    .bcm-modal__footer{
        flex-wrap:wrap !important;
    }
}


/* 0.3.41 - centratura reale rispetto al viewport + righe ancora più compatte */

/*
 * Il tema può racchiudere lo shortcode in una colonna molto stretta.
 * In quel caso un width:96vw parte dal bordo sinistro del contenitore e
 * appare spostato a destra. Queste regole centrano il CRUD sul viewport.
 */
.bcm-grid-root,
.bcm-lookup-root,
.bcm-crud-host,
.bcm-crud-switcher-standalone {
    width: min(96vw, 1840px) !important;
    max-width: min(96vw, 1840px) !important;
    margin-left: calc(50% - min(48vw, 920px)) !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
}

/* Se un CRUD dinamico è già dentro il contenitore centrato, non applicare
   una seconda traslazione ai figli. */
.bcm-crud-host > .bcm-grid-root,
.bcm-crud-host > .bcm-lookup-root,
.bcm-crud-host .bcm-grid-root,
.bcm-crud-host .bcm-lookup-root {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Selettore + toolbar + griglia perfettamente allineati */
.bcm-grid-toolbar,
.bcm-lookup-toolbar,
.bcm-unified-toolbar,
.bcm-grid-wrap,
.bcm-lookup-wrap,
.bcm-grid-table-wrap,
.bcm-lookup-table-wrap {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Righe dimezzate ulteriormente senza toccare il font */
.bcm-grid-table th,
.bcm-grid-table td,
.bcm-lookup-table th,
.bcm-lookup-table td,
.bcm-unified-table th,
.bcm-unified-table td {
    padding-top: 1px !important;
    padding-bottom: 1px !important;
    line-height: 1.05 !important;
    height: 24px !important;
    min-height: 24px !important;
    max-height: none !important;
    vertical-align: middle !important;
}

/* Evita che i pulsanti Azioni alzino la riga */
.bcm-grid-actions,
.bcm-lookup-actions,
.bcm-table-actions,
.bcm-unified-actions {
    min-height: 0 !important;
    height: 22px !important;
    align-items: center !important;
}

.bcm-grid-action,
.bcm-lookup-action,
.bcm-table-action,
.bcm-icon-action {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* Su tablet conserva la centratura rispetto allo schermo */
@media (max-width: 1180px) {
    .bcm-grid-root,
    .bcm-lookup-root,
    .bcm-crud-host,
    .bcm-crud-switcher-standalone {
        width: calc(100vw - 16px) !important;
        max-width: calc(100vw - 16px) !important;
        margin-left: calc(50% - 50vw + 8px) !important;
    }

    .bcm-crud-host > .bcm-grid-root,
    .bcm-crud-host > .bcm-lookup-root,
    .bcm-crud-host .bcm-grid-root,
    .bcm-crud-host .bcm-lookup-root {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
    }
}


/* 0.3.41 - indicatori attesa CRUD */
.bcm-crud-global-wait{
    position:fixed;
    top:16px;
    right:16px;
    z-index:1000000;
    display:flex;
    align-items:center;
    gap:8px;
    min-height:34px;
    padding:7px 12px;
    border:1px solid #aebed0;
    border-radius:6px;
    background:#fff;
    box-shadow:0 4px 18px rgba(0,0,0,.16);
    color:#1f3f68;
    font-size:12px;
    font-weight:600;
}
.bcm-crud-global-wait[hidden]{display:none!important}
.bcm-crud-wait-spinner{
    width:15px;
    height:15px;
    border:2px solid #cbd6e3;
    border-top-color:#2f64a7;
    border-radius:50%;
    animation:bcmCrudSpin .7s linear infinite;
}
@keyframes bcmCrudSpin{to{transform:rotate(360deg)}}

.bcm-grid-wrap.is-loading,
.bcm-lookup-wrap.is-loading{
    position:relative;
}
.bcm-grid-wrap.is-loading::after,
.bcm-lookup-wrap.is-loading::after{
    content:"";
    position:absolute;
    inset:0;
    z-index:30;
    background:rgba(255,255,255,.35);
    pointer-events:none;
}


/* 0.3.41 - lookup relazionali ricercabili nel form Libro */
.bcm-lookup-control--searchable{
    display:flex !important;
    flex-direction:column !important;
    gap:4px !important;
    width:100% !important;
}
.bcm-lookup-search-row,
.bcm-lookup-select-row{
    display:flex !important;
    align-items:center !important;
    gap:4px !important;
    width:100% !important;
}
.bcm-lookup-option-search{
    flex:1 1 auto !important;
    width:100% !important;
    min-width:0 !important;
    height:28px !important;
    min-height:28px !important;
}
.bcm-lookup-search-clear{
    width:28px !important;
    min-width:28px !important;
    height:28px !important;
    padding:0 !important;
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
    font-size:18px !important;
    line-height:1 !important;
}
.bcm-lookup-select-row select{
    flex:1 1 auto !important;
    min-width:0 !important;
}
.bcm-lookup-add-inline{
    flex:0 0 auto !important;
    white-space:nowrap !important;
}
.bcm-lookup-filter-count{
    min-height:12px;
    font-size:10px;
    color:#65758a;
}
@media(max-width:650px){
    .bcm-lookup-select-row{
        align-items:stretch !important;
    }
    .bcm-lookup-add-inline{
        min-height:34px !important;
    }
}


/* 0.3.41 - CRUD più largo e centrato come layout approvato */
@media (min-width: 1181px) {
    .bcm-crud-host,
    .bcm-grid-root,
    .bcm-lookup-root,
    .bcm-crud-switcher-standalone {
        width: min(94vw, 1900px) !important;
        max-width: min(94vw, 1900px) !important;
        position: relative !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-sizing: border-box !important;
    }

    /* Evita una seconda centratura sui CRUD caricati dentro il contenitore principale */
    .bcm-crud-host > .bcm-grid-root,
    .bcm-crud-host > .bcm-lookup-root,
    .bcm-crud-host .bcm-grid-root,
    .bcm-crud-host .bcm-lookup-root {
        width: 100% !important;
        max-width: 100% !important;
        left: auto !important;
        transform: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .bcm-grid-toolbar,
    .bcm-lookup-toolbar,
    .bcm-unified-toolbar,
    .bcm-grid-wrap,
    .bcm-lookup-wrap,
    .bcm-grid-table-wrap,
    .bcm-lookup-table-wrap,
    .bcm-unified-table-wrap {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* Tablet: quasi tutta la larghezza disponibile ma sempre centrato */
@media (min-width: 781px) and (max-width: 1180px) {
    .bcm-crud-host,
    .bcm-grid-root,
    .bcm-lookup-root,
    .bcm-crud-switcher-standalone {
        width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
        position: relative !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .bcm-crud-host > .bcm-grid-root,
    .bcm-crud-host > .bcm-lookup-root,
    .bcm-crud-host .bcm-grid-root,
    .bcm-crud-host .bcm-lookup-root {
        width: 100% !important;
        max-width: 100% !important;
        left: auto !important;
        transform: none !important;
    }
}


/* 0.3.41 - form Nuovo/Modifica Libro più largo e realmente centrato */
.bcm-book-modal {
    position: fixed !important;
    inset: 0 !important;
    z-index: 999999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 14px !important;
    box-sizing: border-box !important;
}

.bcm-book-modal[hidden] {
    display: none !important;
}

.bcm-book-modal .bcm-modal__backdrop {
    position: absolute !important;
    inset: 0 !important;
}

.bcm-book-modal .bcm-modal__dialog,
.bcm-book-modal .bcm-modal__dialog--large {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    transform: none !important;

    width: min(96vw, 1680px) !important;
    max-width: min(96vw, 1680px) !important;
    min-width: 0 !important;

    height: min(92vh, 940px) !important;
    max-height: min(92vh, 940px) !important;

    margin: 0 auto !important;
    box-sizing: border-box !important;

    display: flex !important;
    flex-direction: column !important;
}

.bcm-book-modal .bcm-modal__header {
    flex: 0 0 auto !important;
}

.bcm-book-modal .bcm-book-form {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
}

.bcm-book-modal .bcm-book-form-sections {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
}

.bcm-book-modal .bcm-modal__footer {
    flex: 0 0 auto !important;
    position: sticky !important;
    bottom: 0 !important;
    z-index: 20 !important;
    background: #fff !important;
}

/* Più campi per riga sui desktop larghi */
@media (min-width: 1400px) {
    .bcm-book-modal .bcm-book-form-section .bcm-modal-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
        gap: 7px 10px !important;
    }

    .bcm-book-modal .bcm-modal-field--titolo,
    .bcm-book-modal .bcm-modal-field--titolo_originale,
    .bcm-book-modal .bcm-modal-field--sottotitolo,
    .bcm-book-modal .bcm-modal-field--sottotitolo2,
    .bcm-book-modal .bcm-modal-field--note {
        grid-column: span 2 !important;
    }
}

/* Desktop normale: 4 colonne */
@media (min-width: 1000px) and (max-width: 1399px) {
    .bcm-book-modal .bcm-book-form-section .bcm-modal-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 7px 10px !important;
    }

    .bcm-book-modal .bcm-modal-field--titolo,
    .bcm-book-modal .bcm-modal-field--titolo_originale,
    .bcm-book-modal .bcm-modal-field--sottotitolo,
    .bcm-book-modal .bcm-modal-field--sottotitolo2,
    .bcm-book-modal .bcm-modal-field--note {
        grid-column: span 2 !important;
    }
}

/* Tablet */
@media (min-width: 701px) and (max-width: 999px) {
    .bcm-book-modal {
        padding: 10px !important;
    }

    .bcm-book-modal .bcm-modal__dialog,
    .bcm-book-modal .bcm-modal__dialog--large {
        width: calc(100vw - 20px) !important;
        max-width: calc(100vw - 20px) !important;
        height: calc(100vh - 20px) !important;
        max-height: calc(100vh - 20px) !important;
    }

    .bcm-book-modal .bcm-book-form-section .bcm-modal-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* Smartphone */
@media (max-width: 700px) {
    .bcm-book-modal {
        padding: 6px !important;
        align-items: stretch !important;
    }

    .bcm-book-modal .bcm-modal__dialog,
    .bcm-book-modal .bcm-modal__dialog--large {
        width: calc(100vw - 12px) !important;
        max-width: calc(100vw - 12px) !important;
        height: calc(100vh - 12px) !important;
        max-height: calc(100vh - 12px) !important;
    }

    .bcm-book-modal .bcm-book-form-section .bcm-modal-grid {
        grid-template-columns: 1fr !important;
    }

    .bcm-book-modal .bcm-modal-field--titolo,
    .bcm-book-modal .bcm-modal-field--titolo_originale,
    .bcm-book-modal .bcm-modal-field--sottotitolo,
    .bcm-book-modal .bcm-modal-field--sottotitolo2,
    .bcm-book-modal .bcm-modal-field--note {
        grid-column: 1 !important;
    }
}


/* 0.3.41 - un solo campo Cerca per ogni relazione + form più compatto */

/* Alcuni temi/plugin trasformano il SELECT aggiungendo una seconda casella
   di ricerca dentro la riga della selezione. Nel form Libro deve rimanere
   esclusivamente il nostro campo "Cerca ...". */
.bcm-book-modal .bcm-lookup-select-row input[type="search"],
.bcm-book-modal .bcm-lookup-select-row input[type="text"],
.bcm-book-modal .bcm-lookup-select-row .search-field,
.bcm-book-modal .bcm-lookup-select-row .select-search,
.bcm-book-modal .bcm-lookup-select-row [class*="search"]:not(select):not(button) {
    display:none !important;
}

/* Anche eventuali wrapper di ricerca inseriti accanto al select vengono
   neutralizzati senza nascondere il SELECT vero e proprio. */
.bcm-book-modal .bcm-lookup-select-row > div:not(:has(select)):not(:has(button)) {
    display:none !important;
}

/* Mantiene il select nativo sempre visibile e utilizzabile. */
.bcm-book-modal .bcm-lookup-select-row select[data-bcm-lookup-field] {
    display:block !important;
    visibility:visible !important;
    opacity:1 !important;
    flex:1 1 auto !important;
    width:auto !important;
    min-width:0 !important;
}

/* Compattazione verticale generale del form. */
.bcm-book-modal .bcm-modal__header {
    min-height:34px !important;
    padding:6px 12px !important;
}
.bcm-book-modal .bcm-modal__title {
    margin:0 !important;
    line-height:22px !important;
}
.bcm-book-modal .bcm-book-form-sections {
    padding:5px 8px !important;
}
.bcm-book-modal .bcm-book-form-section {
    margin:0 0 6px !important;
    padding:0 !important;
}
.bcm-book-modal .bcm-book-form-section__title {
    margin:0 !important;
    padding:4px 8px !important;
    min-height:0 !important;
    line-height:16px !important;
    font-size:12px !important;
}
.bcm-book-modal .bcm-book-form-section .bcm-modal-grid {
    padding:5px 8px !important;
    gap:4px 8px !important;
}
.bcm-book-modal .bcm-modal-field {
    gap:1px !important;
    margin:0 !important;
}
.bcm-book-modal .bcm-modal-field > span {
    margin:0 !important;
    line-height:13px !important;
    font-size:10.5px !important;
}

/* Campi normali più bassi, carattere invariato. */
.bcm-book-modal .bcm-modal-field input:not(.bcm-lookup-option-search),
.bcm-book-modal .bcm-modal-field select {
    height:24px !important;
    min-height:24px !important;
    padding-top:1px !important;
    padding-bottom:1px !important;
}
.bcm-book-modal .bcm-modal-field textarea {
    min-height:34px !important;
    height:34px !important;
    padding:2px 5px !important;
}
.bcm-book-modal .bcm-modal-field--note textarea {
    min-height:46px !important;
    height:46px !important;
}

/* Relazioni: meno spazio tra Cerca, select e messaggi. */
.bcm-book-modal .bcm-lookup-control--searchable {
    gap:2px !important;
}
.bcm-book-modal .bcm-lookup-search-row,
.bcm-book-modal .bcm-lookup-select-row {
    gap:3px !important;
}
.bcm-book-modal .bcm-lookup-option-search {
    height:24px !important;
    min-height:24px !important;
    padding:1px 5px !important;
}
.bcm-book-modal .bcm-lookup-search-clear,
.bcm-book-modal .bcm-lookup-add-inline {
    width:24px !important;
    min-width:24px !important;
    height:24px !important;
    min-height:24px !important;
    padding:0 !important;
}
.bcm-book-modal .bcm-lookup-filter-count {
    min-height:0 !important;
    height:auto !important;
    line-height:10px !important;
    margin:0 !important;
    font-size:9px !important;
}
.bcm-book-modal .bcm-lookup-inline-notice {
    min-height:0 !important;
    margin-top:1px !important;
    line-height:11px !important;
    font-size:10px !important;
}
.bcm-book-modal .bcm-lookup-inline-notice:empty {
    display:none !important;
}

/* Footer più basso. */
.bcm-book-modal .bcm-modal__footer {
    min-height:34px !important;
    padding:4px 10px !important;
}
.bcm-book-modal .bcm-modal__footer button {
    min-height:26px !important;
    height:26px !important;
    padding-top:2px !important;
    padding-bottom:2px !important;
}


/* 0.3.41 - densità verticale -30% in TUTTI i CRUD e form.
   IMPORTANTE: nessuna modifica a font-size. */

/* Tabelle CRUD: riduzione esclusivamente di padding/altezza */
.bcm-grid-root table th,
.bcm-grid-root table td,
.bcm-lookup-root table th,
.bcm-lookup-root table td,
.bcm-crud-host table th,
.bcm-crud-host table td {
    padding-top: 2px !important;
    padding-bottom: 2px !important;
    height: 24px !important;
    min-height: 24px !important;
    line-height: normal !important;
}

/* Barre strumenti CRUD */
.bcm-grid-toolbar,
.bcm-lookup-toolbar,
.bcm-unified-toolbar {
    min-height: 30px !important;
    padding-top: 3px !important;
    padding-bottom: 3px !important;
}

/* Form Nuovo/Modifica di qualsiasi CRUD */
.bcm-modal__dialog .bcm-modal-grid,
.bcm-modal__dialog--large .bcm-modal-grid,
.bcm-book-modal .bcm-modal-grid {
    row-gap: 3px !important;
}

.bcm-modal__dialog .bcm-modal-field,
.bcm-modal__dialog--large .bcm-modal-field,
.bcm-book-modal .bcm-modal-field {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    gap: 1px !important;
}

/* Input/select: altezza ridotta, font ereditato e NON modificato */
.bcm-modal__dialog input:not([type="checkbox"]):not([type="radio"]),
.bcm-modal__dialog select,
.bcm-modal__dialog--large input:not([type="checkbox"]):not([type="radio"]),
.bcm-modal__dialog--large select,
.bcm-book-modal input:not([type="checkbox"]):not([type="radio"]),
.bcm-book-modal select {
    height: 22px !important;
    min-height: 22px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Textarea: compatte ma ancora leggibili */
.bcm-modal__dialog textarea,
.bcm-modal__dialog--large textarea,
.bcm-book-modal textarea {
    min-height: 30px !important;
    height: 30px !important;
    padding-top: 2px !important;
    padding-bottom: 2px !important;
}

.bcm-book-modal .bcm-modal-field--note textarea {
    min-height: 38px !important;
    height: 38px !important;
}

/* Sezioni form */
.bcm-book-form-sections,
.bcm-modal__body {
    padding-top: 3px !important;
    padding-bottom: 3px !important;
}
.bcm-book-form-section {
    margin-bottom: 4px !important;
}
.bcm-book-form-section__title {
    padding-top: 2px !important;
    padding-bottom: 2px !important;
}

/* Controlli relazionali: stessa riduzione verticale */
.bcm-lookup-option-search,
.bcm-lookup-search-clear,
.bcm-lookup-add-inline,
.bcm-lookup-select-row select {
    height: 22px !important;
    min-height: 22px !important;
}

/* Footer e pulsanti form: riduzione spazio, NON carattere */
.bcm-modal__footer {
    min-height: 30px !important;
    padding-top: 3px !important;
    padding-bottom: 3px !important;
}
.bcm-modal__footer button {
    min-height: 24px !important;
    height: 24px !important;
    padding-top: 1px !important;
    padding-bottom: 1px !important;
}


/* 0.3.41 - rifinitura grafica coerente per tutti i CRUD
   SOLO ASPETTO: nessuna modifica a logica, database o dimensione caratteri. */

:root {
    --bcm-blue: #2f64a7;
    --bcm-blue-dark: #234f88;
    --bcm-blue-soft: #edf4fb;
    --bcm-border: #d6e0eb;
    --bcm-border-strong: #b9c9da;
    --bcm-row-alt: #f8fbfe;
    --bcm-row-hover: #eef5fc;
    --bcm-text-muted: #65758a;
    --bcm-danger: #b42318;
}

/* Contenitore principale */
.bcm-grid-root,
.bcm-lookup-root,
.bcm-crud-host {
    border-radius: 8px !important;
    overflow: hidden !important;
    box-shadow: 0 3px 14px rgba(32, 64, 98, .10) !important;
    border: 1px solid var(--bcm-border) !important;
    background: #fff !important;
}

/* Toolbar */
.bcm-grid-toolbar,
.bcm-lookup-toolbar,
.bcm-unified-toolbar {
    background: linear-gradient(180deg, var(--bcm-blue) 0%, var(--bcm-blue-dark) 100%) !important;
    border: 0 !important;
    gap: 6px !important;
    box-shadow: inset 0 -1px 0 rgba(255,255,255,.12) !important;
}

/* Contatore record come badge */
.bcm-grid-count,
.bcm-lookup-count,
.bcm-unified-count {
    display: inline-flex !important;
    align-items: center !important;
    min-height: 22px !important;
    padding: 1px 7px !important;
    border-radius: 5px !important;
    background: rgba(255,255,255,.16) !important;
    border: 1px solid rgba(255,255,255,.20) !important;
    color: #fff !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
}

/* Input toolbar */
.bcm-grid-toolbar input,
.bcm-grid-toolbar select,
.bcm-lookup-toolbar input,
.bcm-lookup-toolbar select,
.bcm-unified-toolbar input,
.bcm-unified-toolbar select {
    border: 1px solid rgba(0,0,0,.14) !important;
    border-radius: 4px !important;
    background: #fff !important;
    box-shadow: none !important;
    transition: border-color .15s ease, box-shadow .15s ease !important;
}

.bcm-grid-toolbar input:focus,
.bcm-grid-toolbar select:focus,
.bcm-lookup-toolbar input:focus,
.bcm-lookup-toolbar select:focus,
.bcm-unified-toolbar input:focus,
.bcm-unified-toolbar select:focus {
    border-color: #8fb2d9 !important;
    box-shadow: 0 0 0 2px rgba(255,255,255,.26) !important;
    outline: none !important;
}

/* Pulsanti toolbar */
.bcm-grid-toolbar button,
.bcm-grid-toolbar .bcm-grid-export-button,
.bcm-lookup-toolbar button,
.bcm-lookup-toolbar .bcm-grid-export-button,
.bcm-unified-toolbar button,
.bcm-unified-toolbar .bcm-grid-export-button {
    border-radius: 4px !important;
    border: 1px solid rgba(0,0,0,.10) !important;
    background: #fff !important;
    color: var(--bcm-blue-dark) !important;
    box-shadow: 0 1px 1px rgba(0,0,0,.04) !important;
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease !important;
}

.bcm-grid-toolbar button:hover,
.bcm-grid-toolbar .bcm-grid-export-button:hover,
.bcm-lookup-toolbar button:hover,
.bcm-lookup-toolbar .bcm-grid-export-button:hover,
.bcm-unified-toolbar button:hover,
.bcm-unified-toolbar .bcm-grid-export-button:hover {
    background: #f6f9fd !important;
    box-shadow: 0 2px 5px rgba(0,0,0,.10) !important;
}

/* Ricerca principale */
.bcm-grid-search,
.bcm-lookup-search,
.bcm-unified-search {
    position: relative !important;
}

.bcm-grid-search::before,
.bcm-lookup-search::before,
.bcm-unified-search::before {
    content: "⌕";
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #7b8da3;
    pointer-events: none;
    z-index: 2;
}

.bcm-grid-search input,
.bcm-lookup-search input,
.bcm-unified-search input {
    padding-left: 25px !important;
}

/* Intestazioni tabella */
.bcm-grid-table thead th,
.bcm-lookup-table thead th,
.bcm-unified-table thead th {
    background: var(--bcm-blue-soft) !important;
    color: #1f3f68 !important;
    border-color: var(--bcm-border-strong) !important;
    font-weight: 700 !important;
    box-shadow: inset 0 -1px 0 #cbd8e6 !important;
}

/* Righe alternate + hover */
.bcm-grid-table tbody tr:nth-child(even) td,
.bcm-lookup-table tbody tr:nth-child(even) td,
.bcm-unified-table tbody tr:nth-child(even) td {
    background: var(--bcm-row-alt) !important;
}

.bcm-grid-table tbody tr:hover td,
.bcm-lookup-table tbody tr:hover td,
.bcm-unified-table tbody tr:hover td {
    background: var(--bcm-row-hover) !important;
}

.bcm-grid-table td,
.bcm-lookup-table td,
.bcm-unified-table td {
    border-color: #dde5ee !important;
    transition: background .12s ease !important;
}

/* Sticky: lieve ombra per far capire la separazione */
.bcm-grid-table th:first-child,
.bcm-grid-table td:first-child,
.bcm-lookup-table th:first-child,
.bcm-lookup-table td:first-child,
.bcm-unified-table th:first-child,
.bcm-unified-table td:first-child {
    box-shadow: 2px 0 4px rgba(40,70,100,.06) !important;
}

.bcm-grid-table th:last-child,
.bcm-grid-table td:last-child,
.bcm-lookup-table th:last-child,
.bcm-lookup-table td:last-child,
.bcm-unified-table th:last-child,
.bcm-unified-table td:last-child {
    box-shadow: -2px 0 4px rgba(40,70,100,.06) !important;
}

/* Azioni */
.bcm-grid-actions,
.bcm-lookup-actions,
.bcm-table-actions,
.bcm-unified-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
}

.bcm-grid-action,
.bcm-lookup-action,
.bcm-table-action,
.bcm-icon-action {
    border: 1px solid #cfd9e5 !important;
    border-radius: 4px !important;
    background: #fff !important;
    box-shadow: none !important;
    transition: background .12s ease, border-color .12s ease, transform .12s ease !important;
}

.bcm-grid-action:hover,
.bcm-lookup-action:hover,
.bcm-table-action:hover,
.bcm-icon-action:hover {
    background: #f2f7fc !important;
    border-color: #9db4cc !important;
}

/* Elimina: evidenza discreta */
.bcm-grid-action[data-bcm-delete-id],
.bcm-lookup-action[data-bcm-delete-lookup-id],
.bcm-table-action[data-bcm-delete-id] {
    color: var(--bcm-danger) !important;
}

/* Paginazione */
.bcm-grid-pagination,
.bcm-lookup-pagination,
.bcm-unified-pagination {
    border-top: 1px solid var(--bcm-border) !important;
    background: #fbfdff !important;
}

.bcm-grid-pagination a,
.bcm-grid-pagination button,
.bcm-lookup-pagination a,
.bcm-lookup-pagination button,
.bcm-unified-pagination a,
.bcm-unified-pagination button {
    border-radius: 4px !important;
    border: 1px solid #ced9e5 !important;
    background: #fff !important;
    box-shadow: none !important;
}

.bcm-grid-pagination .is-current,
.bcm-grid-pagination .current,
.bcm-lookup-pagination .is-current,
.bcm-lookup-pagination .current,
.bcm-unified-pagination .is-current,
.bcm-unified-pagination .current {
    background: var(--bcm-blue) !important;
    color: #fff !important;
    border-color: var(--bcm-blue) !important;
}

/* Stati */
.bcm-grid-status__notice,
.bcm-lookup-status__notice {
    border-radius: 5px !important;
    box-shadow: none !important;
}

/* MODALI / FORM: aspetto più pulito senza cambiare font-size */
.bcm-modal__dialog,
.bcm-modal__dialog--large {
    border-radius: 8px !important;
    overflow: hidden !important;
    border: 1px solid #b8c8da !important;
    box-shadow: 0 18px 45px rgba(18, 36, 55, .26) !important;
}

.bcm-modal__header {
    background: linear-gradient(180deg, var(--bcm-blue) 0%, var(--bcm-blue-dark) 100%) !important;
    border-bottom: 1px solid #214876 !important;
}

.bcm-modal__title,
.bcm-modal__close {
    color: #fff !important;
}

.bcm-book-form-section,
.bcm-modal-grid--lookup {
    border-color: #d6e0eb !important;
    border-radius: 5px !important;
    background: #fff !important;
}

.bcm-book-form-section__title {
    background: linear-gradient(180deg, #f4f8fc 0%, #eaf2f9 100%) !important;
    color: #234f88 !important;
    border-bottom: 1px solid #d6e0eb !important;
}

/* Campi form */
.bcm-modal-field input,
.bcm-modal-field select,
.bcm-modal-field textarea,
.bcm-lookup-option-search {
    border: 1px solid #c9d5e2 !important;
    border-radius: 4px !important;
    background: #fff !important;
    box-shadow: inset 0 1px 1px rgba(0,0,0,.02) !important;
    transition: border-color .12s ease, box-shadow .12s ease !important;
}

.bcm-modal-field input:focus,
.bcm-modal-field select:focus,
.bcm-modal-field textarea:focus,
.bcm-lookup-option-search:focus {
    border-color: #7da5ce !important;
    box-shadow: 0 0 0 2px rgba(47,100,167,.12) !important;
    outline: none !important;
}

/* Lookup relazionali */
.bcm-lookup-search-clear,
.bcm-lookup-add-inline {
    border-radius: 4px !important;
    border: 1px solid #c6d2df !important;
    background: #f8fbfe !important;
    color: #234f88 !important;
}

.bcm-lookup-search-clear:hover,
.bcm-lookup-add-inline:hover {
    background: #edf4fb !important;
    border-color: #9eb5cd !important;
}

/* Footer modali */
.bcm-modal__footer {
    border-top: 1px solid #d6e0eb !important;
    background: #f8fbfe !important;
}

/* Focus tastiera evidente, senza cambiare dimensione testo */
.bcm-grid-root button:focus-visible,
.bcm-grid-root a:focus-visible,
.bcm-grid-root input:focus-visible,
.bcm-grid-root select:focus-visible,
.bcm-lookup-root button:focus-visible,
.bcm-lookup-root a:focus-visible,
.bcm-lookup-root input:focus-visible,
.bcm-lookup-root select:focus-visible,
.bcm-modal button:focus-visible,
.bcm-modal input:focus-visible,
.bcm-modal select:focus-visible,
.bcm-modal textarea:focus-visible {
    outline: 2px solid #7da5ce !important;
    outline-offset: 1px !important;
}

/* Tablet: separazione toolbar più ordinata */
@media (max-width: 1180px) {
    .bcm-grid-toolbar,
    .bcm-lookup-toolbar,
    .bcm-unified-toolbar {
        row-gap: 5px !important;
    }

    .bcm-grid-pagination,
    .bcm-lookup-pagination,
    .bcm-unified-pagination {
        gap: 3px !important;
    }
}


/* 0.3.41 - Visualizza libro realmente funzionante in sola lettura */
.bcm-book-modal.is-readonly .bcm-modal-field input:disabled,
.bcm-book-modal.is-readonly .bcm-modal-field textarea:disabled,
.bcm-book-modal.is-readonly .bcm-modal-field select:disabled {
    opacity:1 !important;
    color:inherit !important;
    -webkit-text-fill-color:currentColor !important;
    background:#f7f9fc !important;
    border-color:#d8e1eb !important;
    cursor:default !important;
}
.bcm-book-modal.is-readonly [data-bcm-quick-add-lookup],
.bcm-book-modal.is-readonly [data-bcm-cover-select],
.bcm-book-modal.is-readonly [data-bcm-cover-remove],
.bcm-book-modal.is-readonly [data-bcm-lookup-search-clear] {
    display:none !important;
}
.bcm-book-modal.is-readonly .bcm-lookup-option-search {
    display:none !important;
}
.bcm-book-modal.is-readonly .bcm-lookup-filter-count,
.bcm-book-modal.is-readonly .bcm-lookup-inline-notice:empty {
    display:none !important;
}
.bcm-grid-action-view {
    cursor:pointer !important;
}


/* 0.3.41 - correzione EFFETTIVA altezza -30% per tutti i CRUD e form.
   Nessuna regola font-size: il carattere resta invariato. */

/* ===== TUTTI I CRUD FRONTEND ===== */
html body .bcm-grid-root .bcm-grid-table > tbody > tr,
html body .bcm-lookup-root .bcm-lookup-table > tbody > tr,
html body .bcm-crud-host .bcm-unified-table > tbody > tr {
    height: 27px !important;
    min-height: 27px !important;
}

html body .bcm-grid-root .bcm-grid-table > tbody > tr > td,
html body .bcm-lookup-root .bcm-lookup-table > tbody > tr > td,
html body .bcm-crud-host .bcm-unified-table > tbody > tr > td,
html body .bcm-grid-root .bcm-grid-table > thead > tr > th,
html body .bcm-lookup-root .bcm-lookup-table > thead > tr > th,
html body .bcm-crud-host .bcm-unified-table > thead > tr > th {
    height: 27px !important;
    min-height: 27px !important;
    padding-top: 1px !important;
    padding-bottom: 1px !important;
    vertical-align: middle !important;
    line-height: 1.1 !important;
    box-sizing: border-box !important;
}

/* Era questa regola touch/min-height 38px a mantenere le righe alte.
   Le azioni ora seguono realmente la nuova altezza riga. */
html body .bcm-grid-root .bcm-grid-action,
html body .bcm-lookup-root .bcm-lookup-action,
html body .bcm-crud-host .bcm-table-action,
html body .bcm-crud-host .bcm-icon-action {
    width: 27px !important;
    min-width: 27px !important;
    max-width: 27px !important;
    height: 25px !important;
    min-height: 25px !important;
    max-height: 25px !important;
    padding: 0 3px !important;
    margin: 0 !important;
    line-height: 23px !important;
    box-sizing: border-box !important;
}

html body .bcm-grid-root .bcm-grid-actions,
html body .bcm-lookup-root .bcm-lookup-actions,
html body .bcm-crud-host .bcm-table-actions,
html body .bcm-crud-host .bcm-unified-actions {
    height: 25px !important;
    min-height: 25px !important;
    max-height: 25px !important;
    gap: 3px !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Anche su tablet: righe compatte; non viene modificata la dimensione testo. */
@media (max-width: 1180px) {
    html body .bcm-grid-root .bcm-grid-action,
    html body .bcm-lookup-root .bcm-lookup-action,
    html body .bcm-crud-host .bcm-table-action,
    html body .bcm-crud-host .bcm-icon-action {
        width: 27px !important;
        min-width: 27px !important;
        max-width: 27px !important;
        height: 25px !important;
        min-height: 25px !important;
        max-height: 25px !important;
    }
}

/* ===== TUTTI I FORM NUOVO / MODIFICA FRONTEND ===== */
html body .bcm-modal .bcm-modal-field {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    gap: 1px !important;
}

html body .bcm-modal .bcm-modal-grid {
    row-gap: 3px !important;
}

html body .bcm-modal .bcm-modal-field input:not([type="checkbox"]):not([type="radio"]),
html body .bcm-modal .bcm-modal-field select,
html body .bcm-modal .bcm-lookup-option-search {
    height: 22px !important;
    min-height: 22px !important;
    max-height: 22px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    box-sizing: border-box !important;
}

html body .bcm-modal .bcm-lookup-search-clear,
html body .bcm-modal .bcm-lookup-add-inline {
    width: 22px !important;
    min-width: 22px !important;
    height: 22px !important;
    min-height: 22px !important;
    max-height: 22px !important;
    padding: 0 !important;
}

html body .bcm-modal .bcm-modal-field textarea {
    min-height: 30px !important;
    height: 30px !important;
    padding-top: 1px !important;
    padding-bottom: 1px !important;
}

html body .bcm-book-modal .bcm-modal-field--note textarea {
    min-height: 38px !important;
    height: 38px !important;
}

html body .bcm-modal .bcm-modal__header {
    padding-top: 4px !important;
    padding-bottom: 4px !important;
    min-height: 30px !important;
}

html body .bcm-modal .bcm-modal__footer {
    padding-top: 3px !important;
    padding-bottom: 3px !important;
    min-height: 29px !important;
}

html body .bcm-modal .bcm-book-form-section {
    margin-bottom: 3px !important;
}

html body .bcm-modal .bcm-book-form-section__title {
    padding-top: 2px !important;
    padding-bottom: 2px !important;
}


/* 0.3.41 - miniatura copertina nel CRUD Libri */
html body .bcm-grid-root[data-grid-type="book"] .bcm-col-cover {
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
    text-align: center !important;
    vertical-align: middle !important;
    overflow: hidden !important;
}

html body .bcm-grid-root[data-grid-type="book"] th.bcm-col-cover {
    white-space: nowrap !important;
}

html body .bcm-grid-root[data-grid-type="book"] .bcm-cover-thumb {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 21px !important;
    height: 23px !important;
    margin: 0 auto !important;
    padding: 0 !important;
    border: 1px solid #cad5e1 !important;
    border-radius: 2px !important;
    background: #fff !important;
    overflow: hidden !important;
    box-shadow: 0 1px 2px rgba(31,63,104,.08) !important;
    vertical-align: middle !important;
}

html body .bcm-grid-root[data-grid-type="book"] .bcm-cover-thumb img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    margin: 0 !important;
    padding: 0 !important;
}

html body .bcm-grid-root[data-grid-type="book"] .bcm-cover-thumb:focus-visible {
    outline: 2px solid #7da5ce !important;
    outline-offset: 1px !important;
}


/* 0.3.41 - ottimizzazioni CRUD: righe/pagina, lightbox cover, tablet */
.bcm-grid-per-page {
    display:flex !important;
    align-items:center !important;
}
.bcm-grid-per-page select {
    min-width:92px !important;
    white-space:nowrap !important;
}

/* Anteprima copertina in pagina */
.bcm-cover-lightbox {
    position:fixed !important;
    inset:0 !important;
    z-index:1000002 !important;
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    padding:18px !important;
    box-sizing:border-box !important;
}
.bcm-cover-lightbox[hidden] {
    display:none !important;
}
.bcm-cover-lightbox__backdrop {
    position:absolute !important;
    inset:0 !important;
    width:100% !important;
    height:100% !important;
    border:0 !important;
    background:rgba(8,22,38,.72) !important;
    cursor:pointer !important;
}
.bcm-cover-lightbox__dialog {
    position:relative !important;
    z-index:1 !important;
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    max-width:92vw !important;
    max-height:92vh !important;
    padding:10px !important;
    border-radius:8px !important;
    background:#fff !important;
    box-shadow:0 18px 50px rgba(0,0,0,.35) !important;
}
.bcm-cover-lightbox__dialog img {
    display:block !important;
    max-width:86vw !important;
    max-height:86vh !important;
    width:auto !important;
    height:auto !important;
    object-fit:contain !important;
}
.bcm-cover-lightbox__close {
    position:absolute !important;
    top:4px !important;
    right:4px !important;
    width:30px !important;
    height:30px !important;
    padding:0 !important;
    border-radius:50% !important;
    border:1px solid #cbd6e2 !important;
    background:#fff !important;
    font-size:20px !important;
    line-height:28px !important;
    cursor:pointer !important;
}

/* Breakpoint tablet verificabili: toolbar ordinata, azioni e scroll invariati */
@media (max-width:1180px) {
    .bcm-grid-toolbar,
    .bcm-grid-toolbar--lookup {
        display:flex !important;
        flex-wrap:wrap !important;
        align-items:center !important;
        gap:4px !important;
    }
    .bcm-grid-search {
        flex:1 1 260px !important;
        min-width:220px !important;
    }
    .bcm-grid-per-page,
    .bcm-grid-export,
    .bcm-grid-sort,
    .bcm-grid-order {
        flex:0 0 auto !important;
    }
}

@media (max-width:820px) {
    .bcm-grid-search {
        flex:1 1 100% !important;
        order:10 !important;
        width:100% !important;
        max-width:none !important;
    }
    .bcm-grid-per-page select {
        min-width:86px !important;
    }
}

@media (max-width:768px) {
    .bcm-grid-toolbar,
    .bcm-grid-toolbar--lookup {
        padding-left:4px !important;
        padding-right:4px !important;
    }
    .bcm-grid-table-wrap,
    .bcm-grid-table-wrap--lookup {
        -webkit-overflow-scrolling:touch !important;
        touch-action:pan-x pan-y !important;
    }
}
