/* Shared layout corrections for the existing PHP screens. */
@font-face {
    font-family: "Open Sans";
    src: url("../necessity/fonts/OpenSans-Regular.ttf") format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "Open Sans";
    src: url("../necessity/fonts/OpenSans-Semibold.ttf") format("truetype");
    font-style: normal;
    font-weight: 500;
    font-display: swap;
}

@font-face {
    font-family: "Open Sans";
    src: url("../necessity/fonts/OpenSans-Semibold.ttf") format("truetype");
    font-style: normal;
    font-weight: 600;
    font-display: swap;
}

@font-face {
    font-family: "Open Sans";
    src: url("../necessity/fonts/OpenSans-Bold.ttf") format("truetype");
    font-style: normal;
    font-weight: 700;
    font-display: swap;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    color: #344054;
    font-family: "Open Sans", "Public Sans", "Segoe UI", Arial, sans-serif !important;
    font-size: 0.9375rem;
    font-weight: 400;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.015em;
}

button,
input,
select,
textarea {
    font: inherit;
}

label,
.form-label {
    font-weight: 500;
}

th,
.table th {
    font-weight: 600;
}

td,
.table td {
    font-weight: 400;
}

:focus-visible {
    outline: 2px solid #5b72e8;
    outline-offset: 2px;
}

.apexcharts-canvas,
.apexcharts-svg,
.apexcharts-text,
.apexcharts-tooltip,
.apexcharts-legend-text {
    font-family: "Open Sans", "Public Sans", "Segoe UI", Arial, sans-serif !important;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
}

img,
svg,
video,
canvas {
    max-width: 100%;
}

input,
select,
textarea,
button {
    max-width: 100%;
}

.container,
.container-fluid,
.container-xxl,
.content-wrapper,
.layout-page,
.layout-container,
.row > *,
.card,
.card-body {
    min-width: 0;
}

.table-responsive,
.table-container,
.perf-table-responsive,
.cs-table-scroll,
.cc-table-scroll,
.cp-table-scroll {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive > table,
.table-container > table {
    min-width: 0;
}

.layout-page .chart-container {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
}

.layout-navbar.navbar-detached {
    width: calc(100% - 2rem);
    max-width: 100%;
}

.layout-navbar form.row {
    width: 100%;
    margin-right: 0;
    margin-left: 0;
}

.card.header {
    max-width: calc(100% - 24px);
}

.card.header > .row {
    width: 100%;
    align-items: center;
}

.page-title {
    min-width: 0;
    overflow-wrap: anywhere;
}

.nav-tabs {
    max-width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
}

.nav-tabs .nav-link {
    white-space: nowrap;
}

.modal-dialog {
    max-width: calc(100% - 1rem);
}

.modal-content,
.dropdown-menu {
    max-width: calc(100vw - 1rem);
}

.login_form {
    border-radius: 12px;
}

.login_form h3 {
    font-size: 1.25rem !important;
    font-weight: 600 !important;
}

.login_form form .input_box label {
    font-weight: 500;
}

.login_form form .input_box input {
    font-size: 0.9375rem !important;
}

.login_form form button {
    font-size: 0.9375rem !important;
    font-weight: 600;
}

@media (max-width: 767.98px) {
    .login_form {
        width: 100%;
        max-width: 435px;
        margin: 0 auto !important;
        padding: 1.75rem 1.375rem;
    }

    header .logo {
        left: 1rem;
        top: 1rem;
        width: 130px;
        height: auto;
        margin: 0 !important;
    }

    header .logo img {
        height: auto;
        object-fit: contain;
    }

    .content-wrapper .card {
        max-width: 100%;
        margin-right: 0;
        margin-left: 0;
    }

    .container-xxl.flex-grow-1,
    .content-wrapper > .container-xxl {
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }

    .layout-navbar.navbar-detached {
        width: calc(100% - 1rem);
        margin-right: 0.5rem;
        margin-left: 0.5rem;
        padding: 0.75rem;
    }

    .layout-navbar form.row > [class*="col-"] {
        min-width: 0;
    }

    .card-header,
    .card-header:first-child {
        padding-right: 1rem;
        padding-left: 1rem;
    }

    .card.header {
        height: auto;
        min-height: 50px;
        margin-right: 8px;
        margin-left: 8px;
        padding: 0.5rem;
    }

    .card.header .d-flex {
        height: auto;
        min-height: 40px;
        flex-wrap: wrap;
    }

    .card.header .page-title {
        padding-left: 0.5rem;
        font-size: clamp(1rem, 4vw, 1.25rem);
    }

    .table-responsive table,
    .table-container table {
        width: max-content;
        min-width: 100%;
    }

    .table-responsive th,
    .table-responsive td,
    .table-container th,
    .table-container td {
        white-space: normal;
    }

    .period-toggle {
        flex-wrap: wrap;
    }

    .perf-report-header {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 1rem;
    }

    .perf-header-left {
        min-width: 0;
    }

    .perf-period-badge {
        white-space: normal;
    }

    .cs-top-left,
    .cs-top-right {
        flex: 1 1 100%;
        min-width: 0;
        padding-right: 0;
        padding-left: 0;
        border-right: 0;
    }

    .cc-col-4,
    .cc-col-8,
    .cc-col-side,
    .cc-col-6 {
        min-width: 0;
    }

    .modal-dialog {
        margin: 0.5rem auto;
    }

    body:has(.login_form) {
        min-height: 100svh;
        height: auto;
        padding: 5.5rem 1rem 3.5rem;
        justify-content: center;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .card {
        margin-right: 0.25rem;
        margin-left: 0.25rem;
    }

    .btn-group,
    .period-toggle {
        max-width: 100%;
    }

    .btn-group > .btn,
    .period-toggle .toggle-btn {
        padding-right: 0.65rem;
        padding-left: 0.65rem;
    }

    .modal-dialog {
        max-width: calc(100% - 0.5rem);
    }
}
