﻿html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

img{
    max-width:100%;
    max-height:100%;
}

.form-control[readonly],
.form-select[readonly],
textarea.form-control[readonly] {
    background-color: var(--bs-secondary-bg);
    border-style: dashed;
    border-color: var(--bs-border-color);
    color: var(--bs-secondary-color);
    cursor: not-allowed;
}

.form-control[readonly]:focus,
textarea.form-control[readonly]:focus {
    box-shadow: none;
    border-color: var(--bs-border-color);
}

/* 10 badge custom (non Bootstrap base) */

/* Teal (petrolio chiaro) */
.text-bg-custom-1 {
    color: #052a2d !important;
    background-color: rgba(70, 199, 197, var(--bs-bg-opacity, 1)) !important;
}

/* Indigo (indaco moderno) */
.text-bg-custom-2 {
    color: #120a2a !important;
    background-color: rgba(154, 140, 255, var(--bs-bg-opacity, 1)) !important;
}

/* Coral (corallo) */
.text-bg-custom-3 {
    color: #3b1010 !important;
    background-color: rgba(255, 140, 122, var(--bs-bg-opacity, 1)) !important;
}

/* Mint (menta) */
.text-bg-custom-4 {
    color: #0f2a1d !important;
    background-color: rgba(152, 241, 196, var(--bs-bg-opacity, 1)) !important;
}

/* Sand (sabbia) */
.text-bg-custom-5 {
    color: #2f2412 !important;
    background-color: rgba(239, 209, 160, var(--bs-bg-opacity, 1)) !important;
}

/* Slate (ardesia) */
.text-bg-custom-6 {
    color: #0b1220 !important;
    background-color: rgba(161, 180, 206, var(--bs-bg-opacity, 1)) !important;
}

/* Rose (rosa polveroso) */
.text-bg-custom-7 {
    color: #2f0f1c !important;
    background-color: rgba(255, 170, 210, var(--bs-bg-opacity, 1)) !important;
}

/* Lime (lime soft) */
.text-bg-custom-8 {
    color: #1f2a05 !important;
    background-color: rgba(206, 234, 110, var(--bs-bg-opacity, 1)) !important;
}

/* Copper (rame) */
.text-bg-custom-9 {
    color: #2b1206 !important;
    background-color: rgba(226, 145, 92, var(--bs-bg-opacity, 1)) !important;
}

/* Azure (azzurro vivo ma non "info") */
.text-bg-custom-10 {
    color: #071a35 !important;
    background-color: rgba(120, 180, 255, var(--bs-bg-opacity, 1)) !important;
}

/* Urgenze */
.text-bg-urg-bassa {
    color: #000000 !important;
    background-color: rgba(173, 181, 189, var(--bs-bg-opacity, 1)) !important;
}

.text-bg-urg-media {
    color: #000000 !important;
    background-color: rgba(255, 193, 7, var(--bs-bg-opacity, 1)) !important;
}

.text-bg-urg-alta {
    color: #000000 !important;
    background-color: rgba(255, 119, 7, var(--bs-bg-opacity, 1)) !important;
}

.text-bg-urg-altissima {
    color: #000000 !important;
    background-color: rgba(123, 7, 255, var(--bs-bg-opacity, 1)) !important;
}


/* ========== Login page (ARXivar Portal) ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: radial-gradient(1200px circle at 10% 10%, rgba(13,110,253,.18), transparent 50%), radial-gradient(1000px circle at 90% 20%, rgba(25,135,84,.14), transparent 55%), #f8f9fa;
    margin: 0px;
}

.login-card {
    border: 0;
    box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, .12);
    border-radius: 1.25rem;
    overflow: hidden;
}

.login-card .card-body {
    padding: 2rem;
}

@media (min-width: 768px) {
    .login-card .card-body {
        padding: 3rem;
    }
}

.login-logo {
    height: 80px;
    width: auto;
}

.login-subtitle {
    color: #6c757d;
    font-size: .9rem;
}

.login-footer {
    color: #6c757d;
    font-size: .8rem;
}

.login-input {
    font-size: 1.05rem;
    padding-top: .75rem;
    padding-bottom: .75rem;
}

/* ===== Layout (header + footer) ===== */
.td-body {
    background: #f6f7fb;
}

