:root {
    --primary: #126b35;
    --primary-dark: #0b4e26;
    --text: #1f2933;
    --muted: #697786;
    --border: #dce3e8;
    --background: #f4f7f5;
    --danger: #b42318;
    --white: #ffffff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

a {
    color: var(--primary);
}

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

.narrow {
    width: min(550px, calc(100% - 32px));
    margin-top: 50px;
}

.site-header {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.header-inner {
    display: flex;
    min-height: 66px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    color: #ffffff;
    font-size: 21px;
    font-weight: 700;
    text-decoration: none;
}

.navigation {
    display: flex;
    align-items: center;
    gap: 15px;
}

.navigation a {
    color: #ffffff;
    text-decoration: none;
}

.user-name {
    opacity: 0.85;
    font-size: 14px;
}

main.container {
    min-height: calc(100vh - 145px);
    padding-top: 35px;
    padding-bottom: 35px;
}

.site-footer {
    padding: 20px 0;
    background: #17231b;
    color: #d8e1db;
}

.card {
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--white);
    box-shadow: 0 4px 16px rgba(20, 40, 28, 0.06);
}

.narrow-card {
    max-width: 480px;
    margin: 0 auto;
}

.page-heading,
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.page-heading h1,
.admin-header h1,
.card h1,
.card h2 {
    margin-top: 0;
}

.page-heading p,
.admin-header p {
    margin-bottom: 0;
    color: var(--muted);
}

label {
    display: block;
    margin-bottom: 16px;
    font-weight: 700;
}

input,
textarea,
select {
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid #b8c4cc;
    border-radius: 5px;
    background: #ffffff;
    color: var(--text);
    font: inherit;
    font-weight: 400;
}

textarea {
    resize: vertical;
}

.button {
    display: inline-block;
    padding: 10px 16px;
    border: 0;
    border-radius: 5px;
    background: var(--primary);
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
}

.button:hover {
    background: var(--primary-dark);
}

.button-secondary {
    background: #e8eeea;
    color: #183423;
}

.button-secondary:hover {
    background: #d7e3da;
}

.button-danger {
    background: var(--danger);
}

.button-danger:hover {
    background: #8d1c13;
}

.alert {
    margin-bottom: 20px;
    padding: 13px 15px;
    border-radius: 5px;
}

.alert-success {
    border: 1px solid #9bd0ac;
    background: #e7f6eb;
    color: #165c29;
}

.alert-error {
    border: 1px solid #efb5ae;
    background: #fff0ef;
    color: #8d1c13;
}

.calendar {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(20, 40, 28, 0.06);
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background: var(--primary);
    color: #ffffff;
}

.calendar-header h2 {
    margin: 0;
    font-size: 23px;
}

.calendar-nav {
    border: 0;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
    font-size: 28px;
}

.calendar-weekdays,
.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-weekdays {
    border-bottom: 1px solid var(--border);
    background: #edf2ee;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
}

.calendar-weekdays div {
    padding: 11px 4px;
}

.calendar-day {
    min-height: 125px;
    padding: 7px;
    border-right: 1px solid #edf0f1;
    border-bottom: 1px solid #edf0f1;
}

.calendar-day:nth-child(7n) {
    border-right: 0;
}

.calendar-day.empty {
    background: #fafcfa;
}

.calendar-day-number {
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
}

.calendar-day.today .calendar-day-number {
    background: var(--primary);
    color: #ffffff;
}

.calendar-event {
    display: block;
    width: 100%;
    overflow: hidden;
    margin: 3px 0;
    padding: 5px 6px;
    border: 0;
    border-left: 4px solid var(--primary);
    border-radius: 3px;
    background: #e8f4eb;
    color: #1a3d25;
    cursor: pointer;
    font-size: 12px;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-event:hover {
    filter: brightness(0.95);
}

.event-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.event-modal.open {
    display: flex;
}

.event-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.58);
}

.event-modal-content {
    position: relative;
    z-index: 1;
    width: min(540px, 100%);
    max-height: 85vh;
    overflow-y: auto;
    padding: 30px;
    border-radius: 10px;
    background: #ffffff;
}

.event-modal-content h2 {
    margin-top: 10px;
}

.modal-close {
    position: absolute;
    top: 9px;
    right: 14px;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 31px;
}

.event-meta {
    color: #46545f;
}

.event-description {
    margin: 25px 0;
}

.event-image {
    width: 100%;
    max-height: 450px;
    margin-bottom: 20px;
    border-radius: 7px;
    object-fit: cover;
}

.badge {
    display: inline-block;
    margin-bottom: 12px;
    padding: 4px 9px;
    border-radius: 4px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 25px;
}

.dashboard-card {
    display: flex;
    min-height: 140px;
    flex-direction: column;
    justify-content: center;
    padding: 20px;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(20, 40, 28, 0.06);
    color: var(--text);
    text-decoration: none;
}

.dashboard-card strong {
    color: var(--primary);
    font-size: 37px;
}

.dashboard-card span {
    color: var(--muted);
}

.admin-menu {
    margin-top: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 20px;
}

.full-width {
    grid-column: 1 / -1;
}

.form-actions {
    margin-top: 5px;
}

.delete-form {
    margin-top: 16px;
}

.two-columns {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
    gap: 22px;
    align-items: start;
}

.table-wrap {
    overflow-x: auto;
}

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

th,
td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

th {
    background: #f2f6f3;
}

.status {
    display: inline-block;
    padding: 3px 7px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
}

.status-published {
    background: #dff4e5;
    color: #126b35;
}

.status-draft {
    background: #edf0f2;
    color: #4d5b66;
}

.status-cancelled {
    background: #fde5e3;
    color: #b42318;
}

.color-dot {
    display: inline-block;
    width: 13px;
    height: 13px;
    margin-right: 6px;
    border-radius: 50%;
}

.recurrence-box {
    margin-top: 10px;
    padding: 20px;
    border: 1px solid #cfe0d4;
    border-radius: 8px;
    background: #f4faf5;
}

.recurrence-box h3 {
    margin-top: 0;
    color: var(--primary);
}

.weekday-selection {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin: 16px 0;
    padding: 14px;
    border: 1px solid #d7e3da;
    border-radius: 6px;
    background: #ffffff;
}

.weekday-selection legend {
    padding: 0 6px;
    font-weight: 700;
}

.weekday-selection label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-weight: 400;
}

.weekday-selection input[type="checkbox"] {
    width: auto;
    margin: 0;
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 760px) {
    .header-inner,
    .page-heading {
        align-items: flex-start;
        flex-direction: column;
        padding: 14px 0;
    }

    .navigation {
        flex-wrap: wrap;
    }

    .dashboard-grid,
    .two-columns,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .calendar-day {
        min-height: 84px;
        padding: 4px;
    }

    .calendar-weekdays div {
        padding: 9px 2px;
        font-size: 12px;
    }

    .calendar-event {
        padding: 4px;
        font-size: 10px;
    }

    .calendar-day-number {
        width: 23px;
        height: 23px;
        font-size: 12px;
    }
}
