/* ===== Drawer / Overlay base ===== */
.c01-drawer {
    position: fixed;
    background: var(--search-area-bg);
    color: var(--Font);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
    z-index: 1060;
    /* sopra le modali standard */
    transition: transform .25s ease;
}

.c01-drawer[aria-hidden="true"] {
    pointer-events: none;
}

.c01-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--search-area-border);
    position: sticky;
    top: 0;
    background: inherit;
    z-index: 1;
}

.c01-drawer__body {
    padding: .75rem 1rem;
    max-height: 75vh;
    overflow: auto;
}

/* Posizioni */
.c01-drawer-right {
    top: 0;
    right: 0;
    height: 100vh;
    width: min(960px, 92vw);
    transform: translateX(100%);
}

.c01-drawer-right[aria-hidden="false"] {
    transform: translateX(0);
}

.c01-drawer-bottom {
    left: 0;
    right: 0;
    bottom: 0;
    height: min(80vh, 100%);
    transform: translateY(100%);
}

.c01-drawer-bottom[aria-hidden="false"] {
    transform: translateY(0);
}

/* Overlay full-screen */
.c01-overlay {
    position: fixed;
    inset: 0;
    background: var(--search-area-bg);
    z-index: 1060;
    transition: opacity .2s ease;
    opacity: 0;
    pointer-events: none;
}

.c01-overlay[aria-hidden="false"] {
    opacity: 1;
    pointer-events: auto;
}

.c01-overlay__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--search-area-border);
    position: sticky;
    top: 0;
    background: inherit;
}

.c01-overlay__body {
    padding: .75rem 1rem;
}

/* Tabs semplici */
.c01-tabs {
    display: flex;
    gap: .5rem;
}

.c01-tab {
    border: 1px solid var(--search-area-border);
    background: transparent;
    padding: .35rem .6rem;
    border-radius: .5rem;
    font-size: .9rem;
}

.c01-tab.is-active {
    background: rgba(255, 255, 255, .07);
}

.c01-tabpanel {
    display: none;
}

.c01-tabpanel.is-active {
    display: block;
}

/* Tabella scrollabile */
.c01-tablebox {
    border: 1px solid var(--search-area-border);
    border-radius: .5rem;
}

/* Badge piccolo */
.c01-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.3rem;
    padding: 0 .4rem;
    border-radius: 999px;
    background: #d9534f;
    color: #fff;
    font-size: .8rem;
}

/* Mobile: nasconde gli extra del top */
@media (max-width: 992px) {
    .js-hide-mobile {
        display: none !important;
    }

    .js-logo-compact {
        max-width: 124px;
        height: auto;
    }

    .app-sidebar {
        /* riduco la side bar */
        overflow: hidden !important;
        transition: width .25s ease;
        padding: 0px 0px 0px 20px !important
    }
    .app-sidebar .app-sidebar-link {
        font-size: 1rem;
        text-decoration: none !important;
        width: 10px !important;
        height: 25px !important;
    }

    body {
        /* imposto il body più piccolo e più leggibile */
        font-size: .9rem !important;
        line-height: 1.4 !important;
        letter-spacing: .02rem !important;
    }
}

@media (min-width: 992px) {

    /* nascondo tutti gli elementi che hanno classe js-burger e id=js-avatar */
    .js-burger#js-avatar {
        display: none !important;
    }

    .js-burger#js-quick {
        display: none !important;
    }

    .js-burger#js-connection {
        display: none !important;
    }

    .app-sidebar>.app-sidebar-link {
        font-size: 1.5rem;
        text-decoration: none !important;
    }
}

/* Safe areas iOS */
:root {
    --sab: env(safe-area-inset-bottom);
}

.c01-drawer-bottom {
    padding-bottom: calc(10px + var(--sab));
}

/* ===== Action Sheet (drawer account) ===== */
.c01-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: .6rem;
}

.c01-action {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .8rem;
  padding: .75rem .9rem;
  border: 1px solid var(--search-area-border);
  background: var(--search-area-bg);
  color: var(--Font);
  border-radius: .8rem;
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(0,0,0,.06);
  transition: background .15s ease, border-color .15s ease, transform .04s ease;
  position: relative;
}

.c01-action:hover { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.12); }
.c01-action:active { transform: translateY(1px); }

.c01-action__icon {
  width: 42px; height: 42px;
  border-radius: .6rem;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.06);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}

.c01-action__label { display: flex; flex-direction: column; line-height: 1.2; text-align: left;}
.c01-action__label strong { font-weight: 600; font-size: .96rem; }
.c01-action__label small { opacity: .8; font-size: .78rem; }

.c01-action__chev { opacity: .6; }

.c01-action.is-primary .c01-action__icon {
  background: linear-gradient(180deg, rgba(0,123,255,.18), rgba(0,123,255,.08));
  box-shadow: inset 0 0 0 1px rgba(0,123,255,.25);
}

.c01-action.is-danger .c01-action__icon {
  background: linear-gradient(180deg, rgba(217,83,79,.20), rgba(217,83,79,.08));
  box-shadow: inset 0 0 0 1px rgba(217,83,79,.28);
}

