:root {
    --b24-bg: #eef2f4;
    --b24-surface: #ffffff;
    --b24-border: #dfe5e8;
    --b24-text: #333333;
    --b24-muted: #828b95;
    --b24-blue: #2fc6f6;
    --b24-blue-dark: #11a9d9;
    --b24-green: #bbed21;
    --b24-green-dark: #a3d10f;
    --b24-danger: #ff5752;
    --b24-radius: 6px;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--b24-bg);
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 72px 0 24px;
    color: var(--b24-text);
    background: var(--b24-bg);
    font-family: "Open Sans", Arial, sans-serif;
    font-size: 14px;
    letter-spacing: 0;
}

a {
    color: #168bb8;
}

h1,
h2,
h3,
h4 {
    color: #2f3438;
    font-weight: 400;
    letter-spacing: 0;
}

h1 {
    font-size: 26px;
}

h3 {
    margin: 20px 0;
    font-size: 22px;
}

.app-header {
    position: fixed;
    z-index: 100;
    top: 0;
    left: 0;
    display: flex;
    width: 100%;
    min-height: 58px;
    align-items: center;
    gap: 22px;
    padding: 0 18px;
    border-bottom: 1px solid #e4e8eb;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.app-brand {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 9px;
    color: #31373d;
    font-size: 17px;
    font-weight: 600;
    text-decoration: none;
}

.app-brand:hover {
    color: #31373d;
}

.app-brand-mark,
.bitrix-login-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: var(--b24-blue);
    font-weight: 700;
}

.app-brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 14px;
}

.header-nav {
    display: flex;
    min-width: 0;
    align-self: stretch;
    align-items: stretch;
    gap: 2px;
}

