/* ============================================================================
   写信工具（增强版）：撰写窗格工具按钮、自动抄送提示、存为模板对话框、已读回执提示、设置页
   参照 Microsoft 365 新版 Outlook（Fluent 2）
   ========================================================================== */

/* ---------- 撰写窗格 ---------- */
.compose-pane { position: relative; container: compose / inline-size; }
.ct-tools { display: contents; }
.ct-tools fluent-button { flex: none; min-width: 0; }
.ct-tools .ct-label { white-space: nowrap; }
.ct-tools fluent-button svg[slot="end"] { color: var(--fg3); margin-left: -2px; }
/* 撰写窗格较窄时只显示图标（悬停有提示），避免挤压其它按钮 */
@container compose (max-width: 980px) {
    .ct-tools .ct-label { display: none; }
    .ct-tools fluent-button { padding-left: 6px; padding-right: 6px; }
}
@container compose (max-width: 760px) {
    .ct-tools fluent-button svg[slot="end"] { display: none; }
    .ct-tools fluent-button { padding-left: 4px; padding-right: 4px; }
    .ct-tools > .divider { margin: 0 2px; }
}

/* 自动抄送 / 密送提示：命令栏下方的细条 */
.ct-hint {
    position: absolute; z-index: 2; top: 44px; left: 0; right: 0; height: 32px; display: flex; align-items: center; gap: 8px; padding: 0 20px;
    background: var(--brand-soft); color: var(--fg2); font-size: 12px; border-bottom: 1px solid var(--colorBrandStroke2, #cfe4fa);
}
.ct-hint .ellipsis { min-width: 0; flex: 0 1 auto; }
.ct-hint-link { flex: none; color: var(--brand-fg); text-decoration: none; }
.ct-hint-link:hover { text-decoration: underline; }
.compose-pane:has(.ct-hint) .compose-scroll { padding-top: 36px; }

/* 存为模板对话框 */
.ct-modal-backdrop { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, .4); }
.ct-modal {
    position: fixed; z-index: 1001; top: 22vh; left: 50%; width: 440px; max-width: calc(100vw - 32px); transform: translateX(-50%);
    display: flex; flex-direction: column; gap: 12px; padding: 24px; background: var(--surface); color: var(--fg1);
    border-radius: var(--radius-lg); box-shadow: var(--shadow64, 0 0 8px rgba(0,0,0,.12), 0 32px 64px rgba(0,0,0,.14));
}
.ct-modal-title { font-size: 20px; line-height: 28px; font-weight: 600; }
.ct-field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.ct-field .fl-input { width: 100%; font-weight: 400; }
.ct-warn { color: var(--warning); }
.ct-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---------- 阅读窗格：已读回执请求 ---------- */
.rp-bar { margin: 0 0 12px; }
.rp-bar .rp-text { margin-right: 8px; }

/* ---------- 设置页 ---------- */
.ct-tabs { display: flex; gap: 4px; margin: -4px 0 16px; border-bottom: 1px solid var(--colorNeutralStroke2, #e0e0e0); }
.ct-tab {
    position: relative; height: 40px; padding: 0 12px; border: 0; background: transparent; border-radius: var(--radius) var(--radius) 0 0;
    font: inherit; font-size: 14px; color: var(--fg2); cursor: pointer; white-space: nowrap;
}
.ct-tab:hover { background: var(--hover); color: var(--fg1); }
.ct-tab.on { color: var(--fg1); font-weight: 600; }
.ct-tab.on::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 2px; background: var(--brand); }

.ct-card { padding-top: 16px; padding-bottom: 8px; margin-bottom: 16px; }
.ct-card > .settings-group:first-child { padding-top: 4px; }
.ct-toolbar { display: flex; align-items: center; gap: 8px; padding-bottom: 12px; }
.ct-table { table-layout: auto; margin-bottom: 8px; }
.ct-table .ct-col-on { width: 64px; }
.ct-table .ct-col-cmd { width: 90px; text-align: right; padding-right: 4px; }
.ct-name { padding: 0; border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--fg1); text-align: left; cursor: pointer; }
.ct-name:hover { color: var(--brand-fg); text-decoration: underline; }
.ct-desc { color: var(--fg2); }
.ct-preview { color: var(--fg3); max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-table tr.ct-off .ct-name, .ct-table tr.ct-off .ct-desc { color: var(--fg4); }
.ct-foot { padding: 4px 0 16px; }
.ct-sub { margin: -6px 0 12px; max-width: 720px; }

.ct-empty { min-height: 260px; }
.ct-empty-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-fg); margin-bottom: 4px; }
.ct-empty-text { max-width: 460px; }

/* 签名卡片 */
.ct-sig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding-bottom: 16px; }
.ct-sig-card { display: flex; flex-direction: column; border: 1px solid var(--colorNeutralStroke2, #e0e0e0); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.ct-sig-card:hover { box-shadow: var(--shadow-card); }
.ct-sig-head { display: flex; align-items: center; gap: 4px; padding: 6px 4px 6px 14px; background: var(--surface-alt); border-bottom: 1px solid var(--colorNeutralStroke2, #e0e0e0); }
.ct-sig-frame { display: block; width: 100%; height: 96px; border: 0; background: #fff; }
.ct-defaults td { vertical-align: middle; }
.ct-addr { font-weight: 600; }
.ct-sig-select { width: 100%; min-width: 180px; max-width: 260px; }

/* 编辑面板中的编辑器 */
.side-panel .editor-host.ct-editor { flex: none; min-height: 0; padding: 0 12px; border: 1px solid var(--colorNeutralStroke1, #d1d1d1); border-radius: var(--radius); background: var(--surface); }
.side-panel .editor-host.ct-editor .ql-editor { min-height: 220px; max-height: 50vh; overflow-y: auto; padding: 12px 2px; }
.ct-cond { width: 150px; flex: none; }

/* 附件提醒关键词 */
.ct-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 720px; }
.ct-chip {
    display: inline-flex; align-items: center; gap: 2px; height: 28px; padding: 0 4px 0 12px; border-radius: 14px;
    background: var(--canvas); border: 1px solid var(--colorNeutralStroke2, #e0e0e0); color: var(--fg1); font-size: 13px;
}
.ct-chip.fixed { padding-right: 12px; color: var(--fg3); }
.ct-chip-x { width: 22px; height: 22px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--fg3); cursor: pointer; }
.ct-chip-x:hover { background: var(--colorSubtleBackgroundHover, rgba(0,0,0,.06)); color: var(--fg1); }
.ct-chip-input { width: 160px; height: 28px; }
.ct-reset { margin-top: 10px; padding-left: 0; }

/* 撰写窗格命令栏按钮增多后较挤：附件按钮和草稿状态不换行 */
.compose-bar .file-button { flex: none; white-space: nowrap; }
.compose-bar > .muted.small { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
