.cm-shell {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.cm-head {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
}

.cm-head h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 650;
    color: #111827;
}

.cm-note,
.cm-banner,
.cm-policy {
    margin: 0.5rem 0 0;
    font-size: 0.875rem;
    line-height: 1.45;
    color: #4b5563;
}

.cm-banner {
    margin: 0 0 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 0.5rem;
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fdba74;
}

.cm-error {
    margin: 0 0 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 0.5rem;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.cm-modes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 0.85rem;
}

.cm-mode {
    display: block;
    margin: 0;
    padding: 0.75rem 0.85rem;
    border: 1px solid #d1d5db;
    border-radius: 0.6rem;
    background: #f9fafb;
    color: #111827;
    cursor: pointer;
}

.cm-mode input {
    margin-right: 0.4rem;
}

.cm-mode strong {
    font-weight: 650;
}

.cm-mode span {
    display: block;
    margin-top: 0.25rem;
    color: #4b5563;
    font-size: 0.8125rem;
    line-height: 1.4;
}

.cm-mode.is-selected {
    border-color: #2563eb;
    background: #eff6ff;
}

.cm-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.cm-tab {
    appearance: none;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: #4b5563;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.45rem 0.2rem 0.65rem;
    margin-right: 1rem;
    cursor: pointer;
}

.cm-tab.is-active {
    color: #1d4ed8;
    border-bottom-color: #2563eb;
}

.cm-count {
    display: inline-block;
    min-width: 1.25rem;
    margin-left: 0.35rem;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    background: #2563eb;
    color: #ffffff;
    font-size: 0.75rem;
    line-height: 1.3;
    text-align: center;
}

.cm-nav-badge[hidden],
.cm-course-badge[hidden] {
    display: none !important;
}

.cm-nav-badge,
.cm-course-badge {
    display: inline-block;
    min-width: 1.15rem;
    margin-left: 0.35rem;
    padding: 0.05rem 0.35rem;
    border-radius: 999px;
    background: #2563eb;
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.3;
    vertical-align: middle;
}

.cm-body {
    padding: 1rem 1.25rem 1.25rem;
}

.cm-composer textarea,
.cm-reply-box textarea,
.cm-edit-box textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 4.5rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font: inherit;
    color: #111827;
    background: #ffffff;
    resize: vertical;
}

.cm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.cm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    font-size: 0.8125rem;
    font-weight: 650;
    line-height: 1.2;
    cursor: pointer;
    color: #ffffff;
    background: #4b5563;
}

.cm-btn:hover {
    filter: brightness(0.94);
}

.cm-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.cm-btn-primary {
    background: #2563eb;
    border-color: #1d4ed8;
    color: #ffffff;
}

.cm-btn-quiet {
    background: #ffffff;
    border-color: #d1d5db;
    color: #374151;
}

.cm-btn-danger {
    background: #b91c1c;
    border-color: #991b1b;
    color: #ffffff;
}

.cm-post {
    border: 1px solid #e5e7eb;
    border-radius: 0.65rem;
    padding: 0.85rem 0.95rem;
    margin-top: 0.75rem;
    background: #ffffff;
}

.cm-post.is-pinned {
    border-color: #93c5fd;
    background: #f8fbff;
}

.cm-post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.7rem;
    align-items: baseline;
    margin-bottom: 0.35rem;
    font-size: 0.8125rem;
    color: #6b7280;
}

.cm-post-meta strong {
    color: #111827;
    font-size: 0.9375rem;
}

.cm-pill {
    display: inline-block;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    background: #e5e7eb;
    color: #374151;
    font-size: 0.75rem;
    font-weight: 650;
}

.cm-body-text {
    white-space: pre-wrap;
    word-break: break-word;
    color: #111827;
    font-size: 0.975rem;
    line-height: 1.45;
}

.cm-removed {
    color: #6b7280;
    font-style: italic;
}

.cm-replies {
    margin-top: 0.65rem;
    padding-left: 0.85rem;
    border-left: 2px solid #e5e7eb;
}

.cm-reply {
    padding: 0.55rem 0;
}

.cm-empty {
    padding: 1.5rem 0.5rem;
    text-align: center;
    color: #6b7280;
}

.cm-split {
    display: grid;
    grid-template-columns: 16rem 1fr;
    min-height: 22rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.65rem;
    overflow: hidden;
}

