.mnec-wrap {
    max-width: 1100px;
    margin: 24px auto;
    padding: 18px;
    border: 1px solid #e5e5e5;
    border-radius: 14px;
    background: #fff;
    box-sizing: border-box;
    overflow-wrap: anywhere;
}

.mnec-wrap * {
    box-sizing: border-box;
}

.mnec-header {
    display: block;
    margin-bottom: 16px;
}

.mnec-header h2,
.mnec-login-wrap h2 {
    margin-top: 0;
}

.mnec-nav-button,
.mnec-event-form button,
.mnec-login-form button,
.mnec-month-form button,
.mnec-danger-button,
.mnec-toggle-passphrase,
.mnec-footer-logout a,
.mnec-secondary-button,
.mnec-join-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    padding: 9px 16px;
    text-decoration: none;
    cursor: pointer;
    background: #222;
    color: #fff;
    line-height: 1.3;
    min-height: 42px;
    white-space: nowrap;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
}

.mnec-footer-logout {
    margin-top: 24px;
    text-align: right;
}

.mnec-footer-logout a,
.mnec-secondary-button {
    min-width: 70px;
}

.mnec-passphrase-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.mnec-passphrase-row .mnec-passphrase-input {
    flex: 1 1 auto;
    min-width: 0;
}

.mnec-passphrase-input.mnec-masked {
    -webkit-text-security: disc;
}

.mnec-danger-button,
.mnec-toggle-passphrase {
    flex: 0 0 auto;
    white-space: nowrap;
}

.mnec-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin: 16px 0;
}

.mnec-month-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.mnec-month-form input,
.mnec-month-form select,
.mnec-login-form input,
.mnec-event-form input,
.mnec-event-form textarea {
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 9px 10px;
    background: #fff;
    font-size: 16px;
    max-width: 100%;
}

.mnec-event-form input[type="text"],
.mnec-event-form input[type="url"],
.mnec-event-form input[type="date"],
.mnec-event-form input[type="time"],
.mnec-login-form input,
.mnec-month-form input,
.mnec-month-form select {
    display: block;
    height: 42px;
    min-height: 42px;
    line-height: 1.4;
    margin: 0;
}

.mnec-event-form textarea {
    min-height: 92px;
    resize: vertical;
}

.mnec-month-form input {
    width: 98px;
}

.mnec-month-form select {
    width: 90px;
}

.mnec-current-month {
    text-align: center;
    margin: 18px 0 10px;
}

.mnec-calendar {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: #fff;
}

.mnec-calendar th,
.mnec-calendar td {
    border: 1px solid #ddd;
    vertical-align: top;
}

.mnec-calendar th {
    padding: 8px;
    background: #f5f5f5;
    text-align: center;
}

.mnec-calendar td {
    height: 118px;
    padding: 6px;
}

.mnec-empty {
    background: #fafafa;
}

.mnec-date-link {
    display: inline-flex;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 700;
}

.mnec-date-link:hover,
.mnec-today .mnec-date-link {
    background: #222;
    color: #fff;
}

.mnec-events {
    margin-top: 6px;
}

.mnec-event-link {
    display: block;
    margin: 4px 0;
    padding: 5px 6px;
    border-radius: 6px;
    background: #f0f4ff;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.35;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.mnec-event-time {
    font-weight: 700;
}

.mnec-card,
.mnec-help,
.mnec-notice,
.mnec-error {
    margin-top: 18px;
    padding: 16px;
    border-radius: 12px;
}

.mnec-card {
    border: 1px solid #e5e5e5;
    background: #fff;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.mnec-help {
    background: #f7f7f7;
}

.mnec-notice {
    background: #edf8ed;
    border: 1px solid #bfe6bf;
}

.mnec-error {
    background: #fff0f0;
    border: 1px solid #ffc9c9;
}

.mnec-detail-list {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 8px 14px;
    max-width: 100%;
}

.mnec-detail-list dt {
    font-weight: 700;
}

.mnec-detail-list dd {
    margin: 0;
    min-width: 0;
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.mnec-detail-list dd a {
    word-break: break-word;
    overflow-wrap: anywhere;
}

.mnec-event-form,
.mnec-login-form {
    display: grid;
    gap: 14px;
}

.mnec-event-form label,
.mnec-login-form label {
    display: grid;
    gap: 6px;
    font-weight: 700;
    min-width: 0;
}


.mnec-event-form .mnec-field {
    display: grid;
    gap: 6px;
    font-weight: 700;
    min-width: 0;
}

.mnec-event-form .mnec-field-title {
    font-weight: 700;
}

.mnec-event-form .mnec-checkbox-label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    margin-top: 4px;
}

.mnec-event-form .mnec-checkbox-label input[type="checkbox"] {
    width: auto;
    min-width: 18px;
    height: 18px;
    padding: 0;
    margin: 0;
}

.mnec-label-text {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    min-height: 20px;
}

.mnec-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
}

.mnec-form-grid > label {
    min-width: 0;
}


.mnec-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 4px;
}

.mnec-secondary-button {
    background: #666;
}


.mnec-join-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #eee;
}

