:root {
  --bg: #f5f6f1;
  --surface: #ffffff;
  --surface-2: #eef1eb;
  --ink: #1e2925;
  --muted: #718078;
  --line: #dfe4dc;
  --green: #28644d;
  --green-dark: #1e503d;
  --mint: #dcebe1;
  --gold: #bd7b28;
  --shadow: 0 18px 50px rgba(30, 50, 40, .08);
  --font-ui: "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  --font-writing: Georgia, "Times New Roman", "Songti SC", SimSun, serif;
}

* { box-sizing: border-box; }
body { margin: 0; overflow-x: hidden; color: var(--ink); background: var(--bg); font-family: var(--font-ui); font-size: 14px; letter-spacing: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.app-shell { min-height: 100vh; }
.topbar { height: 68px; display: grid; grid-template-columns: 260px 1fr 260px; align-items: center; padding: 0 22px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.85); }
.brand { display: flex; min-width: 0; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--font-writing); font-size: 19px; font-weight: 600; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; background: var(--green); color: white; font-family: var(--font-writing); }
.draft-state { justify-self: center; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.saved-dot { width: 7px; height: 7px; border-radius: 50%; background: #5ba378; }
.top-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.share-button, .coach-toggle { height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--green); font-size: 11px; font-weight: 600; }
.coach-toggle[aria-expanded="true"] { border-color: #aac1b4; background: var(--surface-2); }
.icon-btn, .more-btn { display: grid; place-items: center; width: 34px; height: 34px; border: 0; background: transparent; border-radius: 6px; color: var(--muted); }
.icon-btn:hover, .more-btn:hover { background: var(--surface-2); color: var(--ink); }
main { min-height: calc(100vh - 68px); display: grid; grid-template-columns: 240px minmax(480px, 1fr) 300px; }
body.coach-closed main { grid-template-columns: 240px minmax(480px, 1fr); }
.left-panel, .coach-panel { background: var(--surface); }
.left-panel { display: flex; flex-direction: column; padding: 22px 16px; border-right: 1px solid var(--line); }
.new-letter { height: 42px; border: 0; border-radius: 6px; background: var(--green); color: white; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; }
.new-letter:hover { background: var(--green-dark); }
.draft-nav { margin-top: 28px; }
.nav-label { margin: 0 10px 8px; color: #8c9891; font-size: 10px; font-weight: 700; letter-spacing: 1.2px; }
.nav-item { width: 100%; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 9px 10px; border: 0; border-radius: 6px; background: transparent; text-align: left; color: var(--muted); }
.nav-item.active { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.count { color: var(--muted); font-size: 11px; }
.writing-settings { margin-top: 32px; padding-top: 22px; border-top: 1px solid var(--line); }
.section-title { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; }
.section-title svg { width: 15px; color: var(--muted); }
.writing-settings label { display: block; margin: 18px 0 7px; color: var(--muted); font-size: 11px; font-weight: 600; }
select { width: 100%; height: 36px; padding: 0 30px 0 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); outline: none; }
select:focus { border-color: var(--green); }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; border-radius: 6px; background: var(--surface-2); }
.completion-level { grid-template-columns: repeat(4, 1fr); }
.completion-level button { font-size: 9px; }
.segmented button { padding: 6px 3px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 10px; }
.segmented .selected { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); font-weight: 600; }
.workspace { position: relative; padding: 44px clamp(30px, 5vw, 82px) 24px; background: var(--bg); }
.compose-view.hidden, .archive-view.hidden { display: none; }
.archive-view { max-width: 760px; margin: 0 auto; }
.archive-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.archive-heading h1 { margin-top: 7px; }
.archive-new { display: flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 13px; border: 0; border-radius: 5px; background: var(--green); color: white; font-size: 11px; font-weight: 700; }
.finished-list { display: grid; gap: 9px; }
.archive-empty { padding: 52px 24px; border: 1px dashed #bdc8c0; border-radius: 6px; background: var(--surface); text-align: center; }
.archive-empty strong, .archive-empty span { display: block; }
.archive-empty strong { font-family: var(--font-writing); font-size: 20px; }
.archive-empty span { margin-top: 7px; color: var(--muted); font-size: 11px; }
.finished-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px 17px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.finished-copy { min-width: 0; }
.finished-copy strong { display: block; overflow: hidden; font-family: var(--font-writing); font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.finished-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; color: var(--muted); font-size: 9px; }
.finished-meta span:first-child { color: var(--green); font-weight: 700; text-transform: uppercase; }
.finished-actions { display: flex; gap: 7px; }
.finished-actions button { min-height: 31px; padding: 0 9px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--green); font-size: 9px; font-weight: 700; }
.finished-actions button:hover { border-color: #9db9a8; background: #f5faf6; }
.finished-actions .delete-finished { color: #a04f43; }
.letter-heading { display: flex; justify-content: space-between; align-items: flex-start; max-width: 760px; margin: 0 auto 24px; }
.more-menu-wrap { position: relative; }
.document-menu { position: absolute; z-index: 8; top: 38px; right: 0; width: 170px; padding: 5px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); box-shadow: 0 12px 30px rgba(25, 42, 34, .14); }
.document-menu.hidden { display: none; }
.document-menu button { display: block; width: 100%; min-height: 34px; padding: 0 8px; border: 0; border-radius: 4px; background: transparent; text-align: left; color: var(--ink); font-size: 10px; }
.document-menu button:hover, .document-menu button:focus { background: var(--surface-2); outline: 0; }
.document-menu button.danger { color: #a04f43; }
.eyebrow { color: var(--green); font-size: 10px; font-weight: 700; letter-spacing: 1.2px; }
h1 { margin: 7px 0 0; font-family: var(--font-writing); font-size: 30px; line-height: 1.1; letter-spacing: 0; }
.title-input { display: block; width: min(620px, 70vw); margin: 6px 0 0; padding: 0; border: 0; outline: 0; background: transparent; font-family: var(--font-writing); font-size: 30px; font-weight: 600; line-height: 1.15; }
.address-fields.hidden { display: none; }
.editor-wrap.standalone { border-radius: 7px; }
.address-fields { max-width: 760px; margin: auto; border: 1px solid var(--line); border-bottom: 0; border-radius: 7px 7px 0 0; background: var(--surface); }
.address-fields label { display: grid; grid-template-columns: 70px 1fr; align-items: center; min-height: 47px; padding: 0 18px; }
.address-fields label + label { border-top: 1px solid var(--line); }
.address-fields span { color: var(--muted); font-size: 12px; }
.address-fields input { border: 0; outline: 0; background: transparent; font-size: 13px; }
.address-fields .subject-row { grid-template-columns: 70px minmax(0, 1fr) auto; }
.field-action { height: 30px; padding: 0 10px; border: 1px solid #b9cfc1; border-radius: 4px; background: #f3f9f5; color: var(--green); font-size: 10px; font-weight: 700; }
.editor-tools { max-width: 760px; min-height: 42px; margin: 0 auto; padding: 0 10px 0 18px; border: 1px solid var(--line); border-bottom: 0; background: var(--surface); display: flex; align-items: center; gap: 8px; }
.editor-tools > span { margin-right: auto; color: var(--muted); font-size: 10px; }
.editor-tools button { height: 28px; padding: 0 9px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--green); font-size: 10px; font-weight: 600; }
.assist-result { max-width: 760px; margin: 0 auto; padding: 14px 18px; border: 1px solid #b9cfc1; border-bottom: 0; background: #f3f9f5; }
.assist-result.hidden { display: none; }
.assist-head { display: flex; align-items: center; justify-content: space-between; }
.assist-head strong { color: var(--green); font-size: 11px; }
.assist-head button { border: 0; background: transparent; color: var(--muted); font-size: 18px; }
.assist-result p { margin: 8px 0 0; color: var(--ink); font-size: 12px; line-height: 1.65; }
.assist-result .assist-label { display: inline-block; min-width: 74px; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.subject-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.subject-options.text-options { grid-template-columns: 1fr; }
.subject-option { padding: 9px; border: 1px solid #c9dbcf; border-radius: 5px; background: var(--surface); text-align: left; }
.subject-option strong, .subject-option small { display: block; }
.subject-option strong { font-family: var(--font-writing); font-size: 13px; }
.subject-option small { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.apply-simple { margin-top: 10px; padding: 6px 10px; border: 0; border-radius: 4px; background: var(--green); color: white; font-size: 10px; font-weight: 700; }
.assist-loading { color: var(--muted); font-size: 11px; }
.editor-wrap { position: relative; max-width: 760px; min-height: 430px; margin: auto; border: 1px solid var(--line); border-radius: 0 0 7px 7px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
#editor, .editor-mirror { width: 100%; min-width: 0; min-height: 430px; padding: 38px 44px 72px; border: 0; font-family: var(--font-writing); font-size: 18px; line-height: 1.78; letter-spacing: 0; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
#editor { position: relative; z-index: 2; display: block; resize: none; background: transparent; outline: none; }
.editor-mirror { position: absolute; z-index: 1; inset: 0; overflow: hidden; color: transparent; pointer-events: none; }
.ghost-text { color: #8ea198; opacity: .82; }
.review-mark { color: transparent; border-bottom: 2px solid #d09b40; background: rgba(235, 190, 92, .2); }
.review-mark.warning { border-bottom-color: #c86f5b; background: rgba(200, 111, 91, .16); }
.autocomplete-status { position: absolute; z-index: 3; right: 14px; bottom: 12px; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; pointer-events: none; transition: opacity .15s; }
.autocomplete-status.hidden { opacity: 0; }
.autocomplete-status span { color: var(--green); }
.model-thinking { position: absolute; z-index: 3; right: 14px; bottom: 12px; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; }
.model-thinking.hidden { display: none; }
.model-thinking span { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .3; } }
.suggestion-bar { position: absolute; z-index: 4; left: 16px; right: 16px; bottom: 16px; min-height: 48px; padding: 9px 12px; border: 1px solid #b9cfc1; border-radius: 5px; background: #f3f9f5; box-shadow: 0 8px 20px rgba(35,76,55,.1); display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; }
.suggestion-bar.hidden { display: none; }
.suggestion-bar > span { min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.suggestion-bar b { flex: 0 0 auto; color: var(--green); font-size: 9px; text-transform: uppercase; }
.suggestion-bar #barText { overflow: hidden; color: var(--ink); font-family: var(--font-writing); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
body.dark .suggestion-bar { background: #21382d; }
.suggestion-popover { position: absolute; left: 43px; right: 43px; bottom: 28px; padding: 13px 15px; border: 1px solid #b9cfc1; border-radius: 6px; background: #f3f9f5; box-shadow: 0 9px 24px rgba(35, 76, 55, .12); transition: opacity .15s, transform .15s; }
.suggestion-popover.hidden { opacity: 0; pointer-events: none; transform: translateY(4px); }
.suggestion-top { display: flex; align-items: center; gap: 7px; color: var(--green); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; }
.suggestion-top kbd { margin-left: auto; }
.spark { font-size: 14px; }
.suggestion-popover p { margin: 8px 0 10px; font-family: var(--font-writing); font-size: 16px; }
kbd { padding: 2px 5px; border: 1px solid #cad2cc; border-bottom-width: 2px; border-radius: 4px; background: var(--surface); color: var(--muted); font: 9px var(--font-ui); text-transform: none; }
.suggestion-actions { display: flex; gap: 7px; }
.suggestion-actions button { padding: 5px 9px; border: 1px solid #c9dbcf; border-radius: 4px; background: var(--surface); color: var(--green); font-size: 10px; font-weight: 600; }
.suggestion-actions .icon-only { margin-left: auto; border: 0; background: transparent; color: var(--muted); font-size: 18px; }
.editor-footer { max-width: 760px; margin: 16px auto 0; display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: 11px; }
.editor-footer strong { color: var(--ink); }
.shortcut { margin-left: auto; }
.send-button { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 15px; border: 0; border-radius: 5px; background: var(--green); color: white; font-size: 11px; font-weight: 600; }
.send-button svg { width: 14px; }
.coach-panel { padding: 23px 18px; border-left: 1px solid var(--line); }
.coach-panel.closed { display: none; }
.coach-head, .coach-head > div { display: flex; align-items: center; justify-content: space-between; }
.coach-title { display: flex; flex-direction: column; gap: 2px; }
.coach-head strong { font-size: 13px; }
.coach-head span { color: var(--muted); font-size: 9px; }
.connection-state { display: flex; align-items: center; gap: 5px; }
.connection-state i { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.connection-state.online i { background: #51a16f; }
.connection-state.offline i { background: #b96d58; }
.coach-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-top: 18px; border-bottom: 1px solid var(--line); }
.coach-tabs button { padding: 9px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 10px; font-weight: 700; }
.coach-tabs button.active { border-bottom-color: var(--green); color: var(--green); }
.chat-view.hidden, #coachView.hidden { display: none; }
.chat-view { height: calc(100vh - 150px); display: flex; flex-direction: column; }
.chat-messages { flex: 1; min-height: 0; padding: 14px 2px; overflow-y: auto; }
.chat-message { width: fit-content; max-width: 90%; margin-bottom: 10px; padding: 9px 10px; border-radius: 6px; font-size: 11px; line-height: 1.6; white-space: pre-wrap; }
.chat-message.assistant { background: var(--surface-2); color: var(--ink); }
.chat-message.user { margin-left: auto; background: var(--green); color: white; }
.chat-message.thinking { color: var(--muted); font-style: italic; }
.chat-prompts { display: flex; flex-wrap: wrap; gap: 5px; padding: 10px 0; border-top: 1px solid var(--line); }
.chat-prompts button { padding: 5px 7px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--green); font-size: 9px; }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 7px; padding-top: 10px; border-top: 1px solid var(--line); }
.chat-form textarea { min-width: 0; padding: 8px; resize: none; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); outline: none; font-size: 11px; }
.chat-form textarea:focus { border-color: var(--green); }
.chat-form button { align-self: end; height: 32px; padding: 0 10px; border: 0; border-radius: 4px; background: var(--green); color: white; font-size: 10px; font-weight: 700; }
.score-block { margin-top: 24px; padding: 15px; border-radius: 6px; background: var(--surface-2); }
.score-label { display: flex; justify-content: space-between; font-size: 11px; }
.score-label strong { color: var(--green); }
.score-bar { height: 4px; margin: 10px 0; border-radius: 4px; background: #d6ddd7; }
.score-bar span { display: block; width: 78%; height: 100%; border-radius: inherit; background: var(--green); }
.score-block p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.insights { margin-top: 26px; }
.review-heading { display: flex; align-items: center; justify-content: space-between; }
.review-heading .nav-label { margin: 0; }
.review-heading button { padding: 4px 7px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--green); font-size: 9px; font-weight: 700; }
.review-heading button:disabled { opacity: .5; }
.review-status, .intent-note { margin: 8px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.intent-note { padding: 7px 8px; border-left: 2px solid var(--green); background: var(--surface-2); color: var(--ink); }
.intent-note.hidden { display: none; }
.review-issue { padding: 10px 0; border-top: 1px solid var(--line); }
.issue-locate { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 4px 6px; width: 100%; padding: 0; border: 0; background: transparent; text-align: left; }
.issue-locate strong { grid-column: 1 / -1; color: #94641f; font-size: 9px; text-transform: uppercase; }
.issue-locate del, .issue-locate ins { overflow: hidden; font-size: 10px; line-height: 1.4; text-overflow: ellipsis; text-decoration: none; }
.issue-locate del { color: #a45c4c; text-decoration: line-through; }
.issue-locate ins { color: var(--green); }
.issue-locate > span { color: var(--muted); }
.issue-locate small { grid-column: 1 / -1; color: var(--muted); font-size: 9px; line-height: 1.5; }
.issue-apply { margin-top: 7px; padding: 5px 8px; border: 0; border-radius: 4px; background: var(--green); color: white; font-size: 9px; font-weight: 700; }
.insight { display: grid; grid-template-columns: 27px 1fr; gap: 10px; width: 100%; padding: 12px 2px; border: 0; border-top: 1px solid var(--line); background: transparent; text-align: left; }
.insight-mark { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; font-size: 9px; font-weight: 700; }
.insight-mark svg { width: 13px; }
.insight-mark.green { color: var(--green); background: var(--mint); }
.insight-mark.amber { color: #94641f; background: #f6e8cc; }
.insight > span:last-child { display: flex; flex-direction: column; gap: 4px; }
.insight strong { font-size: 11px; }
.insight small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.insight em { color: var(--green); font-size: 9px; font-style: normal; font-weight: 600; }
.phrase-bank { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.phrase-bank .section-title button { border: 0; background: transparent; color: var(--muted); font-size: 18px; }
.phrase-bank > button { width: 100%; margin-top: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); text-align: left; color: #58665f; font-family: var(--font-writing); font-size: 12px; }
.phrase-bank > button:hover { border-color: #a7bdb0; background: #f6faf7; }
.phrase-bank #phraseList > button { width: 100%; margin-top: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); text-align: left; color: #58665f; font-family: var(--font-writing); font-size: 12px; }
.phrase-bank #phraseList > button:hover { border-color: #a7bdb0; background: #f6faf7; }
.coach-tip { display: grid; grid-template-columns: 22px 1fr; gap: 8px; margin-top: 24px; padding: 12px; border-left: 2px solid var(--gold); background: #fff9ef; }
.coach-tip > span { display: grid; place-items: center; width: 18px; height: 18px; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold); font-size: 10px; font-weight: 700; }
.coach-tip p { display: flex; flex-direction: column; gap: 3px; margin: 0; color: #806f58; font-size: 9px; line-height: 1.5; }
.coach-tip strong { color: #5f503e; font-size: 10px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 18px); padding: 10px 16px; border-radius: 5px; background: #18241f; color: white; opacity: 0; pointer-events: none; transition: .2s; font-size: 12px; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.email-modal { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 20px; }
.email-modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(18, 29, 24, .42); backdrop-filter: blur(2px); }
.email-dialog { position: relative; width: min(520px, 100%); padding: 22px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: 0 24px 70px rgba(20, 35, 28, .22); }
.email-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; }
.email-dialog-head span { color: var(--green); font-size: 9px; font-weight: 700; letter-spacing: 1.2px; }
.email-dialog-head h2 { margin: 5px 0 0; font-family: var(--font-writing); font-size: 25px; letter-spacing: 0; }
.email-dialog-head > button { width: 30px; height: 30px; border: 0; background: transparent; color: var(--muted); font-size: 20px; }
.email-summary { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 8px 12px; margin-top: 18px; padding: 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); }
.email-summary span, .email-summary label { align-self: center; color: var(--muted); font-size: 10px; }
.email-summary strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.email-summary input { width: 100%; min-width: 0; height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); outline: 0; font-size: 11px; }
.email-summary input:focus { border-color: var(--green); box-shadow: 0 0 0 2px rgba(40, 100, 77, .1); }
.email-import-note { margin: 12px 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.email-import-note strong { color: var(--ink); }
.email-provider-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.email-provider-grid > button { min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: 10px; text-align: left; }
.email-provider-grid > button:hover { border-color: #9db9a8; background: #f5faf6; }
.provider-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 5px; color: white; font-style: normal; font-size: 12px; font-weight: 700; }
.provider-mark.qq { background: #1683e2; font-size: 9px; }
.provider-mark.netease { background: #d63b37; font-size: 9px; }
.provider-mark.gmail { background: #c94c3f; }
.provider-mark.custom { background: var(--green); font-size: 18px; font-weight: 500; }
.email-provider-grid span, .email-provider-grid strong, .email-provider-grid small { display: block; min-width: 0; }
.email-provider-grid strong { font-size: 11px; }
.email-provider-grid small { margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.custom-provider-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; margin-top: 9px; padding: 11px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); }
.custom-provider-panel.hidden { display: none; }
.custom-provider-panel label { grid-column: 1 / -1; color: var(--muted); font-size: 9px; font-weight: 700; }
.custom-provider-panel input { min-width: 0; height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); outline: 0; font-size: 10px; }
.custom-provider-panel input:focus { border-color: var(--green); }
.custom-provider-panel button { min-height: 34px; padding: 0 10px; border: 0; border-radius: 4px; background: var(--green); color: white; font-size: 9px; font-weight: 700; }
.copy-email { width: 100%; height: 36px; margin-top: 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--green); font-size: 10px; font-weight: 700; }
body.modal-open { overflow: hidden; }
body.dark { --bg: #18201d; --surface: #202a26; --surface-2: #29342f; --ink: #edf2ef; --muted: #9baaa2; --line: #36423c; --mint: #254536; --shadow: 0 18px 50px rgba(0,0,0,.25); }
body.dark .topbar { background: rgba(32,42,38,.9); }
body.dark .coach-tip { background: #342f24; border-color: #4b4231; }
body.dark .suggestion-popover { background: #21382d; }
body.dark .title-input { color: var(--ink); }
@media (max-width: 1050px) {
  main { grid-template-columns: 200px minmax(450px, 1fr); }
  .topbar { grid-template-columns: 220px 1fr 190px; }
  .coach-panel { position: fixed; z-index: 5; right: 0; top: 68px; bottom: 0; width: 300px; box-shadow: -12px 0 35px rgba(0,0,0,.12); transform: translateX(100%); transition: transform .2s; }
  .coach-panel.open { transform: translateX(0); }
}
@media (max-width: 720px) {
  .topbar { height: 58px; grid-template-columns: 1fr auto; padding: 0 14px; }
  .draft-state { display: none; }
  .top-actions .icon-btn { display: none; }
  main { display: block; min-height: calc(100vh - 58px); }
  .left-panel { display: none; }
  .workspace { width: 100vw; max-width: 100vw; min-width: 0; padding: 42px 14px 24px; overflow: hidden; }
  .archive-view { width: calc(100vw - 28px); max-width: calc(100vw - 28px); }
  .archive-heading { align-items: flex-start; }
  .finished-item { grid-template-columns: 1fr; }
  .finished-actions { justify-content: flex-start; }
  .letter-heading, .address-fields, .editor-tools, .assist-result, .editor-wrap, .editor-footer { width: calc(100vw - 28px); max-width: calc(100vw - 28px); min-width: 0; }
  .address-fields label { grid-template-columns: 60px minmax(0, 1fr); padding: 0 16px; }
  .address-fields input { width: 100%; min-width: 0; }
  .address-fields .subject-row { grid-template-columns: 60px minmax(0, 1fr); }
  .field-action { grid-column: 2; margin: 0 0 8px; justify-self: start; }
  .editor-tools { flex-wrap: wrap; padding: 8px 10px; }
  .editor-tools > span { width: 100%; }
  .subject-options { grid-template-columns: 1fr; }
  h1 { font-size: 25px; }
  .title-input { width: 100%; font-size: 25px; }
  .editor-wrap { contain: inline-size; }
  .editor-wrap, #editor, .editor-mirror { min-height: 480px; }
  #editor, .editor-mirror { max-width: 100%; padding: 28px 22px 70px; overflow-x: hidden; font-size: 17px; }
  .suggestion-popover { left: 14px; right: 14px; bottom: 18px; }
  .editor-footer { flex-wrap: wrap; }
  .shortcut { display: none; }
  .send-button { margin-left: auto; }
  .coach-panel { top: 58px; width: min(90vw, 320px); }
  .email-dialog { padding: 18px; }
  .email-provider-grid { grid-template-columns: 1fr; }
  .custom-provider-panel { grid-template-columns: 1fr; }
  .custom-provider-panel button { min-height: 36px; }
}
