/* ========================================================= */
/* 01. Base                                                  */
/* ========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    font-size: 16px;
}

body {
    margin: 0;
    min-height: 100%;
    background: #f4f8ff;
    color: #172033;
    font-family: Arial, Helvetica, sans-serif;
}

a {
    color: inherit;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}


/* ========================================================= */
/* 02. Topbar                                                */
/* ========================================================= */

.topbar {
    background: #ffffff;
    border-bottom: 1px solid #dbe5f2;
}

.topbar-inner {
    width: min(1200px, 100%);
    min-height: 68px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 28px;
}

.brand {
    color: #172033;
    font-size: 22px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.main-nav {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 20px;
}

    .main-nav a {
        color: #344054;
        font-size: 15px;
        font-weight: 700;
        text-decoration: none;
    }

        .main-nav a:hover {
            color: #2f80ed;
        }

.login-partial {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-email {
    color: #172033;
    font-size: 14px;
    font-weight: 700;
}

.logout-form {
    margin: 0;
}

.logout-button {
    min-height: 36px;
    padding: 8px 16px;
    border: none;
    border-radius: 10px;
    background: #fff0f0;
    color: #d92d20;
    font-size: 14px;
    font-weight: 800;
}

    .logout-button:hover {
        background: #ffe1e1;
    }

.login-link {
    color: #2f80ed;
    font-size: 15px;
    font-weight: 800;
    text-decoration: none;
}


/* ========================================================= */
/* 03. Common page layout                                    */
/* ========================================================= */

.users-page,
.projects-page {
    width: min(1200px, 100%);
    margin: 0 auto;
    padding: 36px 24px;
}

.page-header {
    margin-bottom: 24px;
}

    .page-header h1 {
        margin: 0 0 8px;
        color: #172033;
        font-size: 42px;
        font-weight: 800;
        line-height: 1.15;
    }

    .page-header p {
        margin: 0;
        color: #667085;
        font-size: 16px;
    }

.page-card {
    padding: 30px;
    background: #ffffff;
    border: 1px solid #dbe5f2;
    border-radius: 18px;
    box-shadow: 0 12px 32px rgba(20, 40, 80, 0.08);
}

    .page-card h2 {
        margin: 0 0 22px;
        color: #172033;
        font-size: 22px;
        font-weight: 800;
    }


/* ========================================================= */
/* 04. Forms                                                 */
/* ========================================================= */

.form-stack,
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-field {
    width: 100%;
}

    .form-field label,
    .auth-form label {
        display: block;
        margin-bottom: 7px;
        color: #667085;
        font-size: 14px;
        font-weight: 700;
    }

    .form-field input,
    .form-field select,
    .auth-form input {
        display: block;
        width: 100%;
        min-height: 46px;
        padding: 10px 13px;
        border: 1px solid #cfd8e6;
        border-radius: 10px;
        background: #ffffff;
        color: #172033;
        font-size: 15px;
        outline: none;
    }

        .form-field input:focus,
        .form-field select:focus,
        .auth-form input:focus {
            border-color: #2f80ed;
            box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.14);
        }

.primary-button,
.auth-button {
    width: 100%;
    min-height: 48px;
    border: none;
    border-radius: 10px;
    background: #2f80ed;
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
}

    .primary-button:hover,
    .auth-button:hover {
        background: #1f6fd6;
    }

.text-danger,
.auth-validation {
    color: #d92d20;
    font-size: 14px;
    font-weight: 600;
}


/* ========================================================= */
/* 05. Auth page                                             */
/* ========================================================= */

.auth-page {
    min-height: calc(100vh - 69px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}

.auth-card {
    width: 100%;
    max-width: 430px;
    padding: 32px;
    background: #ffffff;
    border: 1px solid #dbe5f2;
    border-radius: 18px;
    box-shadow: 0 18px 45px rgba(20, 40, 80, 0.10);
}

.auth-title {
    margin: 0 0 24px;
    text-align: center;
    color: #172033;
    font-size: 28px;
    font-weight: 800;
}


/* ========================================================= */
/* 06. Users page                                            */
/* ========================================================= */

.users-layout {
    display: grid;
    grid-template-columns: minmax(360px, 400px) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}


/* ========================================================= */
/* 07. Tables                                                */
/* ========================================================= */

.data-table {
    width: 100%;
    border-collapse: collapse;
}

    .data-table th,
    .data-table td {
        padding: 14px 16px;
        border-bottom: 1px solid #e5eaf2;
        color: #172033;
        font-size: 15px;
        line-height: 1.35;
        vertical-align: middle;
    }

    .data-table th {
        color: #344054;
        font-weight: 800;
        text-align: left;
    }

    .data-table tr:last-child td {
        border-bottom: none;
    }

.text-end {
    text-align: right;
}


/* ========================================================= */
/* 08. Access states                                         */
/* ========================================================= */

.empty-access-card {
    max-width: 620px;
}

    .empty-access-card p {
        margin: 0;
        color: #667085;
        font-size: 15px;
        line-height: 1.5;
    }


/* ========================================================= */
/* 09. Responsive                                            */
/* ========================================================= */

@media (max-width: 900px) {
    .topbar-inner {
        min-height: auto;
        padding-top: 16px;
        padding-bottom: 16px;
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
    }

    .main-nav {
        flex: none;
    }

    .login-partial {
        width: 100%;
        justify-content: space-between;
    }

    .users-layout {
        grid-template-columns: 1fr;
    }

    .page-header h1 {
        font-size: 32px;
    }
}

@media (max-width: 600px) {
    .users-page,
    .projects-page {
        padding: 24px 14px;
    }

    .page-card,
    .auth-card {
        padding: 22px;
        border-radius: 14px;
    }

    .data-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* ========================================================= */
/* 10. Project create page                                   */
/* ========================================================= */

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.form-actions,
.page-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.page-actions {
    margin-bottom: 20px;
}

.primary-link-button,
.secondary-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 800;
    text-decoration: none;
}

.primary-link-button {
    background: #2f80ed;
    color: #ffffff;
}

    .primary-link-button:hover {
        background: #1f6fd6;
    }

.secondary-link-button {
    background: #eef3fb;
    color: #24324a;
    border: 1px solid #d7e0ef;
}

    .secondary-link-button:hover {
        background: #e2eaf6;
    }

.form-field textarea {
    width: 100%;
    resize: vertical;
    min-height: 90px;
    padding: 11px 12px;
    border: 1px solid #d5deec;
    border-radius: 10px;
    background: #ffffff;
    color: #172033;
}

.text-danger {
    color: #c62828;
    font-size: 13px;
}

@media (max-width: 800px) {
    .form-grid-2,
    .form-grid-3 {
        grid-template-columns: 1fr;
    }

    .form-actions,
    .page-actions {
        align-items: stretch;
        flex-direction: column;
    }
}

.create-inline-card {
    margin-top: 20px;
}

.form-field select,
.form-field textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #d5deec;
    border-radius: 10px;
    background: #ffffff;
    color: #172033;
}

.form-field textarea {
    resize: vertical;
    min-height: 90px;
}

/* ========================================================= */
/* 11. Project details page                                  */
/* ========================================================= */

.project-details-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    gap: 20px;
    margin-bottom: 20px;
}

