
/* =========================================================
       صفحه
       ========================================================= */
.formulas-page {
    padding-bottom: 40px;
    background: #f4f6f8;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.page-title {
    font-weight: 800;
    margin-bottom: 5px;
    color: #303943;
}

.page-subtitle {
    color: #707983;
    font-size: 13px;
}


/* =========================================================
       فیلتر
       ========================================================= */

.filter-card {
    border: 1px solid #e1e5e9;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(45, 55, 65, 0.05);
    overflow: visible;
}

.filter-card .card-body,
.filter-card .row {
    overflow: visible;
}

.formula-date-filter {
    position: relative;
}

.formula-date-filter.calendar-open {
    z-index: 120;
}

.filter-title {
    font-weight: 700;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e8ebee;
    
}

    .filter-title i {
        color: #527da8;
        margin-left: 5px;
    }

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: #4f5963;
}

.form-control,
.form-select {
    min-height: 40px;
    border-radius: 8px;
    font-size: 13px;
    border-color: #d9dee3;
    color: #303943;

    direction:rtl;
}

    .form-control:focus,
    .form-select:focus {
        border-color: #7fa4c4;
        box-shadow: 0 0 0 .15rem rgba(82, 125, 168, .12);
    }

    .form-control::placeholder {
        color: #929aa2;
    }

.filter-button {
    min-height: 40px;
    border-radius: 8px;
}


/* =========================================================
       DatePicker
       ========================================================= */

.persian-date-picker {
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
    height: 36px;
}

.persian-date-input-wrapper {
    position: relative;
    width: 145px;
    height: 36px;
}

.persian-date-input {
    width: 145px !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 4px 32px 4px 8px !important;
    border-radius: 7px !important;
    text-align: center;
    direction: ltr;
    font-family: Tahoma, Arial, sans-serif;
    font-size: 12px !important;
    letter-spacing: .3px;
    background: #ffffff;
    color: #303943;
    border: 1px solid #d9dee3;
}

    .persian-date-input:focus {
        border-color: #7fa4c4;
        box-shadow: 0 0 0 .15rem rgba(82, 125, 168, .12);
    }

.date-calendar-button {
    position: absolute;
    right: 0;
    top: 0;
    width: 32px;
    height: 36px;
    border: 0;
    background: transparent;
    color: #527da8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
}

    .date-calendar-button:hover {
        color: #456d95;
    }

.today-button {
    height: 36px;
    padding: 3px 8px;
    font-size: 11px;
    white-space: nowrap;
    border: 1px solid #7fa4c4;
    background: #ffffff;
    color: #527da8;
    border-radius: 7px;
    cursor: pointer;
    transition: .15s;
}

    .today-button:hover {
        background: #527da8;
        color: #ffffff;
    }


/* =========================================================
       خطای تاریخ
       ========================================================= */

.date-invalid .persian-date-input {
    border-color: #c77676 !important;
    background-color: #fbf2f2;
}

    .date-invalid .persian-date-input:focus {
        border-color: #c77676 !important;
        box-shadow: 0 0 0 .15rem rgba(183, 101, 101, .12);
    }


/* =========================================================
       تقویم
       ========================================================= */

.persian-calendar {
    position: absolute;
    top: calc(100% + 8px);
    right: 12px;
    width: min(285px, calc(100vw - 32px));
    max-height: min(390px, calc(100vh - 110px));
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #ffffff;
    border: 1px solid #dfe4e8;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(45, 55, 65, .12);
    padding: 12px;
    z-index: 9999;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.calendar-title {
    font-size: 14px;
    font-weight: 700;
    color: #303943;
}

.calendar-nav-button {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 7px;
    background: #f0f3f5;
    color: #59636d;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: .15s;
}

    .calendar-nav-button:hover {
        background: #e6eef5;
        color: #527da8;
    }

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 4px;
}

    .calendar-weekdays span {
        text-align: center;
        font-size: 11px;
        font-weight: 700;
        color: #7c858e;
        padding: 5px 0;
    }

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.calendar-empty {
    width: 31px;
    height: 31px;
}

