* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    color: #222;
    background: #fff;
    line-height: 1.5;

    min-height: 100vh;

    display: flex;
    flex-direction: column;
}

button,
input,
textarea {
    font: inherit;
}

.login-container {
    flex: 1;

    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;

    padding: 32px;

    border: 1px solid #ccc;
    background: #fff;
}

.login-card h1 {
    margin: 0 0 8px;

    font-size: 24px;
    font-weight: 600;
}

.login-description {
    margin: 0 0 24px;

    color: #666;
}

.login-card form {
    display: flex;
    flex-direction: column;

    gap: 12px;
}

input,
textarea {
    width: 100%;

    padding: 9px 10px;

    border: 1px solid #aaa;
    border-radius: 2px;

    background: #fff;
    color: #222;

    outline: none;
}

input:focus,
textarea:focus {
    border-color: #333;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

input:disabled {
    background: #f2f2f2;
    color: #999;
}

button {
    padding: 9px 14px;

    border: 1px solid #999;
    border-radius: 2px;

    background: #fff;
    color: #222;

    cursor: pointer;
}

button:hover {
    background: #f2f2f2;
}

button:disabled {
    cursor: not-allowed;
    opacity: .6;
}

.primary-button {
    border-color: #333;

    background: #333;
    color: #fff;
}

.primary-button:hover {
    background: #222;
}

.delete-button {
    border-color: #b00020;

    color: #b00020;
}

.delete-button:hover {
    background: #fff0f0;
}

.cancel-button {
    background: #fff;
}

.button-group {
    display: inline-flex;

    border: 1px solid #999;
    border-radius: 2px;

    overflow: hidden;
}

.button-group form {
    display: contents;
}

.button-group button {
    border: none;
    border-radius: 0;

    background: #fff;
}

.button-group button + button,
.button-group form + button,
.button-group button + form button {
    border-left: 1px solid #999;
}

.button-group button:hover {
    background: #f2f2f2;
}

.button-group .primary-button {
    background: #333;
    color: #fff;
}

.button-group .primary-button:hover {
    background: #222;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;

    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;

    gap: 16px;

    padding: 18px 24px;

    background: #fff;
    border-bottom: 1px solid #ccc;
}

.app-header-titles h1 {
    margin: 0;

    font-size: 20px;
    font-weight: 600;
}

.app-header-titles p {
    margin: 2px 0 0;

    font-size: 14px;
    color: #666;
}

.app-header-status {
    display: flex;
    align-items: center;

    gap: 14px;
}

.live-clock {
    font-size: 14px;
    font-weight: 600;
    color: #333;

    white-space: nowrap;
}

.session-status {
    display: flex;
    align-items: center;

    gap: 8px;
}

.session-info {
    font-size: 13px;
    color: #666;

    white-space: nowrap;
}

.extend-button {
    border-color: #b8860b;

    color: #8a6400;
}

.extend-button:hover {
    background: #fff8e6;
}

.app-header-actions .primary-button {
    padding: 11px 20px;

    font-size: 15px;
    font-weight: 600;
}

.page-container {
    flex: 1;

    width: 100%;
}

.calendar-section {
    padding: 0;

    border-bottom: 1px solid #ccc;
}

.calendar-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;

    gap: 12px;

    padding: 16px 24px;
}

.calendar-nav {
    display: flex;
    align-items: center;

    gap: 12px;
}

.calendar-arrow-group {
    border-radius: 0;
}

.calendar-arrow-group button {
    min-width: 40px;

    font-size: 16px;
    line-height: 1;
}

.calendar-today-button {
    background: #fff;

    border-radius: 0;
}

.calendar-title {
    margin: 0;

    font-size: 20px;
    font-weight: 600;

    white-space: nowrap;
}

.calendar-view-toggle {
    margin-left: auto;
}

.view-toggle-button,
.vacation-type-button {
    background: #fff;
    color: #222;
}

.vacation-type-button {
    flex: 1;

    text-align: center;
}

.view-toggle-button.active,
.vacation-type-button.active {
    background: #333;
    color: #fff;
}

.view-toggle-button.active:hover,
.vacation-type-button.active:hover {
    background: #222;
}

.calendar-grid {
    font-size: 14px;
}

.calendar-grid.hidden {
    display: none !important;
}

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

    border-top: 1px solid #ccc;
    border-bottom: 1px solid #ccc;

    background: #f7f7f7;
}

.calendar-weekdays > div {
    padding: 8px 10px;

    font-weight: 600;
    text-align: center;
}