.details-list {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 10px 16px;
    margin: 0;
}

    .details-list dt {
        color: #64748b;
        font-size: 14px;
        font-weight: 700;
    }

    .details-list dd {
        margin: 0;
        color: #172033;
        font-size: 15px;
        line-height: 1.45;
    }

.muted-text {
    color: #64748b;
    margin: 0;
}

.table-note {
    margin-top: 4px;
    color: #64748b;
    font-size: 13px;
    line-height: 1.35;
}

@media (max-width: 900px) {
    .project-details-grid {
        grid-template-columns: 1fr;
    }

    .details-list {
        grid-template-columns: 1fr;
    }
}

/* ========================================================= */
/* 12. Project details compact improvements                  */
/* ========================================================= */

.customer-contacts-block {
    margin-top: 20px;
}

    .customer-contacts-block h3 {
        margin: 0 0 10px;
        color: #172033;
        font-size: 17px;
        font-weight: 900;
    }

.compact-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

    .compact-table th {
        padding: 8px 8px;
        border-bottom: 1px solid #dfe7f3;
        color: #51627a;
        font-weight: 800;
        text-align: left;
    }

    .compact-table td {
        padding: 8px 8px;
        border-bottom: 1px solid #edf2f8;
        color: #172033;
        vertical-align: top;
    }