.td-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    backdrop-filter: blur(10px);
    background: rgba(246,247,251,.75);
    border-bottom: 1px solid rgba(15,23,42,.08);
}

.td-navbar {
    padding: 10px 0;
}

.td-dropdown {
    border-radius: 14px;
    border: 1px solid rgba(15,23,42,.10);
    box-shadow: 0 16px 30px rgba(15,23,42,.10);
    padding: 8px;
}

.td-dropdown__item {
    border-radius: 10px;
    padding: 10px 12px;
    font-weight: 600;
}

.td-dropdown__item:hover {
    background: rgba(99,102,241,.10);
}

.td-navlink.active {
    background: rgba(99,102,241,.14);
    color: #0f172a !important;
}

.td-dropdown__item.active {
    background: rgba(99,102,241,.14);
    color: #0f172a;
}

.td-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.td-brand__mark {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-weight: 900;
    letter-spacing: -.5px;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #22c55e);
    box-shadow: 0 10px 20px rgba(15,23,42,.12);
}

.td-brand__text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.td-brand__title {
    font-weight: 800;
    letter-spacing: -.2px;
    color: #0f172a;
}

.td-brand__subtitle {
    font-size: 12px;
    color: rgba(15,23,42,.55);
}

.td-logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
    padding: 3px;
    border: 1px solid rgba(15, 23, 42, .10);
    box-shadow: 0 10px 20px rgba(15, 23, 42, .10);
}

.td-toggler {
    border-radius: 12px;
    border: 1px solid rgba(15,23,42,.12);
}

.td-navlink {
    border-radius: 12px;
    padding: 10px 12px !important;
    color: rgba(15,23,42,.75) !important;
    font-weight: 600;
}

.td-navlink:hover {
    background: rgba(99,102,241,.10);
    color: #0f172a !important;
}

.td-user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid rgba(15,23,42,.10);
    background: #fff;
    box-shadow: 0 10px 18px rgba(15,23,42,.06);
}

.td-user__dot {
    width: 8px;
    height: 8px;
    border-radius: 99px;
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34,197,94,.12);
}

.td-user__name {
    font-size: 13px;
    font-weight: 700;
    color: rgba(15,23,42,.85);
}

.td-btn {
    border-radius: 12px;
    padding: 9px 12px;
    font-weight: 700;
}

.td-btn--ghost {
    border: 1px solid rgba(15,23,42,.14);
    background: #fff;
    color: rgba(15,23,42,.80);
}

.td-btn--ghost:hover {
    background: rgba(239,68,68,.08);
    border-color: rgba(239,68,68,.25);
    color: #ef4444;
}

.td-main {
    padding-top: 18px;
    padding-bottom: 40px;
}

.td-footer {
    border-top: 1px solid rgba(15,23,42,.08);
    background: #fff;
    padding: 14px 0;
}

.td-footer__pill {
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(99,102,241,.10);
    border: 1px solid rgba(99,102,241,.18);
    color: rgba(15,23,42,.70);
    font-weight: 700;
}

.td-footer__dot {
    opacity: .5;
}

.text-prewrap {
    white-space: pre-wrap;
}

.td-userchip {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .6rem;
    border: 1px solid rgba(0,0,0,.08);
    background: #fff;
    border-radius: 999px;
    cursor: pointer;
    transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}

.td-userchip:hover {
    border-color: rgba(0,0,0,.15);
    box-shadow: 0 6px 18px rgba(0,0,0,.08);
    transform: translateY(-1px);
}

.td-userchip:focus {
    outline: 0;
    box-shadow: 0 0 0 .2rem rgba(13,110,253,.15);
}

.td-userchip__avatar {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: .8rem;
    background: rgba(13,110,253,.12);
    color: #0d6efd;
}

.td-userchip__name {
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    font-size: .9rem;
    color: #212529;
}

@media (min-width: 991px) and (max-width: 1399.98px) {
    .td-brand {
        font-size:0.9em;
        gap:5px;
    }

    .td-userchip__name {
        display: none !important;
    }
}

