/* Ajustes globais para uso nos portais Avodah. */
@media (min-width: 992px) {
    body:not(.layout-top-nav) .main-sidebar,
    body.sidebar-mini.sidebar-collapse .main-sidebar:hover {
        width: 250px;
    }

    body:not(.layout-top-nav):not(.sidebar-collapse) .content-wrapper,
    body:not(.layout-top-nav):not(.sidebar-collapse) .main-footer,
    body.sidebar-mini.sidebar-collapse .main-sidebar:hover ~ .content-wrapper,
    body.sidebar-mini.sidebar-collapse .main-sidebar:hover ~ .main-footer {
        margin-left: 250px !important;
    }

    body.sidebar-mini.sidebar-collapse .content-wrapper,
    body.sidebar-mini.sidebar-collapse .main-footer {
        margin-left: 4.6rem !important;
    }

    #formcliente {
        max-width: 1240px;
    }

    #formcliente > .col-sm-3,
    #formcliente > .col-sm-4,
    #formcliente > .col-sm-6,
    #formcliente > .col-sm-8 {
        padding-left: 0;
        padding-right: 0;
        margin-bottom: 12px;
    }

    #formcliente > label.col-form-label,
    #formcliente .col-sm-3 > label,
    #formcliente .col-sm-6 > label {
        display: block;
        max-width: none;
        padding: 0;
        margin: 0 0 6px;
        font-weight: 600;
    }

    #formcliente .form-group.row {
        display: block;
        margin-left: 0;
        margin-right: 0;
    }

    #formcliente .card .form-row {
        align-items: center;
        gap: 8px;
    }
}

@media (max-width: 991.98px) {
    html,
    body {
        overflow-x: hidden;
    }

    .layout-top-nav .wrapper .content-wrapper,
    .content-wrapper {
        min-height: auto !important;
    }

    .content-header {
        padding: 14px 12px 6px;
    }

    .content-header h1 {
        font-size: 1.55rem;
        line-height: 1.2;
        margin: 0;
    }

    .content,
    .content .container,
    .content .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }

    .card {
        width: 100%;
        margin-bottom: 14px;
        border-radius: 6px;
    }

    .card-header,
    .card-body {
        padding: 14px;
    }

    .content .row {
        margin-left: -6px;
        margin-right: -6px;
    }

    .content .row > [class*="col-"] {
        padding-left: 6px;
        padding-right: 6px;
    }

    .content .row > .offset-1,
    .content .row > .offset-2,
    .content .row > .offset-3,
    .content .row > .offset-4 {
        margin-left: 0;
    }

    .content .row > .col-3,
    .content .row > .col-4,
    .content .row > .col-5,
    .content .row > .col-6,
    .content .row > .col-7,
    .content .row > .col-8,
    .content .row > .col-9,
    .content .row > .col-10 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .form-group.row,
    .card-header form .row,
    .card-body form .row {
        row-gap: 10px;
    }

    .form-control,
    .input-group,
    .btn {
        max-width: 100%;
    }

    .form-group .form-control + .form-control {
        margin-top: 8px;
    }

    .card-header form .btn,
    .card-body form .btn,
    .form-group .btn {
        width: 100%;
        min-height: 42px;
        white-space: normal;
    }

    .input-group .input-group-append .btn,
    .input-group .input-group-prepend .btn {
        width: auto;
    }

    .float-right {
        float: none !important;
    }

    .table-responsive {
        width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        border: 0;
    }

    .table-responsive > .table {
        min-width: 720px;
        margin-bottom: 0;
        font-size: 0.9rem;
    }

    .table th,
    .table td {
        vertical-align: middle;
        white-space: normal;
        word-break: normal;
    }

    .pagination {
        flex-wrap: wrap;
        gap: 4px;
        justify-content: center;
    }

    .main-footer {
        position: static !important;
        margin-left: 0 !important;
        padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
        white-space: normal;
        line-height: 1.45;
    }
}

@media (max-width: 575.98px) {
    .content-header {
        padding-top: 12px;
    }

    .content-header h1 {
        font-size: 1.45rem;
    }

    .card-header,
    .card-body {
        padding: 12px;
    }

    .navbar-nav .nav-link {
        padding-left: 0.65rem;
        padding-right: 0.65rem;
    }

    .table-responsive > .table {
        min-width: 680px;
        font-size: 0.86rem;
    }

    .table th,
    .table td {
        padding: 0.62rem;
    }
}

/* Polimento visual das telas internas. */
.content-wrapper {
    background: #f4f6f9;
}

.content-header h1 {
    color: #1f2933;
    font-weight: 600;
}