.actable-scope-inline-form {
    display: grid;
    grid-template-columns: minmax(260px, 1.4fr) minmax(180px, 0.6fr) minmax(240px, 1fr);
    gap: 16px;
    align-items: start;
}

@media (max-width: 900px) {
    .actable-scope-inline-form {
        grid-template-columns: 1fr;
    }
}
/* ========================================================= */
/* 13. Project agreements                                    */
/* ========================================================= */

.agreement-inline-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

    .agreement-inline-form .form-field {
        min-width: 0;
    }

.form-field input,
.form-field select,
.form-field textarea {
    max-width: 100%;
}

@media (max-width: 900px) {
    .agreement-inline-form {
        grid-template-columns: 1fr;
    }
}
.danger-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid #ffd6d6;
    border-radius: 8px;
    background: #fff1f1;
    color: #c62828;
    font-size: 13px;
    font-weight: 800;
}

    .danger-link-button:hover {
        background: #ffe4e4;
    }

/* ========================================================= */
/* 14. Contract / actable scope two-column layout             */
/* ========================================================= */

.project-work-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.project-work-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.compact-data-table {
    font-size: 14px;
}

    .compact-data-table th,
    .compact-data-table td {
        padding: 12px 10px;
    }

.warning-text {
    color: #c62828;
    font-weight: 800;
}

@media (max-width: 1100px) {
    .project-work-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================================= */
/* 15. Project tabs                                           */
/* ========================================================= */

/* ========================================================= */
/* 15. Project tabs                                           */
/* ========================================================= */

.project-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin: 0 0 22px;
    border-bottom: 1px solid #d8e1ef;
}

    .project-tabs a {
        position: relative;
        display: inline-flex;
        align-items: center;
        min-height: 46px;
        padding: 0 18px;
        border: 0;
        border-radius: 0;
        background: transparent;
        color: #172033;
        font-size: 15px;
        font-weight: 800;
        text-decoration: none;
        white-space: nowrap;
    }

        .project-tabs a:hover {
            background: #eef4ff;
        }

        .project-tabs a.active {
            background: #ffffff;
            color: #172033;
        }

            .project-tabs a.active::after {
                content: "";
                position: absolute;
                left: 0;
                right: 0;
                bottom: -1px;
                height: 3px;
                background: #2f80ed;
            }

        .project-tabs a.disabled {
            color: #8a97aa;
            opacity: 1;
            cursor: not-allowed;
        }

            .project-tabs a.disabled:hover {
                background: transparent;
            }

@media (max-width: 900px) {
    .project-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

        .project-tabs a {
            flex: 0 0 auto;
        }
}

.agreement-form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
}

    .agreement-form-grid .form-field {
        min-width: 0;
    }

.warning-text {
    color: #c62828;
    font-weight: 800;
}

@media (max-width: 1000px) {
    .agreement-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .agreement-form-grid {
        grid-template-columns: 1fr;
    }
}
/* ========================================================= */
/* 16. Project management form                               */
/* ========================================================= */

.form-grid-3 .form-field,
.form-grid-2 .form-field {
    min-width: 0;
}

.details-list dd {
    overflow-wrap: anywhere;
}
.small-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid #d7e0ef;
    border-radius: 8px;
    background: #eef3fb;
    color: #24324a;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

    .small-action-link:hover {
        background: #e2eaf6;
    }

.table-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.data-table td {
    white-space: nowrap;
}

.user-full-name-cell {
    min-width: 160px;
    white-space: nowrap;
}
.users-page {
    width: min(1500px, 100%);
}

