* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;

    background: #f6f7f9;
    color: #17181c;

    font-family: Arial, Helvetica, sans-serif;
}

main {
    width: calc(100% - 40px);
    max-width: 1400px;
    margin: 0 auto;
    padding: 38px 0 60px;
}


/* --------------------------------------------------
   Заголовок
-------------------------------------------------- */

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;

    margin-bottom: 32px;
}

.page-header h1,
.form-page-header h1 {
    margin: 0 0 7px;

    font-size: 32px;
    line-height: 1.15;
    font-weight: 700;
}

.page-subtitle {
    margin: 0;

    color: #777b84;

    font-size: 14px;
    line-height: 1.45;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;

    flex-shrink: 0;
}


/* --------------------------------------------------
   Основные кнопки
-------------------------------------------------- */

.create-button,
.save-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 42px;
    padding: 0 18px;

    border: 1px solid #ed1764;
    border-radius: 10px;

    background: #ed1764;
    color: #ffffff;

    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;

    text-decoration: none;
    cursor: pointer;

    transition: 0.2s ease;
}

.create-button:hover,
.save-button:hover {
    background: #d91359;
    border-color: #d91359;
}


/* --------------------------------------------------
   Кнопка выхода
-------------------------------------------------- */

.logout-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 42px;
    padding: 0 18px;

    border: 1px solid #d5d9e0;
    border-radius: 10px;

    background: #ffffff;
    color: #4e535c;

    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;

    text-decoration: none;
    cursor: pointer;

    transition: 0.2s ease;
}

.logout-button:hover {
    background: #f0f1f3;
    border-color: #c9cdd5;
    color: #25272c;
}


/* --------------------------------------------------
   Поиск и фильтры
-------------------------------------------------- */

.toolbar {
    margin-bottom: 18px;
}

.search-block {
    width: 460px;
    max-width: 100%;

    margin-bottom: 16px;
}

.search-block label {
    display: block;

    margin-bottom: 7px;

    font-size: 13px;
    font-weight: 600;
    color: #4d5159;
}

.search-block input {
    width: 100%;
    height: 42px;

    padding: 0 14px;

    border: 1px solid #d5d9e0;
    border-radius: 10px;

    background: #ffffff;
    color: #17181c;

    font-family: inherit;
    font-size: 14px;

    outline: none;
}

.search-block input:focus {
    border-color: #ed1764;
}

.search-block input::placeholder {
    color: #a2a6ae;
}

.status-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-button {
    min-height: 36px;
    padding: 0 15px;

    border: 1px solid #d5d9e0;
    border-radius: 9px;

    background: #ffffff;
    color: #41454d;

    font-family: inherit;
    font-size: 13px;
    font-weight: 600;

    cursor: pointer;
}

.filter-button:hover {
    background: #f2f3f5;
}

.filter-button.active {
    border-color: #ed1764;

    background: #fff1f6;
    color: #ed1764;
}


/* --------------------------------------------------
   Таблица
-------------------------------------------------- */

.table-wrapper {
    overflow: hidden;

    border: 1px solid #e0e3e8;
    border-radius: 13px;

    background: #ffffff;

    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

table {
    width: 100%;

    border-collapse: collapse;
}

thead {
    background: #f1f2f4;
}

th {
    padding: 12px 14px;

    text-align: left;

    color: #555a63;

    font-size: 12px;
    font-weight: 700;
}

td {
    padding: 14px;

    border-top: 1px solid #e5e7eb;

    vertical-align: middle;

    font-size: 13px;
}

.event-cell strong,
.venue-cell strong {
    display: block;

    margin-bottom: 4px;

    font-size: 14px;
    color: #17181c;
}

.event-cell span,
.venue-cell span {
    display: block;

    color: #7a7f88;

    font-size: 12px;
    line-height: 1.35;
}

.date-cell,
.time-cell {
    white-space: nowrap;
}


/* --------------------------------------------------
   Статусы
-------------------------------------------------- */

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 6px 10px;

    border-radius: 999px;

    font-size: 11px;
    font-weight: 700;

    white-space: nowrap;
}

