.combo {
    position: relative;
}

.combo-control {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: var(--touch-min);
    padding: 6px 12px;
    background: #fff;
    border: 1px solid var(--cal-border-strong);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    color: var(--cal-text);
    text-align: left;
    cursor: pointer;
}

.combo-control:hover {
    border-color: var(--cal-muted);
}

.combo.is-open .combo-control {
    border-color: var(--cal-green);
}

.combo-value {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-width: 0;
}

.combo-placeholder {
    color: var(--cal-muted);
}

.combo-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 6px 2px 9px;
    border-radius: var(--radius-pill);
    background: var(--lesson-planned-bg);
    border: 1px solid var(--lesson-planned-border);
    color: var(--lesson-planned-name);
    font-size: 12px;
}

.combo-tag button {
    border: 0;
    background: none;
    padding: 0;
    line-height: 1;
    color: inherit;
    cursor: pointer;
}

.combo-caret {
    color: var(--cal-muted);
    transition: transform .15s ease;
}

.combo.is-open .combo-caret {
    transform: rotate(180deg);
}

.combo-panel {
    position: absolute;
    z-index: 40;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--cal-border-strong);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 28px rgba(27, 94, 63, .14);
    overflow: hidden;
    display: none;
}

.combo.is-open .combo-panel {
    display: block;
}

.combo-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--cal-border);
    color: var(--cal-muted);
}

.combo-search input {
    flex: 1;
    border: 0;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    color: var(--cal-text);
}

.combo-options {
    max-height: 260px;
    overflow-y: auto;
    padding: 4px;
}

.combo-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 9px 11px;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    font-family: inherit;
    font-size: 14px;
    color: var(--cal-text);
    text-align: left;
    cursor: pointer;
}

.combo-option:hover,
.combo-option.is-active {
    background: var(--cal-surface);
}

.combo-option.is-selected {
    background: var(--lesson-planned-bg);
    color: var(--lesson-planned-name);
    font-weight: 600;
}

.combo-option-hint {
    font-size: 12px;
    color: var(--cal-muted);
}

.combo-empty {
    padding: 14px 12px;
    font-size: 13px;
    color: var(--cal-muted);
    text-align: center;
}

.autocomplete {
    position: relative;
}

.autocomplete .combo-panel {
    top: calc(100% + 4px);
}

.autocomplete.is-open .combo-panel {
    display: block;
}

.autocomplete .combo-caret {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    padding: 0;
    border: 0;
    background: none;
    color: var(--cal-muted);
    cursor: pointer;
}

.autocomplete.is-open .combo-caret {
    transform: rotate(180deg);
}

.picker {
    position: relative;
}

.picker-panel {
    position: absolute;
    z-index: 40;
    top: calc(100% + 4px);
    left: 0;
    background: #fff;
    border: 1px solid var(--cal-border-strong);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 28px rgba(27, 94, 63, .14);
    padding: 12px;
    display: none;
}

.picker.is-open .picker-panel {
    display: block;
}

.month {
    width: 252px;
}

.month-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.month-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--cal-green);
    text-transform: capitalize;
}

.month-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--cal-border-strong);
    background: #fff;
    color: var(--cal-green);
    cursor: pointer;
}

.month-nav:hover {
    background: var(--cal-surface);
    text-decoration: none;
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.month-weekday {
    font-size: 11px;
    color: var(--cal-muted);
    text-align: center;
    padding-bottom: 4px;
}

.month-day {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border: 0;
    border-radius: 8px;
    background: none;
    font-family: inherit;
    font-size: 13px;
    color: var(--cal-text);
    cursor: pointer;
}

.month-day.is-off {
    background: var(--exclusion-bg);
    color: var(--exclusion-text);
}

.month-day:hover {
    background: var(--cal-surface);
    text-decoration: none;
}

.month-day.is-outside {
    color: var(--cal-border-strong);
}

.month-day.is-today {
    box-shadow: inset 0 0 0 1px var(--cal-green);
    color: var(--cal-green);
    font-weight: 600;
}

.month-day.is-selected {
    background: var(--cal-green);
    color: #fff;
    font-weight: 600;
}

.month-day.has-lessons::after {
    content: "";
    position: absolute;
    transform: translateY(11px);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--cal-gold);
}

.time-list {
    width: 128px;
    max-height: 240px;
    overflow-y: auto;
}

.time-option {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: none;
    font-family: inherit;
    font-size: 14px;
    color: var(--cal-text);
    text-align: left;
    cursor: pointer;
}

.time-option:hover {
    background: var(--cal-surface);
}

.time-option.is-selected {
    background: var(--cal-green);
    color: #fff;
    font-weight: 600;
}