.users-layout {
    grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
}

.user-actions-cell {
    min-width: 220px;
    white-space: nowrap;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}
.project-filter-line {
    margin-bottom: 18px;
}

.project-filter-input {
    width: 100%;
    max-width: 420px;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid #d5deec;
    border-radius: 10px;
    background: #ffffff;
    color: #172033;
    font-size: 15px;
    outline: none;
}

    .project-filter-input:focus {
        border-color: #2f80ed;
        box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.14);
    }
.projects-compact-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

    .projects-compact-header h1 {
        margin: 0;
        color: #172033;
        font-size: 42px;
        font-weight: 800;
        line-height: 1.15;
    }

.project-filter-line {
    margin-bottom: 18px;
}

.project-filter-input {
    width: 100%;
    max-width: none;
    min-height: 46px;
    padding: 10px 14px;
    border: 1px solid #d5deec;
    border-radius: 10px;
    background: #ffffff;
    color: #172033;
    font-size: 15px;
    outline: none;
}

    .project-filter-input:focus {
        border-color: #2f80ed;
        box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.14);
    }

.project-details-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    margin-bottom: 18px;
}

    .project-details-grid .page-card {
        min-width: 0;
    }

    .project-details-grid .data-table {
        width: 100%;
    }

        .project-details-grid .data-table th,
        .project-details-grid .data-table td {
            white-space: nowrap;
            padding: 10px 8px;
        }

@media (max-width: 1100px) {
    .project-details-grid {
        grid-template-columns: 1fr;
    }
}
.page-header h1 {
    overflow-wrap: anywhere;
}
.project-title-header {
    margin-bottom: 22px;
}

    .project-title-header h1 {
        max-width: 100%;
        margin: 0;
        font-size: clamp(26px, 2.2vw, 34px);
        line-height: 1.18;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
.delivery-title-header {
    margin-bottom: 22px;
}

    .delivery-title-header h1 {
        max-width: 100%;
        margin: 0;
        font-size: clamp(28px, 2.6vw, 40px);
        line-height: 1.18;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

.delivery-details-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.85fr);
    gap: 18px;
    align-items: start;
    margin-bottom: 18px;
}

.delivery-actions-column {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}

.delivery-details-grid .page-card {
    min-width: 0;
}

@media (max-width: 1100px) {
    .delivery-details-grid {
        grid-template-columns: 1fr;
    }
}
.project-deliveries-table {
    table-layout: fixed;
}

    .project-deliveries-table th:nth-child(1),
    .project-deliveries-table td:nth-child(1) {
        width: 110px;
    }

    .project-deliveries-table th:nth-child(3),
    .project-deliveries-table td:nth-child(3) {
        width: 180px;
    }

    .project-deliveries-table th:nth-child(4),
    .project-deliveries-table td:nth-child(4) {
        width: 220px;
    }

    .project-deliveries-table th:nth-child(5),
    .project-deliveries-table td:nth-child(5) {
        width: 130px;
    }

    .project-deliveries-table th:nth-child(6),
    .project-deliveries-table td:nth-child(6) {
        width: 120px;
    }

    .project-deliveries-table td {
        overflow-wrap: anywhere;
        white-space: normal;
    }
.hidden {
    display: none !important;
}

.section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.delivery-edit-form {
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid #e3ebf6;
}
.compact-data-table th,
.compact-data-table td {
    padding: 12px 10px;
    font-size: 14px;
    line-height: 1.25;
}

.compact-data-table th {
    font-size: 14px;
}

.compact-data-table td {
    vertical-align: top;
}

.compact-data-table a {
    font-weight: 600;
}
.dashboard-table {
    table-layout: fixed;
    width: 100%;
}

    .dashboard-table th:nth-child(1),
    .dashboard-table td:nth-child(1) {
        width: 110px;
    }

    .dashboard-table th:nth-child(2),
    .dashboard-table td:nth-child(2) {
        width: 90px;
    }

    .dashboard-table th:nth-child(4),
    .dashboard-table td:nth-child(4) {
        width: 220px;
    }

    .dashboard-table th,
    .dashboard-table td {
        white-space: normal;
        overflow-wrap: anywhere;
        vertical-align: top;
    }