.cm-roster {
    border-right: 1px solid #e5e7eb;
    background: #f9fafb;
    max-height: 34rem;
    overflow: auto;
}

.cm-roster button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.7rem 0.8rem;
    border: none;
    border-bottom: 1px solid #e5e7eb;
    background: transparent;
    cursor: pointer;
    color: #111827;
}

.cm-roster button.is-active {
    background: #ffffff;
    box-shadow: inset 3px 0 0 #2563eb;
}

.cm-roster .cm-preview {
    display: block;
    margin-top: 0.15rem;
    color: #6b7280;
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cm-conversation {
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-height: 34rem;
}

.cm-scroll {
    flex: 1;
    overflow: auto;
    padding: 0.85rem;
}

.cm-conversation .cm-composer {
    border-top: 1px solid #e5e7eb;
    padding: 0.75rem;
}

.cm-bubble {
    max-width: 36rem;
    margin-bottom: 0.65rem;
}

.cm-bubble.is-mine {
    margin-left: auto;
}

.cm-bubble .cm-body-text {
    padding: 0.55rem 0.7rem;
    border-radius: 0.65rem;
    background: #f3f4f6;
}

.cm-bubble.is-mine .cm-body-text {
    background: #dbeafe;
}

.cm-back {
    display: none;
}

a.cm-btn {
    text-decoration: none;
}

.cm-app-body {
    margin: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f3f4f6;
}

.cm-impersonation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 1rem;
    background: #facc15;
    color: #713f12;
    font-size: 0.9375rem;
    font-weight: 650;
}

.cm-impersonation[hidden] {
    display: none !important;
}

#cmStopImpersonation {
    background: #a16207;
    border-color: #854d0e;
    color: #ffffff;
}

.cm-app {
    display: grid;
    grid-template-columns: 18.75rem minmax(0, 1fr);
    flex: 1;
    min-height: 0;
    background: #f3f4f6;
    color: #111827;
    font-family: Inter, "Segoe UI", sans-serif;
}

.cm-side {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    background: #f8fafc;
    border-right: 1px solid #e5e7eb;
}

.cm-side-head {
    padding: 1rem 1rem 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
}

.cm-side-head h1 {
    margin: 0.35rem 0 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: #111827;
}

#cmBack {
    color: #1d4ed8;
    font-size: 0.875rem;
    font-weight: 650;
    text-decoration: none;
}

#cmViewer {
    margin: 0.2rem 0 0;
    color: #6b7280;
    font-size: 0.8125rem;
}

.cm-view-as {
    margin-top: 0.65rem;
}

#cmPlaceList {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.cm-section {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 0 0 auto;
    border-bottom: 1px solid #e5e7eb;
}

.cm-section.is-open {
    flex: 1 1 0;
}

.cm-section-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 0 auto;
    padding: 0.15rem 0.65rem 0.15rem 0.35rem;
}

.cm-section-toggle {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    padding: 0.7rem 0.45rem;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #374151;
}

.cm-caret {
    width: 0.85rem;
    color: #6b7280;
    font-size: 0.85rem;
}

.cm-new-btn {
    flex: none;
    padding: 0.28rem 0.65rem;
    font-size: 0.8125rem;
}

.cm-section-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cm-section-body.is-collapsed {
    display: none;
}

.cm-section-tools {
    display: flex;
    gap: 0.4rem;
    flex: 0 0 auto;
    padding: 0 0.75rem 0.45rem;
}

.cm-section-tools .cm-find {
    flex: 1;
    min-width: 0;
}

.cm-sort {
    flex: none;
    padding: 0.45rem 0.4rem;
    border: 1px solid #d1d5db;
    border-radius: 0.45rem;
    background: #ffffff;
    color: #111827;
    font: inherit;
    font-size: 0.8125rem;
}

.cm-section-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.cm-find {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0.45rem 0.65rem;
    border: 1px solid #d1d5db;
    border-radius: 0.45rem;
    background: #ffffff;
    color: #111827;
    font: inherit;
    font-size: 0.875rem;
}

.cm-find:focus {
    outline: 2px solid #93c5fd;
    border-color: #2563eb;
}

.cm-kind {
    flex: none;
    font-size: 0.6875rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #6b7280;
}