.td-userchip__chev {
    opacity: .6;
    font-size: .85rem;
}

.td-userchip__menu {
    min-width: 220px;
    border-radius: 14px;
    padding: .35rem;
    box-shadow: 0 14px 40px rgba(0,0,0,.12);
    border: 1px solid rgba(0,0,0,.06);
}

.td-userchip__menu .dropdown-item {
    border-radius: 10px;
    padding: .55rem .7rem;
}

.td-userchip__menu .dropdown-item:active {
    background: rgba(13,110,253,.12);
    color: #0d6efd;
}

.td-table-card {
    border-radius: 16px;
    overflow: hidden;
}

.td-table {
    font-size: .92rem;
}

.td-sticky-head th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.td-col-actions {
    width: 1%;
    white-space: nowrap;
}

.td-col-narrow {
    width: 120px;
}

.td-col-email {
    min-width: 220px;
}

.td-col-phone {
    width: 150px;
}

.td-col-status {
    width: 120px;
}

.td-status-icons i {
    line-height: 1;
}

.td-mono {
    font-variant-numeric: tabular-nums;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.td-ellipsis {
    max-width: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.td-link {
    text-decoration: none;
}

.td-link:hover {
    text-decoration: underline;
}

.td-rowcard {
    padding: 12px 14px;
}

.td-rowcard-top {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 10px;
}

.td-rowcard-title {
    font-weight: 800;
    line-height: 1.15;
}

.td-rowcard-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.td-rowcard-grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
}

.td-field .td-label {
    font-size: .75rem;
    color: rgba(15,23,42,.6);
}

.td-field .td-value {
    font-size: .92rem;
}

.td-sort-link {
    color: inherit;
    text-decoration: none;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.td-sort-link:hover {
    text-decoration: underline;
}

.td-sort-ic {
    opacity: .55;
    font-size: .85rem;
}

.td-prewrap {
    white-space: pre-line;
}

.td-desc {
    max-width: 0; 
}

.td-desc .td-clamp-3 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3; 
    overflow: hidden;
    word-break: break-word;
    white-space: normal;
}

.td-desc-box{text-align:justify;}

.td-desc-box .td-full {
    display: none;
    white-space: pre-wrap;
    word-break: break-word;
}

.td-desc-box.is-open .td-clamp-3 {
    display: none;
}

.td-desc-box.is-open .td-full {
    display: block;
}

.badge.badgefontnormal{
    font-size:1em;
}

@media (max-width: 380px) {
    .td-rowcard-grid {
        grid-template-columns: 1fr;
    }
}

.td-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.05rem;
    height: 1.55rem;
    border-radius: var(--bs-border-radius);
    font-weight: 700;
    font-size: .75rem;
    letter-spacing: .02em;
    border: 1px solid rgba(0,0,0,.08);
    user-select: none;
}

.td-initials.td-initials-big {
    width: auto;
    padding: 0px 4px;
}

.td-initials i {
    font-size: .95rem;
}

.client-topbar {
    padding: .9rem 1rem;
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 1rem;
    background: var(--bs-body-bg);
    box-shadow: 0 .125rem .75rem rgba(0,0,0,.05);
}

.min-w-0 {
    min-width: 0;
}

@media (min-width:576px) {
    .w-sm-auto {
        width: auto !important;
    }
}

.kv-list {
    display: grid;
    gap: .25rem;
}

.kv-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: .15rem;
    padding: .5rem 0;
    border-bottom: 1px dashed rgba(0,0,0,.12);
}

.kv-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.kv-row dt {
    margin: 0;
    color: var(--bs-secondary-color);
    font-size: .85rem;
}

.kv-row dd {
    margin: 0;
    font-weight: 500;
    word-break: break-word;
}

@media (min-width:576px) {
    .kv-row {
        grid-template-columns: 180px 1fr;
        gap: .75rem;
        align-items: baseline;
    }

    .kv-row dt {
        font-size: .875rem;
    }
}

