:root {
    --ink: #172033;
    --muted: #697386;
    --line: #dfe5ef;
    --paper: #ffffff;
    --wash: #f4f7fb;
    --blue: #2457ff;
    --blue-2: #183bc2;
    --green: #138a55;
    --red: #c73232;
    --amber: #a76605;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
    color: var(--ink);
    background: var(--wash);
}
.home {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        linear-gradient(135deg, rgba(36,87,255,.08), transparent 34%),
        linear-gradient(315deg, rgba(19,138,85,.09), transparent 36%),
        #f7f9fd;
}
.home-shell {
    width: min(1080px, calc(100vw - 40px));
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    gap: 24px;
    align-items: stretch;
}
.hero-panel, .entry-panel, .mail-column, .batch-controls, .progress-card, .result-card, .detail-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 22px 60px rgba(31, 41, 55, .08);
}
.hero-panel { padding: 54px; display: flex; flex-direction: column; justify-content: center; }
.brand-row { display: flex; gap: 10px; align-items: center; font-weight: 700; color: var(--blue); }
.brand-mark {
    width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center;
    background: var(--blue); color: white; font-size: 13px;
}
h1 { margin: 8px 0 0; font-size: 34px; letter-spacing: 0; }
.hero-panel h1 { font-size: 56px; line-height: 1.02; margin: 28px 0 18px; }
p { color: var(--muted); font-size: 17px; line-height: 1.7; margin: 0; }
.entry-panel { padding: 34px; display: flex; flex-direction: column; justify-content: center; gap: 16px; }
label, .label-row { font-weight: 700; color: #2b3447; }
.field, .textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: #fbfcff;
    border-radius: 8px;
    padding: 14px 15px;
    font-size: 15px;
    outline: none;
}
.field:focus, .textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(36,87,255,.12); background: white; }
.hint-grid { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
.primary-btn, .ghost-btn, .mini-btn {
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 700;
}
.primary-btn { background: var(--blue); color: white; padding: 14px 18px; font-size: 15px; }
.primary-btn:hover { background: var(--blue-2); }
.primary-btn:disabled { background: #a9b3c7; cursor: wait; }
.ghost-btn { color: var(--blue); background: white; border: 1px solid var(--line); padding: 10px 14px; }
.mini-btn { background: var(--blue); color: white; padding: 7px 12px; }
.batch-link { color: var(--blue); font-weight: 700; text-decoration: none; }
.message { min-height: 22px; font-size: 14px; }
.message.error { color: var(--red); }
.message.ok { color: var(--green); }
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 28px; background: white; border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 5;
}
.eyebrow { color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; }
.topbar h1 { font-size: 26px; margin: 2px 0 0; word-break: break-all; }
.mail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 22px; }
.mail-column { min-height: calc(100vh - 112px); overflow: hidden; }
.column-head { padding: 14px 18px; background: var(--blue); color: white; font-weight: 800; }
.column-head.alt { background: #4b5ee6; }
.mail-list { padding: 16px; display: grid; gap: 12px; }
.mail-item {
    border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 8px;
    padding: 14px; background: white;
}
.mail-subject { font-weight: 800; margin-bottom: 9px; }
.mail-meta { color: var(--muted); font-size: 13px; display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.loading, .empty { color: var(--muted); padding: 24px; text-align: center; }
.batch-layout { display: grid; grid-template-columns: 430px 1fr; gap: 20px; padding: 22px; }
.batch-controls { padding: 22px; position: sticky; top: 92px; height: fit-content; display: grid; gap: 14px; }
.textarea { min-height: 230px; resize: vertical; font-family: Consolas, monospace; }
.counter { text-align: right; color: var(--muted); font-size: 13px; }
.rule-box { display: grid; gap: 10px; }
.rule-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.rule-tag { border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; cursor: pointer; background: white; color: #39445a; }
.rule-tag.selected { color: white; background: var(--blue); border-color: var(--blue); }
.batch-results { display: grid; gap: 16px; align-content: start; }
.progress-card, .result-card { padding: 18px; }
.bar { height: 8px; background: #e7ecf5; border-radius: 99px; margin: 12px 0; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--blue); transition: width .25s ease; }
.status-list { display: flex; gap: 8px; flex-wrap: wrap; }
.status-pill { padding: 6px 10px; border-radius: 999px; font-size: 13px; background: #eef2f8; color: var(--muted); }
.status-pill.success { color: var(--green); background: #eaf7f0; }
.status-pill.error { color: var(--red); background: #fdecec; }
.status-pill.no-match { color: var(--amber); background: #fff5df; }
.result-list, .error-list { display: grid; gap: 12px; }
.group { background: white; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.group-head { padding: 12px 14px; background: #f8fafc; font-weight: 800; border-bottom: 1px solid var(--line); }
.preview { color: var(--muted); font-size: 14px; line-height: 1.55; }
.detail-shell { padding: 24px; }
.detail-card { max-width: 1100px; margin: 0 auto; padding: 24px; }
.detail-meta { color: var(--muted); display: grid; gap: 5px; margin: 12px 0 20px; }
.body-box { border: 1px solid var(--line); background: #fbfcff; border-radius: 8px; padding: 16px; white-space: pre-wrap; overflow: auto; }
.html-frame { width: 100%; min-height: 460px; border: 1px solid var(--line); border-radius: 8px; background: white; }
mark { background: #fff0a6; color: inherit; padding: 0 3px; border-radius: 3px; }
@media (max-width: 880px) {
    .home-shell, .mail-grid, .batch-layout { grid-template-columns: 1fr; }
    .hero-panel { padding: 34px; }
    .hero-panel h1 { font-size: 42px; }
    .batch-controls { position: static; }
}

