/* 定制剧场 · 客服老咪受控代码工作台；仅作用于 #custom-theater-app。 */
#custom-theater-app.ct-laomi-view .ct-main {
    padding: calc(var(--ct-safe-top) + 54px) var(--ct-safe-right) 0 var(--ct-safe-left);
    overflow: hidden;
    overscroll-behavior: none;
}

#custom-theater-app.ct-laomi-view .ct-edge-toggle {
    display: none;
}

#custom-theater-app.ct-laomi-view .ct-tool-view,
#custom-theater-app.ct-laomi-view .ct-tool-direct {
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    min-height: 0;
}

#custom-theater-app .ct-tool-direct[hidden] {
    display: none !important;
}

#custom-theater-app .ctlm-dialog {
    --ctlm-ink: #30343d;
    --ctlm-soft: #777062;
    --ctlm-paper: rgba(255, 252, 245, 0.92);
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: var(--ctlm-ink);
    background:
        linear-gradient(rgba(56, 62, 72, 0.035) 1px, transparent 1px) 0 0 / 100% 30px,
        var(--ctlm-paper);
}

#custom-theater-app .ctlm-header {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 14px 15px 11px;
    border-bottom: 1px solid rgba(48, 52, 61, 0.14);
    background: rgba(48, 52, 61, 0.94);
    color: #fffaf0;
}

#custom-theater-app .ctlm-brand,
#custom-theater-app .ctlm-avatar {
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 250, 240, 0.55);
    border-radius: 10px 3px 10px 3px;
    background: #c55246;
    color: #fff;
    font: 800 18px/1 "Microsoft YaHei", sans-serif;
}

#custom-theater-app .ctlm-brand { width: 40px; height: 40px; }
#custom-theater-app .ctlm-header div { min-width: 0; }
#custom-theater-app .ctlm-header strong { display: block; font-size: 15px; letter-spacing: 0.08em; }
#custom-theater-app .ctlm-header small { display: block; margin-top: 4px; overflow: hidden; color: rgba(255, 250, 240, 0.68); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
#custom-theater-app .ctlm-header i { position: relative; padding-left: 10px; color: #bde1bd; font: normal 700 9px/1 sans-serif; }
#custom-theater-app .ctlm-header i::before { content: ""; position: absolute; left: 0; top: 50%; width: 6px; height: 6px; border-radius: 50%; background: #7ac17c; transform: translateY(-50%); }
#custom-theater-app .ctlm-header i.is-busy::before { background: #f1c867; animation: ctlm-pulse 1s ease-in-out infinite; }

#custom-theater-app .ctlm-production {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 10px 14px 7px;
    font-size: 10px;
    font-weight: 750;
}

#custom-theater-app .ctlm-production select {
    min-width: 0;
    height: 34px;
    padding: 0 28px 0 10px;
    border: 1px solid rgba(48, 52, 61, 0.22);
    border-radius: 8px 2px 8px 2px;
    background: rgba(255, 255, 255, 0.74);
    color: var(--ctlm-ink);
}

#custom-theater-app .ctlm-capabilities {
    display: flex;
    gap: 5px;
    padding: 0 14px;
    overflow-x: auto;
    scrollbar-width: none;
}

#custom-theater-app .ctlm-capabilities::-webkit-scrollbar { display: none; }
#custom-theater-app .ctlm-capabilities span { flex: 0 0 auto; padding: 4px 7px; border: 1px solid rgba(197, 82, 70, 0.26); border-radius: 999px; color: #8e3c35; background: rgba(197, 82, 70, 0.07); font-size: 8px; font-weight: 740; }
#custom-theater-app .ctlm-boundary { margin: 7px 14px 4px; color: var(--ctlm-soft); font-size: 8px; line-height: 1.55; }

#custom-theater-app .ctlm-error {
    margin: 5px 14px;
    padding: 8px 10px;
    border: 1px solid rgba(174, 57, 47, 0.3);
    border-radius: 8px;
    background: rgba(174, 57, 47, 0.08);
    color: #963c34;
    font-size: 9px;
    line-height: 1.5;
}

#custom-theater-app .ctlm-messages {
    flex: 1 1 0;
    min-height: 0;
    padding: 10px 13px 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

#custom-theater-app .ctlm-message { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 7px; align-items: start; margin: 10px 0; }
#custom-theater-app .ctlm-message.is-user { grid-template-columns: minmax(0, 1fr) 28px; }
#custom-theater-app .ctlm-message.is-user .ctlm-avatar { grid-column: 2; grid-row: 1; background: #666e78; }
#custom-theater-app .ctlm-message.is-user > div { grid-column: 1; grid-row: 1; justify-self: end; background: #3f4650; color: #fff; }
#custom-theater-app .ctlm-message .ctlm-avatar { width: 27px; height: 27px; border-radius: 8px 2px 8px 2px; font-size: 11px; }
#custom-theater-app .ctlm-message > div { max-width: min(88%, 580px); padding: 9px 10px 7px; border: 1px solid rgba(48, 52, 61, 0.14); border-radius: 3px 12px 12px 12px; background: rgba(255, 255, 255, 0.88); box-shadow: 0 5px 14px rgba(37, 40, 47, 0.06); }
#custom-theater-app .ctlm-message p { margin: 0; font-size: 11px; line-height: 1.62; overflow-wrap: anywhere; }
#custom-theater-app .ctlm-message time { display: block; margin-top: 5px; color: #999284; font-size: 7px; }
#custom-theater-app .ctlm-message.is-user time { color: rgba(255, 255, 255, 0.58); text-align: right; }