.calendar-day {
    width: 31px;
    height: 31px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #3f4851;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: .15s;
}

    .calendar-day:hover {
        background: #eaf2f8;
        color: #527da8;
    }

    .calendar-day.selected {
        background: #527da8;
        color: #ffffff;
        font-weight: 700;
    }

    .calendar-day.today {
        border: 1px solid #7fa4c4;
    }

    .calendar-day.selected.today {
        border-color: #ffffff;
    }

.calendar-footer {
    border-top: 1px solid #e8ebee;
    margin-top: 10px;
    padding-top: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.calendar-today-button {
    border: 0;
    background: transparent;
    color: #527da8;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

    .calendar-today-button:hover {
        color: #456d95;
        text-decoration: underline;
    }

.calendar-close-button {
    border: 0;
    background: transparent;
    color: #8a8f98;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

    .calendar-close-button:hover {
        color: #5b6068;
        text-decoration: underline;
    }


/* =========================================================
       نتایج
       ========================================================= */

.results-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #e2e6e9;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: #59636d;
}


/* =========================================================
       کارت فرمول
       ========================================================= */

.formula-column {
    display: flex;
    justify-content: center;
}

.formula-card {
    width: 100%;
    max-width: 320px;
    border-radius: 14px;
    overflow: visible;
    border: 1px solid #dfe4e8;
    background: #ffffff;
    transition: .2s;
    cursor: pointer;
}

    .formula-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 25px rgba(45, 55, 65, .11) !important;
    }


/* =========================================================
       وضعیت فرمول
       ========================================================= */

.status-draft {
    border-top: 5px solid #7d858d !important;
}

.status-submitted {
    border-top: 5px solid #b89a60 !important;
}

.status-approved {
    border-top: 5px solid #609174 !important;
}

.status-rejected {
    border-top: 5px solid #b76565 !important;
}


/* =========================================================
       هدر کارت فرمول
       ========================================================= */

.formula-header {
    background: #303943;
    color: #ffffff;
    padding: 14px;
    border-radius: 9px 9px 0 0;
}

    .formula-header .formula-color {
        color: #d4dbe1;
    }

    .formula-header .formula-label {
        color: #bcc6ce;
    }

.formula-code {
    font-size: 12px;
    font-weight: 800;
    color: #ffffff;
}

.formula-color {
    margin-top: 5px;
    color: #59636d;
    font-size: 22px;
}

.formula-label {
    color: #8a939b;
    font-size: 11px;
    margin-top: 3px;
}

.formula-n {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 5px 9px;
    border: 1px solid rgba(255,255,255,.20);
    border-radius: 8px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 800;
    background: rgba(255,255,255,.07);
    margin-bottom: 7px;
}

.formula-n-label {
    color: #d6ad58;
    font-weight: 900;
}


/* =========================================================
       اطلاعات کارت
       ========================================================= */

.formula-info {
    background: #f8f9fa;
    padding: 10px 14px;
    border-bottom: 1px solid #e7eaed;
}

.formula-info-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 0;
    font-size: 12px;
}

    .formula-info-row span {
        color: #7a838c;
    }

    .formula-info-row i {
        color: #527da8;
        margin-left: 4px;
    }

    .formula-info-row strong {
        max-width: 65%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        color: #3d4650;
    }

.formula-body {
    padding: 14px;
    background: #ffffff;
}

.materials-title {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 700;
    color: #3d4650;
}

    .materials-title i {
        color: #527da8;
    }

.materials-count {
    color: #8a939b;
    font-weight: 400;
}

.materials-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.formula-material {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: #fafbfc;
    border: 1px solid #e6e9ec;
    border-radius: 8px;
}

.material-name {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    min-width: 0;
    color: #424b54;
}

.material-dot {
    width: 7px;
    height: 7px;
    min-width: 7px;
    background: #6f94b5;
    border-radius: 50%;
}

.material-percent {
    background: #eaf2f8;
    color: #527da8;
    padding: 4px 8px;
    border-radius: 20px;
    font-weight: 700;
    direction: ltr;
}

.no-material {
    text-align: center;
    color: #8a939b;
    padding: 15px;
    font-size: 12px;
}

.formula-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    border-radius: 0 0 14px 14px;
}

.formula-actions {
    display: flex;
    gap: 5px;
}

    .formula-actions .btn {
        font-size: 11px;
    }


/* =========================================================
       وضعیت
       ========================================================= */