.dashboard-table {
    table-layout: fixed;
    width: 100%;
}

    .dashboard-table th:nth-child(1),
    .dashboard-table td:nth-child(1) {
        width: 100px;
    }

    .dashboard-table th:nth-child(2),
    .dashboard-table td:nth-child(2) {
        width: 200px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .dashboard-table th:nth-child(3),
    .dashboard-table td:nth-child(3) {
        width: 30%;
    }

    .dashboard-table th:nth-child(4),
    .dashboard-table td:nth-child(4) {
        width: 120px;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .dashboard-table th:nth-child(5),
    .dashboard-table td:nth-child(5) {
        width: auto;
    }

    .dashboard-table td {
        vertical-align: top;
    }
/* История согласования выдачи */
.delivery-events-table {
    table-layout: fixed;
    width: 100%;
}

    .delivery-events-table th,
    .delivery-events-table td {
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
        vertical-align: top;
    }

        .delivery-events-table th:nth-child(1),
        .delivery-events-table td:nth-child(1) {
            width: 180px;
        }

        .delivery-events-table th:nth-child(2),
        .delivery-events-table td:nth-child(2) {
            width: 180px;
        }

        .delivery-events-table th:nth-child(3),
        .delivery-events-table td:nth-child(3) {
            width: 290px;
        }

        .delivery-events-table th:nth-child(4),
        .delivery-events-table td:nth-child(4) {
            width: auto;
        }
.hidden {
    display: none !important;
}
.compact-create-button {
    width: auto;
    min-height: 40px;
    padding: 8px 14px;
    font-size: 14px;
    white-space: nowrap;
}

.section-header-row h2 {
    margin: 0;
}

@media (max-width: 700px) {
    .section-header-row {
        align-items: stretch;
        flex-direction: column;
    }

    .compact-create-button {
        width: 100%;
    }
}
/* ========================================================= */
/* Deliveries planning calendar                              */
/* ========================================================= */

.deliveries-calendar-card {
    margin-bottom: 22px;
}

.calendar-range-note {
    color: #64748b;
    font-size: 14px;
    font-weight: 700;
}

.deliveries-calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}

.calendar-day {
    min-height: 135px;
    padding: 8px;
    border: 1px solid #dfe7f3;
    border-radius: 12px;
    background: #ffffff;
    overflow: hidden;
}

    .calendar-day.is-weekend {
        background: #f8fafc;
    }

    .calendar-day.is-past {
        background: #eef2f6;
        opacity: 0.68;
    }

    .calendar-day.is-today {
        border: 2px solid #d92d20;
        box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.12);
        opacity: 1;
    }

    .calendar-day.has-deliveries {
        background: #fff9d7;
    }

    .calendar-day.is-past.has-deliveries {
        background: #eceff3;
    }

    .calendar-day.is-today.has-deliveries {
        background: #fff3f0;
    }

.calendar-day-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid #edf2f8;
}

.calendar-day-week {
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
}

.calendar-day-date {
    color: #172033;
    font-size: 14px;
    font-weight: 900;
}

.calendar-day-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calendar-empty {
    color: #c0cad8;
    font-size: 13px;
    font-weight: 700;
}

.calendar-delivery {
    display: block;
    padding: 5px 6px;
    border: 1px solid #d7e0ef;
    border-radius: 7px;
    background: #ffffff;
    color: #172033;
    text-decoration: none;
}

    .calendar-delivery:hover {
        border-color: #2f80ed;
        background: #eef4ff;
    }

.calendar-delivery-project {
    display: block;
    margin-bottom: 2px;
    color: #344054;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-delivery-title {
    display: block;
    color: #172033;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.15;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.calendar-more {
    margin-top: 2px;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
}

@media (max-width: 1200px) {
    .deliveries-calendar {
        grid-template-columns: repeat(7, minmax(120px, 1fr));
        overflow-x: auto;
    }
}