#custom-theater-app .ctlm-proposal { margin-top: 8px; padding: 9px; border: 1px dashed rgba(197, 82, 70, 0.48); border-radius: 8px; background: rgba(197, 82, 70, 0.06); }
#custom-theater-app .ctlm-proposal strong { display: block; color: #963c34; font-size: 9px; }
#custom-theater-app .ctlm-proposal p { margin-top: 4px; font-size: 9px; }
#custom-theater-app .ctlm-proposal small { display: block; margin-top: 5px; color: #71695e; font-size: 8px; }
#custom-theater-app .ctlm-proposal button { width: 100%; margin-top: 7px; min-height: 32px; border: 0; border-radius: 7px 2px 7px 2px; background: #c55246; color: white; font-size: 9px; font-weight: 800; }
#custom-theater-app .ctlm-proposal.is-irrevocable { border-style: solid; border-color: rgba(151, 45, 37, 0.58); background: rgba(151, 45, 37, 0.1); }
#custom-theater-app .ctlm-proposal .ctlm-irrevocable-warning { color: #8f3029; font-weight: 760; line-height: 1.55; }
#custom-theater-app .ctlm-proposal.is-irrevocable button { background: #982f28; }

#custom-theater-app .ctlm-empty,
#custom-theater-app .ctlm-loading { margin: auto; padding: 28px 24px; color: var(--ctlm-soft); font-size: 10px; line-height: 1.7; text-align: center; }

#custom-theater-app .ctlm-composer {
    position: relative;
    flex: 0 0 auto;
    padding: 9px 12px calc(10px + var(--ct-safe-bottom));
    border-top: 1px solid rgba(48, 52, 61, 0.14);
    background: rgba(246, 240, 232, 0.97);
}

#custom-theater-app .ctlm-composer-row { display: grid; grid-template-columns: auto minmax(0, 1fr) 36px auto; gap: 6px; align-items: end; }
#custom-theater-app .ctlm-composer textarea { display: block; width: 100%; min-width: 0; min-height: 48px; max-height: 150px; resize: none; overflow-y: auto; padding: 8px 9px; border: 1px solid rgba(48, 52, 61, 0.22); border-radius: 9px 3px 9px 3px; background: rgba(255, 255, 255, 0.85); color: var(--ctlm-ink); font: 10px/1.55 inherit; }
#custom-theater-app .ctlm-composer button { min-width: 50px; min-height: 36px; padding: 0 9px; border: 1px solid rgba(48, 52, 61, 0.28); border-radius: 8px 2px 8px 2px; background: transparent; color: var(--ctlm-ink); font-size: 9px; font-weight: 800; }
#custom-theater-app .ctlm-composer [data-ctlm-emoji-toggle] { min-width: 36px; padding: 0; font-size: 16px; }
#custom-theater-app .ctlm-composer button[type="submit"] { border-color: #3f4650; background: #3f4650; color: white; }
#custom-theater-app .ctlm-composer button:disabled,
#custom-theater-app .ctlm-production select:disabled { opacity: 0.5; }
#custom-theater-app .ctlm-emoji-panel { display: flex; gap: 5px; margin-top: 7px; padding: 7px; overflow-x: auto; border: 1px solid rgba(48, 52, 61, 0.14); border-radius: 8px; background: rgba(255, 255, 255, 0.72); }
#custom-theater-app .ctlm-emoji-panel[hidden] { display: none; }
#custom-theater-app .ctlm-emoji-panel button { flex: 0 0 32px; min-width: 32px; min-height: 32px; padding: 0; border: 0; background: rgba(48, 52, 61, 0.06); font-size: 16px; }

#custom-theater-app .ctlm-messages,
#custom-theater-app .ctlm-boundary,
#custom-theater-app .ctlm-capabilities,
#custom-theater-app .ctlm-emoji-panel,
#custom-theater-app .ctlm-composer textarea {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#custom-theater-app .ctlm-messages::-webkit-scrollbar,
#custom-theater-app .ctlm-boundary::-webkit-scrollbar,
#custom-theater-app .ctlm-capabilities::-webkit-scrollbar,
#custom-theater-app .ctlm-emoji-panel::-webkit-scrollbar,
#custom-theater-app .ctlm-composer textarea::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
    background: transparent;
}

#custom-theater-app .ctlm-dialog :focus-visible { outline: 2px solid #c55246; outline-offset: 2px; }

@keyframes ctlm-pulse { 50% { opacity: 0.36; transform: translateY(-50%) scale(0.72); } }

@media (max-height: 680px) {
    #custom-theater-app.ct-laomi-view .ct-main { padding-top: calc(var(--ct-safe-top) + 50px); }
    #custom-theater-app .ctlm-dialog { min-height: 0; }
    #custom-theater-app .ctlm-header { grid-template-columns: 36px minmax(0, 1fr) auto; padding: 8px 12px; }
    #custom-theater-app .ctlm-brand { width: 34px; height: 34px; font-size: 16px; }
    #custom-theater-app .ctlm-production { padding: 7px 12px 5px; }
    #custom-theater-app .ctlm-capabilities { padding: 0 12px; }
    #custom-theater-app .ctlm-boundary { max-height: 25px; margin: 5px 12px 3px; overflow-y: auto; }
    #custom-theater-app .ctlm-messages { min-height: 0; padding-top: 6px; padding-bottom: 8px; }
    #custom-theater-app .ctlm-composer { padding-top: 7px; }
    #custom-theater-app .ctlm-composer textarea { min-height: 42px; max-height: 84px; }
}

@media (prefers-reduced-motion: reduce) {
    #custom-theater-app .ctlm-header i.is-busy::before { animation: none; }
}

@media (prefers-contrast: more) {
    #custom-theater-app .ctlm-dialog,
    #custom-theater-app .ctlm-message > div,
    #custom-theater-app .ctlm-production select,
    #custom-theater-app .ctlm-composer textarea { background: #fffdf8; border-color: #333740; }
}