.status-badge-draft {
    color: #a65f5f;
}


/* =========================================================
       Tooltip
       ========================================================= */

.update-tooltip {
    position: relative;
    color: #7b838b;
    font-size: 11px;
    cursor: help;
}

.tooltip-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    right: 0;
    bottom: 25px;
    width: 280px;
    background: #343c44;
    color: #ffffff;
    padding: 12px;
    border-radius: 9px;
    z-index: 99999;
    transition: .15s;
    box-shadow: 0 8px 20px rgba(40, 50, 60, .16);
}

.update-tooltip:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
}

.tooltip-title {
    font-weight: 700;
    margin-bottom: 7px;
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    margin-bottom: 4px;
}

    .tooltip-row span {
        color: #b7c0c8;
    }


/* =========================================================
       Pagination
       ========================================================= */

.pagination-container {
    margin-top: 25px;
    padding: 14px 16px;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    flex-wrap: wrap;
    box-shadow: 0 2px 7px rgba(45, 55, 65, .04);
}

.page-size-box {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #707983;
    font-size: 12px;
}

    .page-size-box .form-select {
        width: 70px;
        min-height: 32px;
        height: 32px;
        padding-top: 2px;
        padding-bottom: 2px;
        font-size: 12px;
    }

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-button {
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dce1e5;
    border-radius: 7px;
    background: #ffffff;
    color: #59636d;
    font-size: 12px;
    cursor: pointer;
    transition: .15s;
}

    .pagination-button:hover:not(:disabled) {
        background: #eaf2f8;
        border-color: #9bb6cc;
        color: #527da8;
    }

    .pagination-button.active {
        background: #527da8;
        border-color: #527da8;
        color: #ffffff;
        font-weight: 700;
    }

    .pagination-button:disabled {
        opacity: .45;
        cursor: not-allowed;
    }

.pagination-dots {
    min-width: 25px;
    text-align: center;
    color: #9ba3aa;
    font-size: 13px;
}

.pagination-info {
    color: #707983;
    font-size: 12px;
}

    .pagination-info strong {
        color: #3d4650;
    }


/* =========================================================
       Loading
       ========================================================= */

.loading-box {
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #7b838b;
    border: 1px solid #e5e9ec;
    border-radius: 12px;
    background: #ffffff;
}


/* =========================================================
       Empty
       ========================================================= */

.empty-box {
    text-align: center;
    padding: 55px 20px;
    border: 1px solid #e5e9ec;
    border-radius: 12px;
    background: #ffffff;
    color: #737c85;
}

.empty-icon {
    font-size: 45px;
    color: #aeb7bf;
    margin-bottom: 10px;
}


/* =========================================================
       Popup
       ========================================================= */

.formula-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1055;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: rgba(35, 43, 50, .58);
    backdrop-filter: blur(3px);
}

.formula-modal {
    width: min(620px, calc(100vw - 24px));
    max-height: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 20px 55px rgba(35, 43, 50, .22);
    animation: formulaModalShow .18s ease-out;
}

@keyframes formulaModalShow {

    from {
        opacity: 0;
        transform: scale(.94) translateY(12px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.formula-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 14px;
    background: #303943;
    color: #ffffff;
}

.formula-modal-header > div:first-child {
    min-width: 0;
    flex: 1 1 auto;
}

.formula-modal-title {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: 18px;
    font-weight: 900;
    color: #ffffff;
}

.formula-modal-subtitle {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 3px;
    color: #d7dee4;
    font-size: 13px;
}

.modal-n-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    padding: 3px 7px;
    border-radius: 7px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.16);
    color: #d6ad58;
    font-weight: 800;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.formula-modal-close {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 7px;
    background: rgba(255,255,255,.07);
    color: #ffffff;
    cursor: pointer;
    transition: .15s;
}

    .formula-modal-close:hover {
        background: rgba(255,255,255,.14);
    }

.formula-modal-body {
    flex: 0 0 auto;
    min-height: auto;
    overflow: visible;
    padding: 12px 14px;
    background: #ffffff;
}

.modal-info-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 6px;
    margin-bottom: 10px;
}