@media (max-width: 700px) {
    .deliveries-calendar {
        grid-template-columns: repeat(7, minmax(115px, 1fr));
    }

    .calendar-day {
        min-height: 120px;
    }
}
/* ========================================================= */
/* Unified delivery visual states                            */
/* ========================================================= */

.delivery-state-sent {
    background: #dff7e6 !important;
}

.delivery-state-overdue {
    background: #ffb3b3 !important;
}

.delivery-state-today {
    background: #ffe3b3 !important;
}

.delivery-state-soon {
    background: #fff7c2 !important;
}

    .delivery-state-sent td,
    .delivery-state-overdue td,
    .delivery-state-today td,
    .delivery-state-soon td {
        background: transparent !important;
    }

/* Calendar delivery cards */

.calendar-delivery-sent {
    border-color: #8fd6a3;
    background: #dff7e6;
}

.calendar-delivery-overdue {
    border-color: #ff5c5c;
    background: #ffb3b3;
}

.calendar-delivery-today {
    border-color: #ffb020;
    background: #ffe3b3;
}

.calendar-delivery-soon {
    border-color: #ead94c;
    background: #fff7c2;
}

.calendar-day.has-deliveries {
    background: #ffffff;
}

.calendar-day.is-past.has-deliveries {
    background: #eef2f6;
}

.calendar-day.is-today.has-deliveries {
    background: #ffffff;
}
.delivery-state-overdue {
    background: #ff9f9f !important;
}

    .delivery-state-overdue td {
        background: transparent !important;
    }
/* ========================================================= */
/* Customer response required state                          */
/* ========================================================= */

.delivery-state-customer-response-required {
    background: #eadcff !important;
}

    .delivery-state-customer-response-required td {
        background: transparent !important;
    }

.calendar-delivery-customer-response-required {
    border-color: #9b6df3;
    background: #eadcff;
}
/* ========================================================= */
/* Cancelled / not accepted delivery state                   */
/* ========================================================= */

.delivery-state-cancelled {
    background: #e5e7eb !important;
    color: #4b5563;
}

    .delivery-state-cancelled td {
        background: transparent !important;
    }

    .delivery-state-cancelled a {
        color: #374151;
    }

.calendar-delivery-cancelled {
    border-color: #cbd5e1;
    background: #e5e7eb;
    color: #4b5563;
}

    .calendar-delivery-cancelled .calendar-delivery-project,
    .calendar-delivery-cancelled .calendar-delivery-title {
        color: #4b5563;
    }
/* ========================================================= */
/* Closed delivery state                                     */
/* ========================================================= */

.delivery-state-closed {
    background: #dbeafe !important;
    color: #1e3a8a;
}

    .delivery-state-closed td {
        background: transparent !important;
    }

    .delivery-state-closed a {
        color: #1e40af;
    }

.calendar-delivery-closed {
    border-color: #93c5fd;
    background: #dbeafe;
    color: #1e3a8a;
}

    .calendar-delivery-closed .calendar-delivery-project,
    .calendar-delivery-closed .calendar-delivery-title {
        color: #1e3a8a;
    }
.checkbox-field label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    margin: 0;
    color: #172033;
    font-size: 15px;
    font-weight: 800;
}

.checkbox-field input[type="checkbox"] {
    width: 18px;
    height: 18px;
}
/* ========================================================= */
/* Compact delivery create form                              */
/* ========================================================= */

.compact-delivery-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.delivery-form-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1.4fr) minmax(180px, 0.55fr) minmax(190px, 0.65fr);
    gap: 12px 14px;
    align-items: start;
}

    .delivery-form-grid .form-field {
        min-width: 0;
    }

.delivery-title-field {
    grid-column: span 1;
}

.delivery-comment-field {
    grid-column: span 2;
}