.calendar-weekday-sat {
    color: #2b5ea8;
}

.calendar-weekday-sun {
    color: #b00020;
}

.calendar-days {
    display: flex;
    flex-direction: column;
}

.calendar-week {
    position: relative;

    border-bottom: 1px solid #eee;
}

.calendar-week:last-child {
    border-bottom: none;
}

.calendar-week-bg {
    position: absolute;
    inset: 0;

    display: grid;
    grid-template-columns: repeat(7, 1fr);

    z-index: 0;
}

.calendar-day-bg {
    box-sizing: border-box;

    padding: 5px 6px;

    border-right: 1px solid #eee;
}

.calendar-day-bg:last-child {
    border-right: none;
}

.calendar-day-number {
    font-size: 13px;
    font-weight: 600;
}

.calendar-day-bg.other-month {
    background: #fafafa;
}

.calendar-day-bg.other-month .calendar-day-number {
    color: #bbb;
}

.calendar-day-bg.is-today {
    background: #fff7d6;
}

.calendar-day-bg.is-saturday .calendar-day-number {
    color: #2b5ea8;
}

.calendar-day-bg.is-sunday .calendar-day-number {
    color: #b00020;
}

.calendar-day-bg.other-month.is-saturday .calendar-day-number,
.calendar-day-bg.other-month.is-sunday .calendar-day-number {
    color: #ddd;
}

.calendar-week-bars {
    position: absolute;
    inset: 0;

    z-index: 1;

    pointer-events: none;
}

.calendar-event-bar {
    position: absolute;

    box-sizing: border-box;

    display: flex;
    align-items: center;

    padding: 0 6px;

    font-size: 12px;
    color: #fff;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    cursor: pointer;
    pointer-events: auto;
}

.calendar-event-bar:hover {
    opacity: .85;
}

@media (max-width: 700px) {

    .calendar-event-bar {
        font-size: 11px;
    }

}


.modal {
    position: fixed;

    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-background {
    position: absolute;

    inset: 0;

    background: rgba(0, 0, 0, 0.35);
}

.modal-card {
    position: relative;

    width: 100%;
    max-width: 500px;
    max-height: calc(100vh - 40px);

    padding: 24px;

    border: 1px solid #999;

    background: #fff;

    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;

    font-size: 20px;
    font-weight: 600;
}

.close-button {
    padding: 2px 8px;

    border: none;

    font-size: 24px;
    line-height: 1;

    background: transparent;
}

.close-button:hover {
    background: #f2f2f2;
}

#vacationForm {
    display: flex;
    flex-direction: column;

    gap: 16px;
}

#vacationForm label {
    display: flex;
    flex-direction: column;

    gap: 6px;

    font-weight: 500;
}

.field-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;

    gap: 8px;
}

.char-counter {
    font-weight: 400;
    font-size: 12px;
    color: #888;

    white-space: nowrap;
}

.date-row,
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 12px;
}

.period-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    margin-bottom: -4px;
}

.color-picker {
    display: flex;
    flex-direction: column;

    gap: 10px;
}

.color-swatches {
    display: flex;
    flex-wrap: wrap;

    gap: 8px;
}

.color-swatch {
    width: 30px;
    height: 30px;

    padding: 0;

    border: 2px solid transparent;
    border-radius: 4px;

    cursor: pointer;
}

.color-swatch:hover {
    opacity: .85;
}

.color-swatch.active {
    border-color: #222;
}

.color-swatch-auto {
    display: flex;
    align-items: center;
    justify-content: center;

    background: #fff;
    border: 1px dashed #999;

    font-size: 10px;
    color: #666;
}

.color-swatch-auto.active {
    border: 2px solid #222;
}

.color-custom-row {
    display: flex;
    align-items: center;

    gap: 8px;
}

.color-custom-row input {
    flex: 1;
}

.color-preview {
    width: 30px;
    height: 30px;

    flex: none;

    border: 1px solid #999;
    border-radius: 4px;
}

.color-preview.is-auto {
    border: 1px dashed #999;
}

.period-header-label {
    font-weight: 500;
}

#vacationForm label.indefinite-checkbox-label {
    display: flex;
    flex-direction: row;
    align-items: center;

    gap: 6px;

    font-weight: 400;
    font-size: 14px;
    color: #444;
}

.indefinite-checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;

    accent-color: #333;
}

.date-picker-input {
    cursor: pointer;
}

.modal-buttons {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-top: 8px;
}