.cm-group-name {
    margin: 0.75rem 0;
}

.cm-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.35rem 0 0.75rem;
}

.cm-chip {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e3a8a;
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
    font-size: 0.8125rem;
    cursor: pointer;
}

.cm-pick-list {
    max-height: 18rem;
    overflow: auto;
    margin-top: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
}

.cm-group-note {
    margin: 0.75rem 0 0;
}

.cm-menu {
    position: fixed;
    z-index: 40;
    min-width: 9rem;
    padding: 0.3rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.55rem;
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.16);
}

.cm-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.45rem 0.65rem;
    border: none;
    border-radius: 0.4rem;
    background: #ffffff;
    color: #111827;
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
}

.cm-menu-item:hover {
    background: #eef2ff;
}

.cm-menu-item.is-danger {
    background: #fef2f2;
    color: #b91c1c;
}

.cm-menu-item.is-danger:hover {
    background: #fee2e2;
}

.cm-modal {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(17, 24, 39, 0.45);
}

.cm-modal[hidden] {
    display: none !important;
}

.cm-modal-card {
    width: min(32rem, 100%);
    max-height: min(36rem, 100%);
    overflow: auto;
    padding: 1.1rem 1.15rem 1rem;
    background: #ffffff;
    border-radius: 0.85rem;
    box-shadow: 0 16px 40px rgba(17, 24, 39, 0.2);
}

.cm-modal-card h2 {
    margin: 0 0 0.35rem;
    font-size: 1.25rem;
}

.cm-place-group {
    margin-top: 0.35rem;
}

.cm-place-course {
    margin: 0.85rem 1rem 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6b7280;
}

.cm-place-sub {
    margin: 0.45rem 1rem 0.15rem;
    font-size: 0.75rem;
    font-weight: 650;
    color: #9ca3af;
}

.cm-place {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.65rem 1rem;
    border: none;
    border-left: 3px solid transparent;
    background: transparent;
    cursor: pointer;
    color: #111827;
}

.cm-place:hover {
    background: #eef2ff;
}

.cm-place.is-active {
    background: #ffffff;
    border-left-color: #2563eb;
}

.cm-place-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.cm-place-label {
    flex: 1;
    min-width: 0;
    font-weight: 650;
    font-size: 0.9375rem;
}

.cm-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: #ffffff;
}

.cm-topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
}

#cmMenuBtn {
    display: none;
}

#cmPlaceTitle {
    font-size: 1.125rem;
    font-weight: 700;
    color: #111827;
}

#cmPlaceSub {
    margin-top: 0.1rem;
    color: #6b7280;
    font-size: 0.8125rem;
}

.cm-stage {
    flex: 1;
    min-height: 0;
    overflow: auto;
    background: #f9fafb;
}

.cm-stage-inner {
    max-width: 46rem;
    margin: 0 auto;
    padding: 1.25rem 1.25rem 2rem;
}

.cm-stage-empty,
.cm-signin {
    max-width: 32rem;
    margin: 4rem auto;
    padding: 0 1.25rem;
    text-align: center;
}

.cm-signin h2 {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    color: #111827;
}

.cm-signin p {
    color: #4b5563;
    line-height: 1.45;
}

.cm-signin .cm-actions {
    justify-content: center;
}

.cm-page-thread {
    display: flex;
    flex-direction: column;
    min-height: 28rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    overflow: hidden;
}

.cm-page-thread .cm-scroll {
    flex: 1;
    max-height: none;
    min-height: 18rem;
}

@media (max-width: 800px) {
    .cm-app {
        grid-template-columns: 1fr;
    }

    .cm-app.cm-show-stage .cm-side {
        display: none;
    }

    .cm-app:not(.cm-show-stage) .cm-main {
        display: none;
    }

    #cmMenuBtn {
        display: inline-flex;
    }

    .cm-modes {
        grid-template-columns: 1fr;
    }

    .cm-split {
        grid-template-columns: 1fr;
    }

    .cm-split .cm-conversation {
        display: none;
    }

    .cm-split.cm-thread-open .cm-roster {
        display: none;
    }

    .cm-split.cm-thread-open .cm-conversation {
        display: flex;
    }

    .cm-back {
        display: inline-flex;
        margin-bottom: 0.5rem;
    }
}