.modal-info-item {
    min-width: 0;
    padding: 7px 9px;
    border: 1px solid #e2e6e9;
    border-radius: 8px;
    background: #f7f9fa;
}

    .modal-info-item span {
        display: block;
        margin-bottom: 2px;
        color: black;
        font-size: 10px;
    }

    .modal-info-item strong {
        display: block;
        min-width: 0;
        overflow-wrap: anywhere;
        word-break: break-word;
        color: #303943;
        font-size: 12px;
    }

.modal-label-box {
    margin-bottom: 10px;
    padding: 7px 9px;
    border-radius: 8px;
    background: #f1f3f5;
    color: #59636d;
    font-size: 11px;
    display: none;
}

.modal-section-title {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    margin-bottom: 6px;
    color: #527da8;
    font-size: 12px;
    font-weight: 800;
}

    .modal-section-title > span {
        margin-right: auto;
        padding: 2px 6px;
        border-radius: 20px;
        background: #edf1f4;
        color: #66717b;
        font-size: 11px;
    }

.modal-materials-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.modal-material-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid #e2e6e9;
    border-radius: 7px;
    background: #ffffff;
}

    .modal-material-row > div {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
        overflow-wrap: anywhere;
        word-break: break-word;
}

.modal-material-percent {
    flex: 0 0 auto;
    min-width: 48px;
    text-align: center;
    padding: 3px 5px;
    border-radius: 6px;
    background: #edf3f7;
    color: #527da8;
    font-size: 11px;
    font-weight: 800;
}

.modal-empty-material {
    padding: 10px;
    text-align: center;
    border: 1px dashed #cfd6dc;
    border-radius: 8px;
    color: #737d86;
    font-size: 11px;
}

.modal-description {
    margin-top: 10px;
}

.modal-description-text {
    padding: 8px 10px;
    border-radius: 8px;
    background: #f7f9fa;
    color: #414b54;
    font-size: 11px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.formula-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    padding: 8px 14px;
    border-top: 1px solid #e2e6e9;
    background: #f7f9fa;
}


/* =========================================================
       دکمه‌های این صفحه
       ========================================================= */

.formulas-page .btn-primary {
    background-color: #527da8;
    border-color: #527da8;
}

    .formulas-page .btn-primary:hover {
        background-color: #456d95;
        border-color: #456d95;
    }

.formulas-page .btn-success {
    background-color: #609174;
    border-color: #609174;
}

.formulas-page .btn-danger {
    background-color: #b76565;
    border-color: #b76565;
}

.formulas-page .btn-warning {
    background-color: #b58a4a;
    border-color: #b58a4a;
    color: #ffffff;
}


/* =========================================================
       موبایل
       ========================================================= */

@media (max-width: 768px) {

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .results-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 7px;
    }

    .persian-calendar {
        right: 12px;
        left: auto;
    }

    .pagination-container {
        justify-content: center;
    }

    .page-size-box {
        width: 100%;
        justify-content: center;
    }

    .pagination-pages {
        width: 100%;
        justify-content: center;
    }

    .pagination-info {
        width: 100%;
        text-align: center;
    }
}


@media (max-width: 576px) {

    .formula-modal-backdrop {
        padding: 6px;
    }

    .formula-modal {
        width: 100%;
        max-height: none;
        border-radius: 12px;
    }

    .modal-info-grid {
        grid-template-columns: 1fr;
    }

    .formula-modal-footer {
        flex-wrap: wrap;
    }

        .formula-modal-footer .btn {
            flex: 1 1 auto;
        }
}


/* =========================================================
   Responsive containment for formula cards
   ========================================================= */

.formulas-page .row,
.formulas-page .formula-column,
.formulas-page .formula-card,
.formulas-page .formula-card > * {
    min-width: 0;
    box-sizing: border-box;
}

.formulas-page .formula-card {
    width: 100%;
    max-width: 320px;
    min-height: 294px;
    display: flex;
    flex-direction: column;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    border: 1px solid #d9e0e6;
    box-shadow: 0 3px 12px rgba(32, 51, 68, .06);
}

/* مواد فقط در پنجرهٔ جزئیات نمایش داده می‌شوند، نه در کارت فهرست. */
.formulas-page .formula-card .formula-body {
    display: none;
}

