/* ==========================================================================
   个人设置（对标 Outlook 网页版“设置”）
   ========================================================================== */
.settings { flex: 1; display: flex; min-height: 0; background: var(--canvas); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 左侧分类 ---------- */
.settings-nav { width: 280px; flex: none; overflow-y: auto; padding: 16px 8px; background: var(--surface); border-right: var(--pane-border); }
.settings-nav-head { display: flex; align-items: center; gap: 10px; padding: 4px 12px 16px; font-size: 20px; line-height: 28px; font-weight: 600; }
.settings-nav-item {
    position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; margin-bottom: 2px;
    border-radius: var(--radius); color: var(--fg1); text-decoration: none;
}
.settings-nav-item > svg { flex: none; margin-top: 1px; color: var(--fg2); }
.settings-nav-item:hover { background: var(--hover); }
.settings-nav-item.active { background: var(--selected); }
.settings-nav-item.active::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--brand); }
.settings-nav-item.active > svg { color: var(--brand-fg); }
.settings-nav-text { display: flex; flex-direction: column; min-width: 0; }
.settings-nav-label { font-size: 14px; line-height: 20px; }
.settings-nav-item.active .settings-nav-label { font-weight: 600; }
.settings-nav-desc { font-size: 12px; line-height: 16px; color: var(--fg3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 内容区 ---------- */
.settings-main { flex: 1; min-width: 0; overflow-y: auto; }
.settings-content { max-width: 960px; padding: 24px 40px 48px; }
.settings-header { margin-bottom: 20px; }
.settings-header h1 { margin: 0; font-size: 24px; line-height: 32px; font-weight: 600; }
.settings-desc { margin-top: 4px; color: var(--fg3); max-width: 760px; }
.settings-card { padding: 0 28px; }
.settings-msg { margin-bottom: 12px; }
.settings-loading { display: flex; align-items: center; gap: 10px; padding: 28px 0; }

.settings-group { padding: 20px 0; border-bottom: 1px solid var(--colorNeutralStroke3, #f0f0f0); }
.settings-card > .settings-group:last-child { border-bottom: 0; }
.settings-group-title { margin-bottom: 12px; font-size: 16px; line-height: 22px; font-weight: 600; }
.settings-card .cf-field { grid-template-columns: 180px minmax(0, 1fr); }
.settings-col { flex-direction: column; gap: 4px; }
.settings-input { width: 100%; max-width: 420px; }
.settings-hint { margin-top: 8px; }
.settings-indent { padding-left: 24px; }
.settings-label-row { margin: 12px 0 8px; }
.settings-check { display: flex; align-items: center; gap: 8px; padding: 6px 0; cursor: pointer; }
.settings-check > .fl-check { flex: none; }
.settings-check.disabled { cursor: default; color: var(--fg2); }
.settings-check input:disabled + span { color: var(--fg3); }
.settings-actions {
    position: sticky; bottom: 0; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 16px 0 20px;
    background: var(--surface); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ---------- 常规 ---------- */
.settings-profile { display: flex; align-items: center; gap: 20px; padding: 24px 0 20px; border-bottom: 1px solid var(--colorNeutralStroke3, #f0f0f0); }
.settings-profile-name { font-size: 20px; line-height: 28px; font-weight: 600; }
.storage-meter { width: 100%; max-width: 420px; height: 8px; margin-top: 8px; border-radius: 4px; background: var(--colorNeutralBackground5, #ebebeb); overflow: hidden; }
.storage-meter-fill { height: 100%; border-radius: 4px; background: var(--brand); transition: width .3s; }
.storage-meter.warn .storage-meter-fill { background: #f7630c; }
.storage-meter.danger .storage-meter-fill { background: #d13438; }
.storage-text { display: flex; justify-content: space-between; width: 100%; max-width: 420px; margin-top: 2px; }

/* ---------- 签名 / 自动回复编辑器 ---------- */
.settings-card .editor-host.signature-editor, .settings-card .editor-host.autoreply-editor {
    flex: none; min-height: 0; padding: 0 12px; border: 1px solid var(--colorNeutralStroke1, #d1d1d1); border-radius: var(--radius);
    background: var(--surface);
}
.settings-card .editor-host .ql-editor { min-height: 160px; max-height: 420px; overflow-y: auto; padding: 12px 2px; }
.signature-preview { max-width: 640px; border: 1px solid var(--colorNeutralStroke2, #e0e0e0); border-radius: var(--radius-lg); overflow: hidden; }
.signature-preview-head { display: flex; align-items: center; gap: 6px; padding: 8px 14px; background: var(--surface-alt); border-bottom: 1px solid var(--colorNeutralStroke2, #e0e0e0); color: var(--fg3); }
.signature-preview-body { padding: 16px 20px 18px; background: var(--surface); }
.signature-preview-placeholder { margin-bottom: 18px; }
.signature-preview-placeholder span { display: block; width: 92%; height: 8px; margin-bottom: 8px; border-radius: 4px; background: var(--colorNeutralBackground5, #ebebeb); }
.signature-preview-placeholder span.short { width: 55%; }
.signature-frame { display: block; width: 100%; height: 60px; border: 0; background: #fff; }
.signature-preview-empty { padding: 4px 0; }

.settings-switch-row { display: flex; align-items: center; gap: 16px; padding: 22px 0 18px; }
.settings-switch-title { font-size: 16px; line-height: 22px; font-weight: 600; cursor: pointer; }
.settings-status {
    display: flex; align-items: center; gap: 8px; margin-bottom: 4px; padding: 8px 12px; border-radius: var(--radius);
    background: var(--colorPaletteGreenBackground1, #f1faf1); color: var(--success);
}
.autoreply-fields { min-width: 0; margin: 0; padding: 0; border: 0; border-top: 1px solid var(--colorNeutralStroke3, #f0f0f0); transition: opacity .15s; }
.autoreply-fields:disabled { opacity: .5; }
.autoreply-fields:disabled .settings-check { cursor: default; }
.autoreply-editor.off { pointer-events: none; }
.autoreply-range { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; padding: 8px 0 0 24px; }
.autoreply-range-item { display: flex; flex-direction: column; gap: 4px; }
.autoreply-range-item .fl-input { width: 220px; }
.autoreply-range-tz { width: 100%; }

/* ---------- 收件规则 ---------- */
.rules-card { padding-top: 16px; padding-bottom: 4px; }
.rules-toolbar { display: flex; align-items: center; gap: 8px; padding-bottom: 12px; }
.rules-table { table-layout: auto; }
.rules-table .rules-col-on { width: 64px; }
.rules-table .rules-col-cmd { width: 150px; text-align: right; padding-right: 4px; }
.rules-cmds { display: flex; justify-content: flex-end; gap: 0; }
.rules-name { padding: 0; border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--fg1); text-align: left; cursor: pointer; }
.rules-name:hover { color: var(--brand-fg); text-decoration: underline; }
.rules-tag { display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: 10px; font-size: 11px; line-height: 18px; background: var(--canvas); color: var(--fg3); white-space: nowrap; }
.rules-desc { color: var(--fg2); min-width: 160px; }
.rules-table tr.rules-off .rules-name, .rules-table tr.rules-off .rules-desc { color: var(--fg4); }
.rules-foot { padding: 12px 0 20px; }
.rules-empty { min-height: 300px; }
.rules-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; }

.rule-form { display: flex; flex-direction: column; }
.rule-block { padding: 16px 0; border-bottom: 1px solid var(--colorNeutralStroke3, #f0f0f0); }
.rule-block:first-child { padding-top: 8px; }
.rule-block.rule-options { border-bottom: 0; }
.rule-label { display: block; margin-bottom: 8px; font-weight: 600; }
.rule-label-row { display: flex; align-items: center; min-height: 32px; margin-bottom: 8px; }
.rule-label-row .rule-label { margin: 0; }
.rule-wide { width: 100%; }
.rule-match { width: 160px; }
.rule-cond { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.rule-field { width: 150px; flex: none; }
.rule-value { flex: 1; }
.rule-empty { padding: 2px 0 10px; }
.rule-add-row { display: flex; align-items: center; gap: 12px; }
.rule-add-row .link-button { display: inline-flex; align-items: center; gap: 4px; padding-left: 0; }
.rule-action { display: flex; align-items: center; gap: 12px; min-height: 36px; }
.rule-action .settings-check { min-width: 128px; flex: none; white-space: nowrap; }
.rule-folder, .rule-forward { flex: 1; min-width: 0; }

/* ---------- 安全 ---------- */
.password-form .settings-actions { padding-bottom: 0; position: static; }
.pwd-meter { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.pwd-bars { display: flex; gap: 4px; }
.pwd-bars span { width: 44px; height: 4px; border-radius: 2px; background: var(--colorNeutralBackground5, #e0e0e0); }
.pwd-meter.s0 .pwd-bars span:nth-child(-n+1), .pwd-meter.s1 .pwd-bars span:nth-child(-n+1) { background: #d13438; }
.pwd-meter.s2 .pwd-bars span:nth-child(-n+2) { background: #f7630c; }
.pwd-meter.s3 .pwd-bars span:nth-child(-n+3) { background: #4caf50; }
.pwd-meter.s4 .pwd-bars span { background: #0e700e; }
.pwd-label { font-size: 12px; color: var(--fg2); }
.pwd-rules { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12px; line-height: 20px; color: var(--fg3); }
.pwd-rules li { display: flex; align-items: center; gap: 6px; }
.pwd-rules li.ok { color: var(--success); }

@media (max-width: 1100px) {
    .settings-nav { width: 220px; }
    .settings-nav-desc { display: none; }
    .settings-content { padding: 20px 20px 40px; }
}

/* 界面版本选择卡片（带示意图） */
.mode-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 300px)); gap: 16px; }
.mode-card { display: flex; flex-direction: column; gap: 12px; padding: 12px; border: 1px solid var(--colorNeutralStroke2, #e0e0e0); border-radius: var(--radius-lg); background: var(--surface); text-align: left; font: inherit; color: inherit; cursor: pointer; }
.mode-card:hover { border-color: var(--colorNeutralStroke1Hover, #c7c7c7); }
.mode-card.on { border: 2px solid var(--brand); padding: 11px; box-shadow: 0 0 0 3px var(--brand-soft); }
.mode-text { display: flex; flex-direction: column; gap: 4px; }
.mode-text b { font-size: 15px; }
.mode-text span { font-size: 12px; line-height: 18px; color: var(--fg3); }
.mode-preview { height: 120px; border-radius: var(--radius); background: var(--canvas); overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--colorNeutralStroke3, #f0f0f0); }
.mode-preview i { display: block; }
.mp-bar { height: 12px; background: var(--brand); }
.mp-ribbon { height: 16px; background: var(--surface); border-bottom: 1px solid var(--colorNeutralStroke2, #e0e0e0);
    background-image: repeating-linear-gradient(90deg, transparent 0 6px, #c8d9ee 6px 18px, transparent 18px 24px); background-size: 100% 6px; background-repeat: no-repeat; background-position: 0 5px; }
.mp-body { flex: 1; display: flex; gap: 4px; padding: 4px; }
.mp-nav { width: 18%; background: var(--surface); border-radius: 2px; }
.mp-list { width: 32%; background: var(--surface) repeating-linear-gradient(180deg, transparent 0 8px, #e8e8e8 8px 16px); border-radius: 2px; }
.mp-table { width: 40%; background: var(--surface) repeating-linear-gradient(180deg, transparent 0 4px, #e3e3e3 4px 6px); border-radius: 2px; }
.mp-read { flex: 1; background: var(--surface); border-radius: 2px; }
.settings-avatar-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.fl-link-button { border: 0; background: none; padding: 0; color: var(--brand-fg); font: inherit; cursor: pointer; }
.fl-link-button:hover { text-decoration: underline; }