.card {
    border: 1px solid rgba(31, 41, 51, 0.08);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(31, 41, 51, 0.06);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid rgba(31, 41, 51, 0.08);
}

.card-title {
    color: #1f2933;
    font-weight: 600;
}

.form-control,
select.form-control {
    min-height: 38px;
    border-color: #cfd8e3;
    border-radius: 6px;
}

.form-control:focus,
select.form-control:focus {
    border-color: #2684ff;
    box-shadow: 0 0 0 0.15rem rgba(38, 132, 255, 0.14);
}

label,
.col-form-label {
    color: #111827;
    font-size: 0.9rem;
    font-weight: 600;
}

.btn {
    border-radius: 6px;
    font-weight: 600;
}

.table {
    background: #fff;
}

.table thead th {
    background: #f8fafc;
    border-bottom-width: 1px;
    color: #111827;
    font-weight: 700;
    vertical-align: middle;
}

.table tbody td {
    color: #1f2933;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: #f5f9ff;
}

#formcliente {
    padding-bottom: 24px;
}

#formcliente .card {
    max-width: 100%;
}

#formcliente .card-body {
    padding: 16px 18px;
}

#formcliente > label.col-form-label + div,
#formcliente > label.col-form-label + div[class*='col-sm-'] {
    margin-bottom: 14px;
}

#formcliente > input[type='hidden'],
#formcliente > div > input[type='hidden'] {
    display: none;
}

#formcliente .card-footer {
    max-width: 1240px;
    margin-top: 18px;
    padding: 16px 0 0;
    border-top: 1px solid rgba(31, 41, 51, 0.08);
    background: transparent;
}

#formcliente .card-footer .btn {
    min-width: 130px;
}

@media (min-width: 992px) {
    #formcliente > .col-sm-8,
    #formcliente > .col-sm-6,
    #formcliente > .col-sm-4,
    #formcliente > .col-sm-3 {
        max-width: min(100%, 980px);
    }

    #formcliente > .col-sm-8 .form-control,
    #formcliente > .col-sm-6 .form-control,
    #formcliente > .col-sm-4 .form-control,
    #formcliente > .col-sm-3 .form-control {
        width: 100%;
    }

    #formcliente > label.col-sm-8 {
        max-width: 980px;
    }
}

/* Selecao de cliente em celular: tabela vira cards. */
@media (max-width: 575.98px) {
    .table-responsive:has(.cliente-select-table) {
        overflow-x: visible;
    }

    .table-responsive > .cliente-select-table {
        min-width: 0;
        border: 0;
        background: transparent;
    }

    .cliente-select-table thead {
        display: none;
    }

    .cliente-select-table,
    .cliente-select-table tbody,
    .cliente-select-table tr,
    .cliente-select-table td {
        display: block;
        width: 100%;
    }

    .cliente-select-table tbody tr {
        margin: 0 0 12px;
        padding: 12px;
        border: 1px solid #dbe3ee;
        border-radius: 8px;
        background: #fff;
        box-shadow: 0 6px 18px rgba(31, 41, 51, 0.08);
    }

    .cliente-select-table tbody td {
        display: grid;
        grid-template-columns: 92px minmax(0, 1fr);
        gap: 10px;
        padding: 7px 0;
        border: 0;
        font-size: 0.92rem;
        line-height: 1.35;
        text-align: left !important;
        word-break: normal;
    }

    .cliente-select-table tbody td::before {
        color: #5b6776;
        font-size: 0.78rem;
        font-weight: 700;
        letter-spacing: 0;
        text-transform: uppercase;
    }

    .cliente-select-table tbody td:nth-child(1)::before { content: 'Codigo'; }
    .cliente-select-table tbody td:nth-child(2)::before { content: 'Razao'; }
    .cliente-select-table tbody td:nth-child(3)::before { content: 'Nome'; }
    .cliente-select-table tbody td:nth-child(4)::before { content: 'CNPJ'; }
    .cliente-select-table tbody td:nth-child(5)::before { content: 'Cidade'; }
    .cliente-select-table tbody td:nth-child(6)::before { content: 'Aberto'; }
    .cliente-select-table tbody td:nth-child(7)::before { content: ''; }

    .cliente-select-table tbody td:last-child {
        display: block;
        padding-top: 12px;
    }

    .cliente-select-table tbody td:last-child::before {
        content: none;
    }

    .cliente-select-table tbody td:last-child .btn {
        width: 100%;
        min-height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .cliente-select-table .bg-danger {
        display: inline-flex;
        width: fit-content;
        min-width: 38px;
        justify-content: center;
        padding: 3px 8px;
        border-radius: 999px;
    }
}