.formulas-page .formula-header {
    min-height: 104px;
    padding: 16px;
    background: linear-gradient(135deg, #273846, #3a5365);
}

.formulas-page .formula-code {
    font-size: 17px;
    letter-spacing: .02em;
}

.formulas-page .formula-color {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.7;
}

.formulas-page .formula-info {
    min-height: 126px;
    padding: 12px 16px;
    background: #fbfcfd;
}

.formulas-page .formula-info-row {
    min-height: 31px;
    align-items: center;
    border-bottom: 1px dashed #e4e9ed;
}

.formulas-page .formula-info-row:last-child {
    border-bottom: 0;
}

.formulas-page .formula-info-row span {
    font-size: 11px;
    font-weight: 600;
}

.formulas-page .formula-info-row strong {
    font-size: 12px;
    font-weight: 600;
    text-align: left;
}

.formulas-page .formula-footer {
    min-height: 64px;
    margin-top: auto;
    padding: 12px 14px;
    border-top: 1px solid #e7ecf0;
    background: #fff;
}

.formulas-page .formula-actions .btn {
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
}

.formulas-page .formula-header > .d-flex {
    min-width: 0;
    gap: 10px;
}

.formulas-page .formula-header > .d-flex > div {
    min-width: 0;
}

.formulas-page .formula-header > .d-flex > div:first-child {
    flex: 1 1 0;
}

.formulas-page .formula-header > .d-flex > div:last-child {
    flex: 0 1 auto;
    max-width: 52%;
}

.formulas-page .formula-code,
.formulas-page .formula-color {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.3;
}

.formulas-page .formula-code {
    white-space: nowrap;
}

.formulas-page .formula-code-main,
.formulas-page .formula-code-last {
    display: block;
    max-width: none;
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
}

.formulas-page .formula-code-last {
    margin-top: 2px;
    font-size: .82em;
    letter-spacing: .08em;
}

.formulas-page .formula-code {
    font-size: clamp(13px, 2vw, 22px);
}

.formulas-page .formula-color {
    font-size: clamp(13px, 2vw, 22px);
}

.formulas-page .formula-n,
.formulas-page .formula-card .badge {
    max-width: 100%;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    text-align: center;
}

.formulas-page .formula-info-row {
    min-width: 0;
    align-items: flex-start;
}

.formulas-page .formula-info-row > span {
    flex: 0 0 auto;
    max-width: 40%;
    line-height: 1.4;
}

.formulas-page .formula-info-row > strong {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
    line-height: 1.35;
    text-align: left;
}

.formulas-page .materials-title {
    min-width: 0;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
}

.formulas-page .materials-title > span:first-child {
    min-width: 0;
    flex: 1 1 auto;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.formulas-page .materials-count {
    flex: 0 0 auto;
    white-space: nowrap;
}

.formulas-page .formula-material {
    min-width: 0;
    gap: 8px;
}

.formulas-page .material-name {
    flex: 1 1 auto;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
}

.formulas-page .material-percent {
    flex: 0 0 auto;
    white-space: nowrap;
}

.formulas-page .formula-footer {
    min-width: 0;
    align-items: flex-start;
    flex-wrap: wrap;
}

.formulas-page .update-info,
.formulas-page .update-tooltip {
    min-width: 0;
    max-width: 100%;
}

.formulas-page .update-info {
    flex: 1 1 120px;
}

.formulas-page .update-tooltip {
    display: inline-block;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.formulas-page .formula-actions {
    flex: 1 1 150px;
    min-width: 0;
    max-width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.formulas-page .formula-actions .btn {
    min-width: 0;
    flex: 1 1 auto;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.formulas-page .tooltip-content {
    width: min(280px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    box-sizing: border-box;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.formulas-page .tooltip-row {
    min-width: 0;
}

.formulas-page .tooltip-row > span,
.formulas-page .tooltip-row > strong {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (max-width: 576px) {

    .formulas-page .formula-card {
        max-width: 100%;
    }

    .formulas-page .formula-header > .d-flex {
        flex-wrap: wrap;
    }

    .formulas-page .formula-header > .d-flex > div:last-child {
        max-width: 100%;
        margin-inline-start: auto;
    }

    .formulas-page .formula-actions {
        flex-basis: 100%;
        width: 100%;
    }

    .formulas-page .formula-actions .btn {
        flex: 1 1 0;
    }
}