.mnec-join-form input[type="text"] {
    width: 100%;
    min-width: 0;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 9px 10px;
    background: #fff;
    font-size: 16px;
    height: 42px;
    min-height: 42px;
}

.mnec-join-form button {
    background: #b32020;
    color: #fff;
    min-width: 72px;
}

.mnec-empty-participants {
    color: #777;
}

.mnec-detail-actions,
.mnec-delete-form {
    margin-top: 16px;
}

.mnec-delete-form {
    display: block;
    padding-top: 14px;
    border-top: 1px solid #eee;
}

.mnec-delete-form .mnec-danger-button {
    display: inline-flex;
}

.mnec-danger-button {
    background: #8a1f1f;
}

.mnec-required,
.mnec-small {
    font-size: 12px;
    font-weight: 400;
    color: #666;
}

@media (max-width: 760px) {
    .mnec-wrap {
        padding: 12px;
        overflow-x: auto;
    }

    .mnec-calendar {
        table-layout: auto;
        min-width: 760px;
    }

    .mnec-calendar td {
        height: 110px;
    }

    .mnec-form-grid,
    .mnec-detail-list {
        grid-template-columns: 1fr;
    }

    .mnec-passphrase-row {
        align-items: stretch;
    }

    .mnec-month-form input {
        width: 96px;
    }

    .mnec-month-form select {
        width: 82px;
    }

    .mnec-event-form button,
    .mnec-delete-form .mnec-danger-button,
    .mnec-login-form button,
    .mnec-secondary-button {
        width: 100%;
    }

    .mnec-form-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .mnec-join-form {
        grid-template-columns: minmax(0, 1fr) 72px;
    }

    .mnec-delete-form .mnec-danger-button {
        display: flex !important;
        white-space: normal;
    }

    .mnec-footer-logout a,
.mnec-secondary-button {
        width: auto;
        min-width: 70px;
    }
}

/* v1.0.5: 年月指定と合言葉欄のスマホ表示崩れ対策 */
.mnec-month-form {
    display: grid !important;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 10px;
    width: 100%;
    margin: 16px 0;
}

.mnec-month-row {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 520px;
    min-width: 0;
}

.mnec-month-row .mnec-nav-button {
    flex: 0 0 auto;
    min-width: 56px;
    padding: 9px 13px;
}

.mnec-month-form .mnec-year-input,
.mnec-month-form input.mnec-year-input {
    flex: 0 0 96px !important;
    width: 96px !important;
    min-width: 96px !important;
    max-width: 96px !important;
    text-align: center;
}

.mnec-month-form .mnec-month-select,
.mnec-month-form select.mnec-month-select {
    flex: 0 0 82px !important;
    width: 82px !important;
    min-width: 82px !important;
    max-width: 82px !important;
}

.mnec-month-form .mnec-month-submit {
    width: min(100%, 520px) !important;
    max-width: 520px;
    background: #b32020 !important;
    color: #fff !important;
}

.mnec-login-form .mnec-passphrase-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 64px;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.mnec-login-form .mnec-passphrase-row .mnec-passphrase-input,
.mnec-login-form input.mnec-passphrase-input {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 42px;
    min-height: 42px;
}

.mnec-login-form .mnec-passphrase-row .mnec-toggle-passphrase,
.mnec-login-form button.mnec-toggle-passphrase {
    width: 64px !important;
    min-width: 64px !important;
    max-width: 64px !important;
    height: 42px;
    min-height: 42px;
    padding: 0 8px !important;
    font-size: 14px;
    flex: 0 0 64px !important;
}

.mnec-login-form > button[type="submit"] {
    width: 100% !important;
}

@media (max-width: 760px) {
    .mnec-month-row {
        gap: 6px;
    }

    .mnec-month-row .mnec-nav-button {
        min-width: 50px;
        padding-left: 10px;
        padding-right: 10px;
        font-size: 14px;
    }

    .mnec-month-form .mnec-year-input,
    .mnec-month-form input.mnec-year-input {
        flex-basis: 90px !important;
        width: 90px !important;
        min-width: 90px !important;
        max-width: 90px !important;
    }

    .mnec-month-form .mnec-month-select,
    .mnec-month-form select.mnec-month-select {
        flex-basis: 76px !important;
        width: 76px !important;
        min-width: 76px !important;
        max-width: 76px !important;
    }

    .mnec-login-form .mnec-passphrase-row .mnec-toggle-passphrase,
    .mnec-login-form button.mnec-toggle-passphrase {
        width: 64px !important;
        min-width: 64px !important;
        max-width: 64px !important;
    }
}

/* v1.1.1: 予定詳細切り替えをアンカー方式に変更 */
.mnec-detail-targets {
    margin-top: 18px;
}

.mnec-target-detail {
    display: none;
    scroll-margin-top: 18px;
}

.mnec-target-detail:target {
    display: block;
}

/* v1.1.2: 予定詳細は隠しソースから表示欄へコピーする方式 */
.mnec-detail-sources {
    display: none !important;
}

#mnec-event-detail-area {
    scroll-margin-top: 18px;
}

#mnec-event-detail-area:empty {
    display: none;
}