.header-link {
    display: inline-flex;
    align-items: center;
    padding: 0 13px;
    border-bottom: 3px solid transparent;
    color: #5d6770;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.header-link:hover,
.header-link.is-active {
    color: #169bc7;
    background: #f6fbfd;
    border-bottom-color: var(--b24-blue);
}

.header-user {
    display: flex;
    min-width: 0;
    margin-left: auto;
    align-items: center;
    gap: 9px;
    white-space: nowrap;
}

.header-user-avatar {
    display: inline-flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #ffffff;
    background: #6ac8e8;
    font-weight: 700;
}

.header-user-name {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-logout {
    padding: 7px 10px;
    border-radius: 4px;
    color: var(--b24-muted);
    text-decoration: none;
}

.header-logout:hover {
    color: #555f68;
    background: #eef2f4;
}

.btn {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    border: 0;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    text-transform: uppercase;
    cursor: pointer;
}

.btn-primary,
.btn-success {
    color: #ffffff;
    background: var(--b24-blue);
}

.btn-primary:hover,
.btn-success:hover {
    color: #ffffff;
    background: var(--b24-blue-dark);
}

.btn-outline-secondary {
    color: #5d6770;
    background: #ffffff;
    box-shadow: inset 0 0 0 1px #c6cdd2;
}

.form-control,
.form-select {
    min-height: 39px;
    border: 1px solid #c6cdd2;
    border-radius: 2px;
    background-color: #ffffff;
    box-shadow: none;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--b24-blue);
    box-shadow: 0 0 0 1px var(--b24-blue);
}

.container {
    width: min(1180px, calc(100% - 32px));
    margin-right: auto;
    margin-left: auto;
}

.card,
.company-list-item,
.table {
    border: 1px solid var(--b24-border);
    border-radius: var(--b24-radius);
    background: var(--b24-surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.card-body {
    padding: 24px;
}

.table {
    overflow: hidden;
}

.table > :not(caption) > * > * {
    padding: 11px 12px;
    border-color: #edf0f2;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background: #f8fafb;
}

.calendar {
    max-width: 1920px;
    margin: 16px auto;
    overflow-x: auto;
    border: 1px solid var(--b24-border);
    border-radius: var(--b24-radius);
    background: var(--b24-surface);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.calendar table {
    width: 100%;
    border-collapse: collapse;
}

.calendar td,
.calendar th {
    min-width: 28px;
    height: 30px;
    padding: 5px;
    border: 1px solid #e8ecee;
    text-align: center;
    font-size: 12px;
}

.calendar td:first-child {
    min-width: 205px;
    position: sticky;
    left: 0;
    z-index: 2;
    background: inherit;
    text-align: left;
}

.even {
    background: #ffffff;
}

.odd {
    background: #f7f9fa;
}

.calendar .today {
    outline: 2px solid var(--b24-blue);
    outline-offset: -2px;
    font-weight: 700;
}

.calendar .non-working-day {
    color: #222222;
    background: #ffd9de;
}

.calendar .holiday {
    color: #d21f2b;
    background: #ffd9de;
    font-weight: 700;
}

.production-calendar-page .calendar .non-working-day {
    color: #222222;
    background: #ffd9de;
    font-weight: 400;
}

.production-calendar-page .calendar .holiday {
    color: #d21f2b;
    background: #ffd9de;
    font-weight: 700;
}

.production-calendar-page .calendar-day {
    cursor: pointer;
}

.calendar .day {
    cursor: pointer;
}

.calendar .read-only-day {
    cursor: default;
}

.calendar .day.vacation {
    background: #d9f2a6;
}

.calendar .day.orange-day {
    background: #ffd98a;
}

.calendar .day.birthday {
    font-size: 16px;
    line-height: 1;
}

.birthday-cake {
    display: inline-block;
    line-height: 1;
}

.calendar .day.holiday-vacation {
    background: #fff19b;
}

.calendar .company-row td {
    position: static;
    padding-left: 12px;
    color: #467383;
    background: #e7f6fb;
    font-weight: 700;
    text-align: left;
}

.calendar tr.current-user-row td {
    border-top: 2px solid #22b9e8;
    border-bottom: 2px solid #22b9e8;
    font-weight: 700;
}

.calendar tr.current-user-row td:first-child {
    border-left: 2px solid #22b9e8;
}

.calendar tr.current-user-row td:last-child {
    border-right: 2px solid #22b9e8;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin: 12px 0;
    padding: 0;
    list-style: none;
}

.pagination li {
    margin: 0;
}

.pagination a,
.pagination span {
    display: block;
    padding: 8px 12px;
    border: 1px solid var(--b24-border);
    border-radius: 3px;
    color: #59636c;
    background: #ffffff;
    text-decoration: none;
}

.pagination a:hover {
    color: #168bb8;
    border-color: #9dddf1;
}

.pagination .current-page {
    color: #ffffff;
    border-color: var(--b24-blue);
    background: var(--b24-blue);
}

.company-list-page {
    max-width: 1060px;
    margin: 28px auto;
    padding: 0 16px;
}

.company-list-page h3 {
    text-align: left;
}

.company-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.company-list-item {
    display: flex;
    min-height: 76px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    color: #31373d;
    text-decoration: none;
}

.company-list-item:hover {
    border-color: #9dddf1;
    box-shadow: 0 3px 8px rgba(47, 198, 246, 0.12);
}

.company-list-item span {
    font-weight: 600;
}

.company-list-item small {
    color: var(--b24-muted);
    white-space: nowrap;
}

.company-back {
    max-width: 1920px;
    margin: 16px auto 0;
    padding: 0 12px;
}

.calendar-main > h3 {
    text-align: center;
}

.calendar-main > .calendar {
    max-width: 1180px;
    padding: 16px;
}

.calendar-main .calendar-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.calendar-main .calendar-month {
    min-width: 0;
}

.calendar-main .calendar-month h3 {
    margin: 6px 0 10px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

.calendar-main .calendar-month td:first-child {
    position: static;
    min-width: 0;
    text-align: center;
}

.bitrix-login-page {
    display: grid;
    min-height: 100vh;
    padding: 24px;
    place-items: center;
}

.bitrix-login {
    width: min(430px, 100%);
    padding: 34px;
    border: 1px solid var(--b24-border);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 8px 30px rgba(31, 61, 72, 0.1);
    text-align: center;
}

.bitrix-login-mark {
    width: 54px;
    height: 54px;
    margin: 0 auto 16px;
    border-radius: 50%;
    font-size: 21px;
}

.bitrix-login h1 {
    margin: 0 0 10px;
}

.bitrix-login p,
.bitrix-login small {
    color: var(--b24-muted);
}

.bitrix-login .btn {
    margin: 10px 0 18px;
}

.bitrix-login small {
    display: block;
    line-height: 1.5;
}

.ui-alert,
.alert {
    margin: 14px 0;
    padding: 12px 14px;
    border-radius: 4px;
}

.ui-alert-danger,
.alert-danger {
    color: #a42d29;
    background: #ffefee;
}

@media (max-width: 980px) {
    body {
        padding-top: 112px;
    }

    .app-header {
        min-height: 98px;
        flex-wrap: wrap;
        align-content: center;
        gap: 4px 14px;
        padding: 8px 12px;
    }

    .header-nav {
        order: 3;
        width: 100%;
        height: 38px;
        overflow-x: auto;
    }

    .header-link {
        padding: 0 10px;
    }

    .header-user-name {
        display: none;
    }

    .calendar-main .calendar-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .app-brand > span:last-child,
    .header-user-avatar {
        display: none;
    }

    .calendar-main .calendar-row {
        grid-template-columns: 1fr;
    }

    .pagination a,
    .pagination span {
        padding: 7px;
        font-size: 12px;
    }
}