.dropzone {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 1px dashed var(--cal-border-strong);
    border-radius: var(--radius-md);
    background: var(--cal-surface);
    transition: border-color .15s ease, background .15s ease;
}

.dropzone.is-over {
    border-color: var(--cal-green);
    background: var(--lesson-planned-bg);
}

.dropzone-preview {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--cal-border-strong);
    background: #fff;
    flex: none;
}

.dropzone-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 1px solid var(--cal-border-strong);
    background: #fff;
    color: var(--cal-muted);
    flex: none;
}

.dropzone-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.dropzone input[type="file"] {
    display: none;
}

.dropzone-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

dialog.modal {
    width: min(640px, calc(100vw - 32px));
    max-height: calc(100vh - 64px);
    padding: 0;
    border: 1px solid var(--cal-border);
    border-radius: 16px;
    background: #fff;
    color: var(--cal-text);
    overflow: hidden;
}

dialog.modal::backdrop {
    background: rgba(20, 40, 30, .38);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--cal-border);
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
}

.modal-title {
    flex: 1;
    font-size: 17px;
    font-weight: 600;
    color: var(--cal-green);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-avatar {
    display: flex;
    align-items: center;
    flex: none;
}

.modal-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: none;
    padding-right: 6px;
    margin-right: 2px;
    border-right: 1px solid var(--cal-border);
}

.modal-body {
    padding: 18px 20px 22px;
    overflow-y: auto;
    max-height: calc(100vh - 150px);
}

.modal-body .card {
    border: 0;
    padding: 0;
    margin: 0 0 18px;
}

dialog.modal--confirm {
    width: min(430px, calc(100vw - 32px));
}

dialog.modal--confirm .modal-body {
    padding: 20px 22px 22px;
}

.confirm {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
}

.confirm-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: none;
    border-radius: 50%;
    background: var(--danger-bg);
    border: 1px solid var(--danger-soft);
    color: var(--danger);
}

.confirm-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--cal-text);
    padding-top: 4px;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-body .page-head {
    margin-bottom: 16px;
}

.modal-body .page-head .page-title,
.modal-body .page-head .person {
    display: none;
}

.modal-body .page-head-main {
    align-items: flex-start;
}

.modal-body [data-modal-hide] {
    display: none;
}

.rail {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.rail-card {
    background: #fff;
    border: 1px solid var(--cal-border);
    border-radius: var(--radius-md);
    padding: 14px 16px 16px;
}

.rail-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--cal-muted);
    margin-bottom: 10px;
}

.rail-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--cal-border);
}

.rail-item:last-child {
    border-bottom: 0;
}

.rail-time {
    font-size: 13px;
    font-weight: 600;
    color: var(--cal-green);
    flex: none;
    width: 44px;
}

.rail-name {
    font-size: 13px;
    color: var(--cal-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu {
    position: relative;
    margin-top: auto;
}

.user-button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: var(--touch-min);
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: none;
    font-family: inherit;
    font-size: 14px;
    color: var(--cal-text);
    cursor: pointer;
    text-align: left;
}

.user-button:hover,
.user-menu.is-open .user-button {
    background: var(--cal-surface);
    border-color: var(--cal-border);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--cal-border-strong);
    flex: none;
}

.user-avatar--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--lesson-planned-bg);
    color: var(--cal-green);
    font-weight: 600;
    font-size: 13px;
}

.user-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-panel {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--cal-border-strong);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 28px rgba(27, 94, 63, .16);
    padding: 5px;
    display: none;
    z-index: 30;
}

.user-menu.is-open .user-panel {
    display: block;
}

.user-panel a,
.user-panel button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    padding: 0 11px;
    border: 0;
    border-radius: 8px;
    background: none;
    font-family: inherit;
    font-size: 14px;
    color: var(--cal-secondary);
    cursor: pointer;
    text-align: left;
}

.user-panel a:hover,
.user-panel button:hover {
    background: var(--cal-surface);
    text-decoration: none;
}

.row-link {
    cursor: pointer;
    padding-left: 12px;
    padding-right: 12px;
    margin-left: -12px;
    margin-right: -12px;
    border-radius: var(--radius-sm);
    transition: background .12s ease;
}

.row-link:hover {
    background: var(--cal-surface);
}

@media (max-width: 900px) {
    .user-menu {
        margin-top: 0;
        margin-left: auto;
    }

    .user-name {
        display: none;
    }

    .user-panel {
        bottom: auto;
        top: calc(100% + 6px);
        left: auto;
        right: 0;
        width: 200px;
    }
}

.confirm-option {
    margin: 0 0 14px 34px;
}