@media (min-width: 576px) {
  .c01-actions { grid-template-columns: 1fr 1fr; }
}

/* ===========================
   UI COMPACT MODE
   =========================== */
.ui-compact {
  /* tipografia base */
  font-size: 14.5px;            /* base */
  line-height: 1.35;
  letter-spacing: .01rem;
}

/* Headings più snelli */
.ui-compact h1 { font-size: 1.25rem; margin-bottom: .5rem; }
.ui-compact h2 { font-size: 1.15rem; margin-bottom: .5rem; }
.ui-compact h3 { font-size: 1.05rem; margin-bottom: .45rem; }
.ui-compact h4, .ui-compact h5, .ui-compact h6 { margin-bottom: .4rem; }

/* Icone “fs-*” (mitiga 2x su mobile) */
.ui-compact .fs-2x    { font-size: 1.6rem !important; }
.ui-compact .fs-1-5x  { font-size: 1.25rem !important; }

/* Header e topbar */
.ui-compact .app-header { padding: .35rem .6rem; }
.ui-compact .app-header-left,
.ui-compact .app-header-right { gap: .35rem; }

/* Sidebar link */
.ui-compact .app-sidebar .app-sidebar-link {
  font-size: 1.1rem !important;
  padding: .35rem 0 !important;
}

/* Bottoni */
.ui-compact .btn {
  padding: .32rem .55rem !important;
  font-size: .92rem !important;
  line-height: 1.2 !important;
  border-radius: .45rem !important;
}
.ui-compact .btn-sm {
  padding: .25rem .45rem !important;
  font-size: .86rem !important;
  border-radius: .4rem !important;
}

/* Input / Select (Bootstrap) */
.ui-compact .form-control,
.ui-compact .form-select,
.ui-compact .input-group-text {
  padding: .35rem .55rem !important;
  height: 34px !important;            /* compatibile mobile */
  font-size: .92rem !important;
  border-radius: .45rem !important;
}

/* Select2 */
.ui-compact .select2-container .select2-selection--single {
  height: 34px !important;
  border-radius: .45rem !important;
}
.ui-compact .select2-container .select2-selection--single .select2-selection__rendered {
  line-height: 34px !important;
  font-size: .92rem !important;
  padding-left: .5rem !important;
}
.ui-compact .select2-container .select2-selection--single .select2-selection__arrow {
  height: 34px !important;
}

/* Bootstrap-select */
.ui-compact .bootstrap-select > .dropdown-toggle {
  padding: .35rem .55rem !important;
  height: 34px !important;
  font-size: .92rem !important;
  border-radius: .45rem !important;
}
.ui-compact .bootstrap-select .dropdown-menu { font-size: .92rem !important; }

/* Tabelle */
.ui-compact table.table { font-size: .92rem; }
.ui-compact .table > :not(caption) > * > * {
  padding: .35rem .5rem !important;
}

/* DataTables controlli */
.ui-compact .dataTables_wrapper .dataTables_length select,
.ui-compact .dataTables_wrapper .dataTables_filter input {
  height: 32px !important;
  font-size: .9rem !important;
}
.ui-compact .dataTables_wrapper .dataTables_paginate .paginate_button {
  padding: .15rem .4rem !important;
  font-size: .9rem !important;
}

/* Modali: più dense e quasi full su mobile */
.ui-compact .modal-dialog {
  max-width: 96vw !important;
  margin: .6rem auto !important;
}
.ui-compact .modal-content { border-radius: .6rem !important; }
.ui-compact .modal-header, 
.ui-compact .modal-footer { padding: .5rem .75rem !important; }
.ui-compact .modal-title { font-size: 1.05rem !important; }
.ui-compact .modal-body { padding: .75rem !important; }

/* Drawer/Overlay (nostri) */
.ui-compact .c01-drawer__header,
.ui-compact .c01-overlay__header { padding: .55rem .8rem; }
.ui-compact .c01-drawer__body,
.ui-compact .c01-overlay__body { padding: .55rem .8rem; }
.ui-compact .c01-tab { padding: .28rem .5rem; font-size: .86rem; }

/* Action sheet (nostro) */
.ui-compact .c01-action {
  gap: .65rem; padding: .55rem .75rem;
}
.ui-compact .c01-action__icon {
  width: 36px; height: 36px; border-radius: .55rem;
}
.ui-compact .c01-action__label strong { font-size: .9rem; }
.ui-compact .c01-action__label small  { font-size: .75rem; }

/* Badge */
.ui-compact .c01-badge { min-width: 1.25rem; height: 1.1rem; font-size: .72rem; }



/* ===========================
   UI ULTRA-COMPACT MODE
   =========================== */
.ui-compact-xs { font-size: 13.2px; line-height: 1.28; }

/* Icone grandi nel top: ancora più piccole */
.ui-compact-xs .app-header .fs-2x { font-size: 1.30rem !important; }

/* Heading */
.ui-compact-xs h1 { font-size: 1.15rem; }
.ui-compact-xs h2 { font-size: 1.05rem; }
.ui-compact-xs h3 { font-size: 0.98rem; }
.ui-compact-xs h4, .ui-compact-xs h5, .ui-compact-xs h6 { font-size: .9rem; }