.compact-checkbox-field {
    display: flex;
    align-items: end;
    min-height: 73px;
}

    .compact-checkbox-field label {
        display: flex;
        align-items: center;
        gap: 10px;
        min-height: 46px;
        margin: 0;
        padding: 0 12px;
        border: 1px solid #d5deec;
        border-radius: 10px;
        background: #ffffff;
        color: #172033;
        font-size: 15px;
        font-weight: 800;
    }

    .compact-checkbox-field input[type="checkbox"] {
        width: 18px;
        height: 18px;
    }

.compact-delivery-form textarea {
    min-height: 46px;
    height: 46px;
    resize: vertical;
}

.compact-form-note {
    color: #64748b;
    font-size: 13px;
    line-height: 1.35;
}

.compact-form-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
}

    .compact-form-actions .primary-button {
        width: 100%;
    }

    .compact-form-actions .secondary-link-button {
        min-width: 130px;
    }

@media (max-width: 1000px) {
    .delivery-form-grid {
        grid-template-columns: 1fr 1fr;
    }

    .delivery-comment-field {
        grid-column: span 2;
    }

    .compact-checkbox-field {
        min-height: auto;
    }
}

@media (max-width: 700px) {
    .delivery-form-grid {
        grid-template-columns: 1fr;
    }

    .delivery-comment-field {
        grid-column: span 1;
    }

    .compact-form-actions {
        grid-template-columns: 1fr;
    }

        .compact-form-actions .secondary-link-button {
            width: 100%;
        }
}
/* ========================================================= */
/* Compact delivery create form                              */
/* ========================================================= */

.compact-delivery-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.delivery-form-grid {
    display: grid;
    grid-template-columns: 1.4fr 0.55fr 0.65fr;
    gap: 12px 14px;
    align-items: start;
}

    .delivery-form-grid .form-field {
        min-width: 0;
    }

/* Наименование шире */
.delivery-title-field {
    grid-column: span 1;
}

/* Ответственный и проверяющий одинаковой ширины */
.delivery-user-field {
    grid-column: span 1;
}

/* Проверка ГК занимает всю оставшуюся ширину справа */
.compact-checkbox-field {
    grid-column: span 1;
    display: flex;
    align-items: end;
    min-height: 73px;
}

    .compact-checkbox-field label {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        min-height: 46px;
        margin: 0;
        padding: 0 14px;
        border: 1px solid #d5deec;
        border-radius: 10px;
        background: #ffffff;
        color: #172033;
        font-size: 15px;
        font-weight: 400;
    }

    .compact-checkbox-field input[type="checkbox"] {
        width: 18px;
        height: 18px;
        flex: 0 0 auto;
    }

/* Адресаты на одну колонку */
.delivery-recipients-field {
    grid-column: span 1;
}

/* Комментарий значительно шире */
.delivery-comment-field {
    grid-column: span 2;
}

.compact-delivery-form textarea {
    min-height: 110px;
    height: 110px;
    resize: vertical;
}

.compact-form-note {
    color: #64748b;
    font-size: 13px;
    line-height: 1.35;
}

.compact-form-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: 12px;
    align-items: center;
}

    .compact-form-actions .primary-button {
        width: 100%;
    }

    .compact-form-actions .secondary-link-button {
        width: 100%;
    }

/* Чтобы селекты ФИО не выглядели разной ширины внутри ячеек */
.delivery-user-field select,
.delivery-user-field input {
    width: 100%;
}

@media (max-width: 1000px) {
    .delivery-form-grid {
        grid-template-columns: 1fr 1fr;
    }

    .delivery-comment-field {
        grid-column: span 2;
    }

    .compact-checkbox-field {
        min-height: auto;
    }
}

@media (max-width: 700px) {
    .delivery-form-grid {
        grid-template-columns: 1fr;
    }

    .delivery-comment-field,
    .delivery-recipients-field,
    .delivery-user-field,
    .compact-checkbox-field {
        grid-column: span 1;
    }

    .compact-form-actions {
        grid-template-columns: 1fr;
    }
}
.delivery-type-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
}

.delivery-type-official {
    background: #eaf3ff;
    color: #1e40af;
}

.delivery-type-unofficial {
    background: #f3e8ff;
    color: #6b21a8;
}