.td-dl-dashed dd {
    padding-bottom: .75rem;
    margin-bottom: .75rem;
    border-bottom: 1px dashed rgba(0, 0, 0, .12);
}

.sede-item {
    background: var(--bs-body-bg);
}

.sede-note {
    border-top: 1px dashed rgba(0,0,0,.12);
}

.sede-note-badge {
    white-space: nowrap;
}


.td-truncate {
    max-width: 280px; /* regola a gusto */
    /*white-space: nowrap;*/
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile cards */
.imp-card {
    background: var(--bs-body-bg);
}

.imp-kv {
    display: grid;
    gap: .75rem;
}

.imp-label {
    color: var(--bs-secondary-color);
    font-size: .85rem;
}

.imp-value {
    font-weight: 500;
    word-break: break-word;
}

.imp-addr-link {
    color: inherit;
    text-decoration: none;
}

.imp-addr-link:active,
.imp-addr-link:hover {
    text-decoration: underline;
}

/* Chip style: rende checkbox + label cliccabili e più belli */
.td-chip {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .75rem;
    border: 1px solid #dee2e6;
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    user-select: none;
    transition: background-color .15s ease, border-color .15s ease;
}

.td-chip:hover {
    background: #f8f9fa;
    border-color: #cfd4da;
}

.td-chip input {
    margin: 0;
}

.td-chip.is-checked {
    border-color: #0d6efd;
    background: rgba(13,110,253,.06);
}

.td-section-title {
    font-weight: 600;
    margin-bottom: .75rem;
}

.td-manual-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: .5rem;
}

@media (min-width: 768px) {
    .td-manual-grid {
        grid-template-columns: 1fr 1fr;
    }
}

#attachmentsCard [data-td-att-dropzone].dragover {
    outline: 2px dashed currentColor;
    outline-offset: 2px;
}

#attachmentsCard .file-name {
    max-width: 420px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 576px) {
    #attachmentsCard .file-name {
        max-width: 220px;
    }
}

.btn-check:checked + .card {
    background: #bcd0ed;
}

#contrattiList .list-group-item.td-selected {
    border-color: rgba(13,110,253,.55);
    box-shadow: 0 0 0 .2rem rgba(13,110,253,.15);
}

#contrattiList .td-check {
    display: none;
}

#contrattiList .list-group-item.td-selected .td-check {
    display: inline-flex;
}

.td-status-responsive {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    flex-wrap: nowrap; 
    line-height: 1;
}

.td-icons-row {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.td-stato-pill {
    font-size: .75rem;
    padding: .25rem .55rem;
    white-space: nowrap;
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 768px) {
    .td-status-responsive {
        flex-direction: column;
        align-items: center;
    }
}

/* === Select2 come input Bootstrap, senza overflow-x === */

.select2-container {
    width: 100% !important;
    max-width: 100% !important;
}

.select2-container .select2-selection--single {
    height: calc(1.5em + .75rem + 2px) !important;
    border: 1px solid #ced4da !important;
    border-radius: .375rem !important;
    background-color: #fff !important;
    box-sizing: border-box !important;
    overflow: hidden !important; /* evita scroll orizzontale */
    max-width: 100% !important;
}

/* Il padding va qui, non sulla selection */
.select2-container .select2-selection--single .select2-selection__rendered {
    box-sizing: border-box !important;
    padding: .375rem 2.25rem .375rem .75rem !important; /* spazio freccia a dx */
    line-height: 1.5 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Freccia: non deve “allargare” */
.select2-container .select2-selection--single .select2-selection__arrow {
    height: 100% !important;
    width: 2.25rem !important;
    right: 0 !important;
    top: 0 !important;
}

/* Clear (x) */
.select2-container .select2-selection__clear {
    position: absolute !important;
    right: 2.25rem !important; /* prima della freccia */
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
}

/* Focus stile Bootstrap */
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: #86b7fe !important;
    box-shadow: 0 0 0 .25rem rgba(13,110,253,.25) !important;
}

/* Dropdown */
.select2-dropdown {
    border: 1px solid #ced4da !important;
    border-radius: .375rem !important;
    box-sizing: border-box !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
}

.select2-container--default .select2-dropdown.select2-dropdown--below {
    min-width: 200px;
}

.select2-container--default .select2-dropdown {
    overflow-x: hidden;
}

/* Risultati */
.select2-results__option {
    padding: .375rem .75rem !important;
}

.select2-container--default .select2-results__option .bi {
    line-height: 1;
}

.select2-container--default .select2-results__option > span {
    display: inline-flex;
    max-width: 100%;
}

.select2-container--default .select2-results__option span span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.select2-results {
    overflow-x: hidden !important;
}

.select2-container.select2-container--default.select2-container--open:not(.select2) {
    width: auto !important;
}

.modal-dialog-scrollable .modal-content {
    overflow: auto!important;
}


/* buoni lavoro orari */

.orario-grid {
    display: grid;
    gap: .75rem;
}

.orario-head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: .5rem;
}

