.m21_caly_wrap {
    max-width: 95%;
    margin: 1.5rem auto;
}

.m21_caly_form,
.m21_caly_creator_summary,
.m21_caly_creator_debug,
.m21_caly_preview,
.m21_caly_calendar_panel,
.m21_caly_generated_list_panel,
.m21_caly_notice {
    background: #fff;
    border: 1px solid #d9d9de;
    border-radius: 14px;
    padding: 1.25rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .04);
    margin-bottom: 1rem;
}

.m21_caly_grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.m21_caly_field {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.m21_caly_field label {
    font-weight: 600;
}

.m21_caly_field input,
.m21_caly_field select,
.m21_caly_field textarea {
    width: 100%;
    padding: .75rem .9rem;
    border: 1px solid #c9ccd4;
    border-radius: 10px;
    background: #fff;
    box-sizing: border-box;
    font: inherit;
}

.m21_caly_field textarea {
    min-height: 120px;
    resize: vertical;
}

.m21_caly_help,
.m21_caly_preview_hint,
.m21_caly_generated_meta {
    margin: 0;
    font-size: .92rem;
    color: #5f6470;
}

.m21_caly_mode_panel {
    border: 1px solid #d9d9de;
    border-radius: 14px;
    padding: 1rem;
    background: #fafbfc;
    margin-bottom: 1rem;
}

.m21_caly_mode_panel h3,
.m21_caly_preview h3,
.m21_caly_calendar_panel h3,
.m21_caly_generated_list_panel h3,
.m21_caly_creator_summary h3,
.m21_caly_creator_debug h3 {
    margin-top: 0;
}

.m21_caly_is_hidden,
.m21_caly_field_hidden {
    display: none !important;
}

.m21_caly_actions {
    display: flex;
    justify-content: flex-end;
}

.m21_caly_button {
    border: 0;
    border-radius: 999px;
    padding: .85rem 1.2rem;
    font: inherit;
    cursor: pointer;
    background: #eef2f8;
    color: #24324a;
}

.m21_caly_button_small {
    padding: .45rem .75rem;
    font-size: .9rem;
}

.m21_caly_button_primary {
    background: #0b57d0;
    color: #fff;
}

.m21_caly_notice {
    background: #f6f8fb;
}

.m21_caly_notice_error {
    border-color: #d93025;
    background: #fff1f0;
}

.m21_caly_notice_success {
    border-color: #188038;
    background: #f1fbf3;
}

.m21_caly_summary_table {
    width: 100%;
    border-collapse: collapse;
}

.m21_caly_summary_table th,
.m21_caly_summary_table td {
    padding: .65rem .75rem;
    border-bottom: 1px solid #eceff4;
    text-align: left;
    vertical-align: top;
}

.m21_caly_creator_debug pre {
    background: #10131a;
    color: #f4f7fb;
    padding: 1rem;
    border-radius: 12px;
    overflow-x: auto;
}

.m21_caly_calendar_header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.m21_caly_calendar_stats {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.m21_caly_stat {
    min-width: 82px;
    background: #f6f8fb;
    border: 1px solid #d8dee8;
    border-radius: 12px;
    padding: .6rem .8rem;
    text-align: center;
}

.m21_caly_stat span {
    display: block;
    font-size: .78rem;
    color: #5f6470;
    margin-bottom: .2rem;
}

.m21_caly_stat strong {
    font-size: 1rem;
}

.m21_caly_calendar_box {
    max-height: 70vh;
    overflow: auto;
    padding-right: .25rem;
}

.m21_caly_weekday_row {
    display: grid;
    grid-template-columns: repeat(7, minmax(150px, 1fr));
    position: sticky;
    top: 0;
    z-index: 5;
}

.m21_caly_weekday_header {
    background: #f6f8fb;
    border-right: 1px solid #eef1f5;
    border-bottom: 1px solid #dfe5ee;
    color: #475569;
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .02em;
    padding: .55rem .75rem;
    text-align: center;
    text-transform: uppercase;
}

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

.m21_caly_calendar_weeks {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.m21_caly_week {
    border: 1px solid #e3e7ef;
    border-radius: 14px;
    background: #fbfcfe;
    overflow: hidden;
}

.m21_caly_week_label {
background: #f4eee1;
    color: #005e85;
    font-weight: 600;
    padding: .1rem 0.6rem;
    border-bottom: 1px solid #eddfc3;
    font-size: 0.9em;
    display:none;
}

.m21_caly_week_grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(150px, 1fr));
}

.m21_caly_day {
    min-height: 100px;
    border-right: 1px solid #eef1f5;
    border-bottom: 1px solid #eef1f5;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.m21_caly_day:last-child {
    border-right: 0;
}

.m21_caly_day_has_conflict,
.m21_caly_day_has_conflict .m21_caly_day_head {
    background: #d23e4f75;
}

.m21_caly_day_has_blocked {
    background: linear-gradient(to bottom, rgba(217, 48, 37, .04), rgba(217, 48, 37, .01));
}

.m21_caly_day_head {
display: flex;
    justify-content: space-between;
    gap: .5rem;
    align-items: center;
    padding: .1rem .75rem;
    border-bottom: 1px solid #eef1f5;
    background-color: #a3af7f;
    color: #ffffff;
    text-shadow: 1px 0px #040404;
}

.m21_caly_day_body {
    padding: .6rem;
    display: flex;
    flex-direction: column;
    gap: .45rem;
}

.m21_caly_badge {
    display: flex !important;
    flex-direction: column;
    gap: .2rem;
    border-radius: 12px;
    padding: .55rem .65rem;
    border: 1px solid transparent;
    font-size: .88rem;
    min-width: 0;
}

.m21_caly_badge strong {
    font-size: .9rem;
}

.m21_caly_badge_existing {
    background: #f3f5ee;
    border-color: #d5dbe5;
    color: #334155;
}

.m21_caly_badge_blocked {
    background: #fff1f0;
    border-color: #f1b5b1;
    color: #8a1f17;
}

.m21_caly_badge_generated {
    background: #dae9ef;
    border-color: #b9d2fb;
    color: #163b70;
    cursor: pointer;
}

.m21_caly_badge_modified {
    background: #f0e2c4;
    border-color: #98c7ff;
}

.m21_caly_badge_skipped {
    background: #f7f7f8;
    border-color: #d6d8dd;
    color: #6b7280;
    opacity: .82;
}

.m21_caly_badge_conflict {
    box-shadow: inset 0 0 0 2px rgba(217, 48, 37, .35);
}

.m21_caly_badge_selected {
    box-shadow: 0 0 0 2px #0b57d0;
}

.m21_caly_tile_top {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.m21_caly_tile_top strong {
    font-size: .9rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
    font-family: monospace;
}

.m21_caly_tile_top span {
    font-size: .78rem;
    line-height: 1.25;
    color: inherit;
    overflow-wrap: anywhere;
}

.m21_caly_tile_links {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem .6rem;
    margin-top: .35rem;
}

.m21_caly_tile_links a {
    font-size: .78rem;
    color: #0b57d0;
    text-decoration: none;
}

.m21_caly_tile_links a:hover {
    text-decoration: underline;
}

.m21_caly_chip_edit {
    margin-top: .3rem;
    align-self: flex-start;
    border: 0;
    background: #fff;
    border-radius: 999px;
    padding: .35rem .65rem;
    cursor: pointer;
    font-size: .8rem;
}

.m21_caly_generated_list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.m21_caly_generated_row {
    border: 1px solid #dbe2eb;
    border-radius: 14px;
    background: #fff;
    padding: .8rem .9rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.m21_caly_generated_row_modified {
    background: #f7fbff;
}

.m21_caly_generated_row_skipped {
    background: #f8f8f9;
    color: #6b7280;
}

.m21_caly_generated_row_conflict {
    border-color: #f0b39d;
    background: #fff8f1;
}

.m21_caly_generated_row_selected {
    box-shadow: 0 0 0 2px #0b57d0;
}

.m21_caly_generated_actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .55rem;
}

.m21_caly_shift_controls {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    align-items: center;
}

.m21_caly_shift_mid {
    display: flex;
    gap: .3rem;
    align-items: center;
}

.m21_caly_shift_btn {
    border: 1px solid #cfd7e3;
    background: #fff;
    color: #1f2937;
    border-radius: 999px;
    padding: .35rem .6rem;
    font-size: .8rem;
    cursor: pointer;
}

.m21_caly_shift_skip {
    background: #fff1f0;
    border-color: #f1b5b1;
    color: #a61b12;
}

.m21_caly_created_table_wrap {
    margin-top: 1rem;
}

.m21_caly_error_list {
    margin: .5rem 0 0 1.25rem;
}

@media (max-width: 980px) {
    .m21_caly_week_grid,
    .m21_caly_weekday_row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .m21_caly_weekday_row,
    .m21_caly_weekday_header {
        display: none;
    }

    .m21_caly_calendar_header,
    .m21_caly_generated_row {
        flex-direction: column;
    }

    .m21_caly_generated_actions {
        align-items: flex-start;
    }
}

@media (max-width: 760px) {
    .m21_caly_grid_two,
    .m21_caly_week_grid {
        grid-template-columns: 1fr;
    }

    .m21_caly_actions {
        justify-content: stretch;
    }

    .m21_caly_button {
        width: 100%;
    }

    .m21_caly_day {
        min-height: 0;
    }

    .m21_caly_shift_mid {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* v0.6.3: compact editor layout with a narrow fixed-width input column. */
.m21_caly_editor_layout {
    display: grid;
    grid-template-columns: minmax(240px, 260px) minmax(0, 1fr);
    gap: .8rem;
    align-items: start;
}

.m21_caly_input_panel,
.m21_caly_editor_layout > .m21_caly_calendar_panel {
    min-width: 0;
}

/* One field per row in the narrow input column. */
.m21_caly_input_panel .m21_caly_grid_two {
    grid-template-columns: minmax(0, 1fr);
}

/* Keep the first workflow fields and the date block visible on smaller screens. */
.m21_caly_input_panel .m21_caly_grid {
    gap: .5rem;
    margin-bottom: .55rem;
}

.m21_caly_input_panel .m21_caly_field {
    gap: .22rem;
}

.m21_caly_input_panel .m21_caly_field label {
    font-size: .92rem;
    line-height: 1.2;
}

.m21_caly_input_panel .m21_caly_field input,
.m21_caly_input_panel .m21_caly_field select,
.m21_caly_input_panel .m21_caly_field textarea {
    padding: .52rem .68rem;
    border-radius: 8px;
}

.m21_caly_input_panel .m21_caly_field textarea {
    min-height: 84px;
}

.m21_caly_input_panel .m21_caly_mode_panel {
    padding: .7rem;
    margin-bottom: .6rem;
    border-radius: 10px;
}

.m21_caly_input_panel .m21_caly_mode_panel h3 {
    margin: 0 0 .5rem;
    font-size: 1rem;
    line-height: 1.2;
}

.m21_caly_input_panel .m21_caly_mode_panel .m21_caly_grid:last-child {
    margin-bottom: 0;
}

.m21_caly_input_panel .m21_caly_help {
    font-size: .82rem;
    line-height: 1.25;
}

.m21_caly_editor_layout > .m21_caly_calendar_panel {
    margin-bottom: 1rem;
}

@media (max-width: 1100px) {
    .m21_caly_editor_layout {
        grid-template-columns: minmax(0, 1fr);
    }
}