/* Bottoni */
.ui-compact-xs .btn { padding: .26rem .45rem !important; font-size: .86rem !important; border-radius: .4rem !important; }
.ui-compact-xs .btn-sm { padding: .22rem .4rem !important; font-size: .82rem !important; border-radius: .36rem !important; }

/* Input / Select */
.ui-compact-xs .form-control,
.ui-compact-xs .form-select,
.ui-compact-xs .input-group-text { height: 30px !important; padding: .3rem .5rem !important; font-size: .86rem !important; border-radius: .4rem !important; }

/* Select2 */
.ui-compact-xs .select2-container .select2-selection--single { height: 30px !important; border-radius: .4rem !important; }
.ui-compact-xs .select2-container .select2-selection--single .select2-selection__rendered { line-height: 30px !important; font-size: .86rem !important; padding-left: .45rem !important; }
.ui-compact-xs .select2-container .select2-selection--single .select2-selection__arrow { height: 30px !important; }

/* Bootstrap-select */
.ui-compact-xs .bootstrap-select > .dropdown-toggle { height: 30px !important; padding: .3rem .5rem !important; font-size: .86rem !important; border-radius: .4rem !important; }
.ui-compact-xs .bootstrap-select .dropdown-menu { font-size: .86rem !important; }

/* Tabelle */
.ui-compact-xs table.table { font-size: .86rem; }
.ui-compact-xs .table > :not(caption) > * > * { padding: .3rem .45rem !important; }

/* DataTables controlli */
.ui-compact-xs .dataTables_wrapper .dataTables_length select,
.ui-compact-xs .dataTables_wrapper .dataTables_filter input { height: 28px !important; font-size: .84rem !important; }

/* Modali */
.ui-compact-xs .modal-dialog { max-width: 96vw !important; margin: .45rem auto !important; }
.ui-compact-xs .modal-header, 
.ui-compact-xs .modal-footer { padding: .45rem .65rem !important; }
.ui-compact-xs .modal-title { font-size: .98rem !important; }
.ui-compact-xs .modal-body { padding: .6rem !important; }

/* Drawer/Overlay nostri */
.ui-compact-xs .c01-drawer__header,
.ui-compact-xs .c01-overlay__header { padding: .45rem .65rem; }
.ui-compact-xs .c01-drawer__body,
.ui-compact-xs .c01-overlay__body { padding: .45rem .65rem; }
.ui-compact-xs .c01-tab { padding: .22rem .45rem; font-size: .8rem; }

/* Action sheet */
.ui-compact-xs .c01-action { gap: .55rem; padding: .45rem .6rem; }
.ui-compact-xs .c01-action__icon { width: 32px; height: 32px; border-radius: .45rem; }
.ui-compact-xs .c01-action__label strong { font-size: .86rem; }
.ui-compact-xs .c01-action__label small  { font-size: .72rem; }

/* Badge */
.ui-compact-xs .c01-badge { min-width: 1.1rem; height: 1rem; font-size: .68rem; }

/* Sidebar icone */
.ui-compact-xs .app-sidebar .app-sidebar-link { font-size: 1rem !important; padding: .28rem 0 !important; }

.ui-compact-xs .card, 
.ui-compact-xs .c01-panel { padding: .6rem !important; border-radius: .55rem !important; }
.ui-compact-xs .card-header { padding: .5rem .6rem !important; }
.ui-compact-xs .card-body   { padding: .55rem .6rem !important; }


/* ===== Orizzontale di sicurezza (riusabile ovunque) ===== */
.c01-hx {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

/* Suggerimento visivo: alone ai bordi quando c'è scroll */
.c01-hx::before,
.c01-hx::after {
  content: "";
  position: sticky;
  top: 0; bottom: 0; width: 16px;
  pointer-events: none;
}
.c01-hx::before { left: 0; background: linear-gradient(90deg, rgba(0,0,0,.18), transparent); }
.c01-hx::after  { right: 0; background: linear-gradient(-90deg, rgba(0,0,0,.18), transparent); }

/* Dentro allo scroller: lasciare la larghezza naturale */
.c01-hx > table,
.c01-hx > .dataTables_wrapper,
.c01-hx > .c01-wide {
  width: max-content;       /* non comprimere le colonne */
  min-width: 100%;          /* ma almeno quanto il viewport */
}

/* Testi lunghi: non rompere il layout */
.c01-hx td, .c01-hx th, .c01-hx .cell {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Gruppi di bottoni: possibilmente a capo */
.c01-hx .btn-group, .c01-hx .actions, .btn-toolbar { flex-wrap: wrap; }

/* Mobile: abilita lo scroll orizzontale anche al contenitore principale */
@media (max-width: 992px){
  .app-container, .container-fluid, .content-wrapper {
    max-width: 100vw;
    overflow-x: auto;              /* se qualcosa sfugge fuori, permetti lo scroll */
    -webkit-overflow-scrolling: touch;
  }
}