.status-active {
    background: #e7f6ec;
    color: #188747;
}

.status-expired {
    background: #eceef1;
    color: #666b74;
}

.status-disabled {
    background: #fdebec;
    color: #c63a43;
}


/* --------------------------------------------------
   Действия в таблице
-------------------------------------------------- */

.actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

.actions form {
    margin: 0;
}

.action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 33px;
    padding: 0 11px;

    border: 1px solid #d6dae1;
    border-radius: 7px;

    background: #ffffff;
    color: #343840;

    font-family: inherit;
    font-size: 12px;
    font-weight: 600;

    text-decoration: none;
    white-space: nowrap;

    cursor: pointer;
}

.action-button:hover {
    background: #f2f3f5;
}

.action-danger {
    color: #c5323c;
}

.action-enable {
    color: #188747;
}


/* --------------------------------------------------
   Пустой результат
-------------------------------------------------- */

.empty-message {
    margin-top: 20px;
    padding: 30px;

    border: 1px solid #e0e3e8;
    border-radius: 12px;

    background: #ffffff;

    text-align: center;

    color: #777b84;
    font-size: 14px;
}


/* --------------------------------------------------
   Форма создания / редактирования
-------------------------------------------------- */

.form-page {
    max-width: 1000px;
}

.form-page-header {
    margin-bottom: 24px;
}

.back-link {
    display: inline-block;

    margin-bottom: 18px;

    color: #676c75;

    font-size: 13px;
    font-weight: 600;

    text-decoration: none;
}

.back-link:hover {
    color: #ed1764;
}

.form-card {
    padding: 30px;

    border: 1px solid #e0e3e8;
    border-radius: 14px;

    background: #ffffff;

    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.form-section {
    padding-bottom: 27px;
    margin-bottom: 27px;

    border-bottom: 1px solid #e7e9ed;
}

.form-section:last-of-type {
    margin-bottom: 0;
}

.form-section h2 {
    margin: 0 0 18px;

    font-size: 17px;
    font-weight: 700;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.form-grid-three {
    grid-template-columns: 1.4fr 1fr 1fr;
}

.form-field {
    display: flex;
    flex-direction: column;
}

.form-field label {
    margin-bottom: 7px;

    color: #3f434a;

    font-size: 13px;
    font-weight: 600;
}

.form-field input {
    width: 100%;
    height: 44px;

    padding: 0 13px;

    border: 1px solid #d5d9e0;
    border-radius: 9px;

    background: #ffffff;
    color: #17181c;

    font-family: inherit;
    font-size: 14px;

    outline: none;
}

.form-field input:focus {
    border-color: #ed1764;
}

.field-hint {
    margin-top: 6px;

    color: #8b8f97;

    font-size: 11px;
    line-height: 1.4;
}

.form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;

    padding-top: 4px;
}

.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 42px;
    padding: 0 18px;

    border: 1px solid #d5d9e0;
    border-radius: 10px;

    background: #ffffff;
    color: #464b53;

    font-size: 14px;
    font-weight: 600;

    text-decoration: none;
}

.secondary-button:hover {
    background: #f2f3f5;
}


/* --------------------------------------------------
   Страница входа
-------------------------------------------------- */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;

    min-height: 100vh;
    max-width: none;

    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 420px;

    padding: 32px;

    border: 1px solid #e0e3e8;
    border-radius: 16px;

    background: #ffffff;

    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}

.login-header {
    margin-bottom: 26px;
}

.login-header h1 {
    margin: 0 0 8px;

    font-size: 26px;
}

.login-header p {
    margin: 0;

    color: #777b84;

    font-size: 13px;
    line-height: 1.45;
}

.login-card .form-field {
    margin-bottom: 18px;
}

.login-button {
    width: 100%;

    margin-top: 4px;
}