.modal-buttons-right {
    display: flex;
}

.error-message {
    margin-bottom: 12px;

    padding: 10px;

    border: 1px solid #d00;

    background: #fff;

    color: #b00000;

    font-size: 14px;
}

.hidden {
    display: none !important;
}

.detail-content {
    display: flex;
    flex-direction: column;

    gap: 16px;
}

.detail-item {
    display: flex;
    flex-direction: column;

    gap: 4px;
}

.detail-item span {
    font-size: 13px;
    color: #666;
}

.detail-item strong {
    font-weight: 500;
}

.detail-item p {
    margin: 0;

    white-space: pre-wrap;
}

.indefinite-section {
    padding: 20px 24px;
}

.list-view.hidden {
    display: none !important;
}

.list-day-group + .list-day-group {
    border-top: 1px solid #eee;
}

.list-day-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    padding: 10px 24px;

    background: #f7f7f7;
    border-bottom: 1px solid #eee;

    font-weight: 600;
}

.list-day-heading-status {
    padding: 2px 8px;

    border: 1px solid #999;

    font-size: 12px;
    font-weight: 500;

    white-space: nowrap;
}

.list-day-heading-status.status-ended {
    border-color: #999;
    color: #888;
}

.list-day-heading-status.status-ongoing {
    border-color: #1a7f4b;
    color: #1a7f4b;
}

.list-day-heading-status.status-upcoming {
    border-color: #b8860b;
    color: #8a6400;
}

.list-event-row {
    display: flex;
    align-items: flex-start;

    gap: 10px;

    padding: 12px 24px;

    border-bottom: 1px solid #eee;

    cursor: pointer;
}

.list-event-row:hover {
    background: #f2f2f2;
}

.list-event-dot {
    flex: none;
    margin-top: 6px;

    width: 10px;
    height: 10px;

    border-radius: 50%;
}

.list-event-body {
    display: flex;
    flex-direction: column;

    gap: 2px;
}

.list-event-title {
    font-weight: 500;
}

.list-empty-message {
    padding: 24px;

    color: #666;
    font-size: 14px;
    text-align: center;
}

.indefinite-header h2 {
    margin: 0 0 12px;

    font-size: 16px;
    font-weight: 600;
}

.indefinite-list {
    list-style: none;

    margin: 0;
    padding: 0;

    display: flex;
    flex-direction: column;
}

.indefinite-list .empty-message {
    color: #666;
    font-size: 14px;

    padding: 10px 0;
}

.indefinite-item {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    padding: 10px 8px 10px 14px;

    border-bottom: 1px solid #eee;

    cursor: pointer;
}

.indefinite-item:last-child {
    border-bottom: none;
}

.indefinite-item:hover {
    background: #f2f2f2;
}

.indefinite-item .indefinite-item-main {
    display: flex;
    align-items: baseline;

    gap: 8px;
}

.indefinite-item .indefinite-item-reason {
    color: #666;
    font-size: 13px;
}

.indefinite-badge {
    padding: 2px 8px;

    border: 1px solid #333;
    border-radius: 2px;

    font-size: 12px;
    color: #333;

    white-space: nowrap;
}

.site-footer {
    width: 100%;

    padding: 14px 24px;

    background: #000;
    color: #ccc;

    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;

    gap: 12px;
}

.footer-note {
    font-size: 12px;
    color: #888;
}

.footer-actions {
    display: flex;
    align-items: center;

    gap: 4px;
}

.footer-button {
    padding: 7px 12px;

    border: none;
    border-radius: 0;

    background: transparent;
    color: #ccc;

    font-size: 13px;
}

.footer-button:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.footer-button-danger {
    color: #ff8a8a;
}

.footer-button-danger:hover {
    background: rgba(255, 60, 60, 0.15);
    color: #ffb3b3;
}

@media (max-width: 700px) {

    .app-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .app-header-status {
        width: 100%;

        justify-content: space-between;
    }

    .app-header-actions {
        width: 100%;
    }

    .app-header-actions button {
        width: 100%;
    }

    .calendar-section {
        padding: 0;
    }

    .indefinite-section {
        padding: 12px;
    }

    .calendar-controls {
        padding: 12px;
    }

    .calendar-title {
        font-size: 17px;
    }

    .list-day-heading,
    .list-event-row {
        padding: 10px 12px;
    }

    .date-row,
    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-card {
        padding: 20px;
    }

    .site-footer {
        justify-content: center;
        text-align: center;
    }

}