.orario-title {
    font-weight: 600;
}

/* Mobile default: layout impilato */
.orario-grid {
    grid-template-columns: 1fr 1fr;
}

/* Campi che devono occupare tutta larghezza in mobile */
.orario-head,
.orario-notes,
.orario-tech {
    grid-column: 1 / -1;
}

/* Campi singoli in 2 colonne su mobile */
.orario-field {
    min-width: 0;
}

/* Tecnici: box scrollabile */
.orario-tech-box {
    border: 1px solid rgba(0,0,0,.15);
    border-radius: .5rem;
    padding: .5rem;
    max-height: 160px; /* mobile */
    overflow: auto;
    background: rgba(0,0,0,.02);
}

/* Desktop: più “tabellare” */
@media (min-width: 992px) {
    .orario-grid {
        grid-template-columns: 140px 140px 140px 140px 140px 140px 160px 1fr;
        align-items: start;
    }

    /* Header sopra tutta la riga */
    .orario-head {
        grid-column: 1 / -1;
    }

    /* Note e tecnici a destra in colonna larga */
    .orario-notes {
        grid-column: 1 / 6;
    }
    /* note più ampia */
    .orario-tech {
        grid-column: 6 / -1;
    }
    /* tecnici a destra */

    .orario-tech-box {
        max-height: 220px;
    }
}

.td-signature-pad {
    width: 100%;
    aspect-ratio: 3 / 1; /* <-- scegli: 3/1 oppure 16/9 */
    border: 1px solid rgba(0,0,0,.15);
    border-radius: .75rem;
    background: #fff;
    overflow: hidden;
}

.td-signature-pad canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

.td-hasbar {
    position: relative;
    padding-left: 15px!important;
}

.td-hasbar::before {
    content: "";
    position: absolute;
    left: 0;
    top: 5px;
    bottom: 5px;
    width: 10px;
    border-radius: 2px;
    background: var(--td-bar, #adb5bd);
}

/* MAPPA */
.td-pin {
    width: 26px;
    height: 26px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
    position: relative;
}

.td-pin::after {
    content: "";
    width: 10px;
    height: 10px;
    background: rgba(255,255,255,.95);
    border-radius: 50%;
    position: absolute;
    top: 8px;
    left: 8px;
}

.td-pin--default,
.td-pin--bassa {
    background: #adb5bd;
}

.td-pin--media {
    background: #ffc107;
}

.td-pin--alta {
    background: #ff7707;
}

.td-pin--altissima {
    background: #7b07ff;
}

.td-zone {
    border: 1px solid rgba(0,0,0,.1);
    font-weight: 600;
}

.td-zone--0 {
    background: #e7f1ff;
    color: #084298;
}

.td-zone--1 {
    background: #e8f5e9;
    color: #1b5e20;
}

.td-zone--2 {
    background: #fff3cd;
    color: #664d03;
}

.td-zone--3 {
    background: #f8d7da;
    color: #842029;
}

.td-zone--4 {
    background: #cff4fc;
    color: #055160;
}

.td-zone--5 {
    background: #e2e3e5;
    color: #41464b;
}

.td-zone--6 {
    background: #f1e8ff;
    color: #3d1a7a;
}

.td-zone--7 {
    background: #ffe8cc;
    color: #7a3a00;
}