.login-error {
    margin-bottom: 20px;
    padding: 11px 13px;

    border: 1px solid #f1c8cc;
    border-radius: 9px;

    background: #fff2f3;
    color: #bd303a;

    font-size: 13px;
}


/* --------------------------------------------------
   Средние экраны
-------------------------------------------------- */

@media (max-width: 1050px) {

    .table-wrapper {
        overflow-x: auto;
    }

    table {
        min-width: 950px;
    }

}


/* --------------------------------------------------
   Мобильная версия
-------------------------------------------------- */

@media (max-width: 600px) {

    main {
        width: calc(100% - 24px);
        padding: 24px 0 40px;
    }


    /* Шапка */

    .page-header {
        display: block;

        margin-bottom: 24px;
    }

    .page-header h1,
    .form-page-header h1 {
        font-size: 27px;
    }

    .page-subtitle {
        font-size: 13px;
    }

    .header-actions {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 8px;

        width: 100%;
        margin-top: 18px;
    }

    .header-actions .create-button {
        width: 100%;
    }

    .logout-button {
        min-width: 82px;
        padding: 0 14px;
    }


    /* Поиск */

    .search-block {
        width: 100%;
    }

    .status-filters {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 7px;
    }

    .filter-button {
        width: 100%;
    }


    /* Таблица превращается в карточки */

    .table-wrapper {
        overflow: visible;

        border: 0;
        border-radius: 0;

        background: transparent;
        box-shadow: none;
    }

    table,
    tbody {
        display: block;

        width: 100%;
        min-width: 0;
    }

    thead {
        display: none;
    }

    .invite-row {
        display: grid;

        grid-template-columns: 1fr auto;

        width: 100%;

        margin-bottom: 12px;
        padding: 16px;

        border: 1px solid #e0e3e8;
        border-radius: 13px;

        background: #ffffff;

        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    }

    .invite-row td {
        display: block;

        padding: 0;

        border: 0;
    }

    .invite-row .event-cell {
        grid-column: 1;
        grid-row: 1;

        padding-right: 10px;
    }

    .invite-row td:nth-child(5) {
        grid-column: 2;
        grid-row: 1;

        text-align: right;
    }

    .invite-row .date-cell {
        grid-column: 1 / -1;

        margin-top: 16px;

        font-size: 13px;
        font-weight: 700;
    }

    .invite-row .time-cell {
        grid-column: 1 / -1;

        margin-top: 5px;

        font-size: 13px;
    }

    .invite-row .time-cell::before {
        content: "Начало: ";

        color: #777b84;
        font-weight: 400;
    }

    .invite-row .venue-cell {
        grid-column: 1 / -1;

        margin-top: 14px;
        padding-top: 14px;

        border-top: 1px solid #e6e8ec;
    }

    .invite-row td:last-child {
        grid-column: 1 / -1;

        margin-top: 17px;
    }

    .actions {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 7px;

        width: 100%;
    }

    .actions form {
        width: 100%;
    }

    .action-button {
        width: 100%;
        min-height: 38px;
    }


    /* Форма */

    .form-page {
        width: calc(100% - 24px);
    }

    .form-card {
        padding: 20px 16px;
    }

    .form-grid,
    .form-grid-three {
        grid-template-columns: 1fr;
        gap: 17px;
    }

    .form-section {
        padding-bottom: 23px;
        margin-bottom: 23px;
    }

    .form-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .form-actions .save-button,
    .form-actions .secondary-button {
        width: 100%;
    }


    /* Вход */

    .login-page {
        width: 100%;
        padding: 16px;
    }

    .login-card {
        padding: 25px 20px;
    }

}


/* --------------------------------------------------
   Очень узкие экраны
-------------------------------------------------- */

@media (max-width: 360px) {

    .header-actions {
        grid-template-columns: 1fr;
    }

    .logout-button {
        width: 100%;
    }

    .actions {
        grid-template-columns: 1fr;
    }

}