:root {
  color-scheme: dark;
  --ink: #f8fafc;
  --muted: #94a3b8;
  --line: #1e293b;
  --bg: #020617;
  --accent: #4f46e5;
  --white: #fff;
}

*{box-sizing:border-box}
body{margin:0;background:#020617;color:#f8fafc;font:16px/1.5 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}

.upload-panel{background:#0f172a;border:1px dashed #334155;border-radius:16px;padding:18px;margin:0 0 18px}
.upload-row{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap}
.upload-copy{min-width:220px;flex:1}
.upload-copy strong{display:block;font-size:14px;color:#fff}
.upload-copy p{margin:4px 0 0;color:#94a3b8;font-size:12px}

.toolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin:16px 0 12px}
.section-label{font-size:14px;font-weight:700;color:#fff}
.hint{font-size:12px;color:#94a3b8}

.tool-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.tool-btn:hover { background: #334155; color: #fff; }
.divider { display: inline-block; width: 1px; height: 16px; background: #334155; margin: 0 4px; }

.panel{background:#0f172a;border:1px solid #1e293b;border-radius:16px;overflow:hidden;min-width:0}
.panel-head{display:flex;justify-content:space-between;align-items:center;padding:13px 15px;border-bottom:1px solid #1e293b;background:#090d16}
.panel-head strong{font-size:14px;color:#fff}
.count{font-size:12px;color:#94a3b8}

textarea{display:block;width:100%;height:430px;resize:vertical;border:0;outline:none;padding:16px;font:14px/1.65 ui-monospace,SFMono-Regular,Menlo,monospace;color:#f8fafc;background:#0f172a}
textarea::placeholder{color:#475569}

.options{margin:18px 0;background:#0f172a;border:1px solid #1e293b;border-radius:16px;padding:16px}
.options-title{font-weight:750;font-size:14px;margin-bottom:12px;color:#fff}

.actions{display:flex;gap:10px;flex-wrap:wrap}
.btn{border:1px solid #334155;background:#1e293b;color:#fff;border-radius:10px;padding:10px 15px;font-size:14px;font-weight:700;cursor:pointer}
.btn.primary{background:#4f46e5;border-color:#4f46e5;color:#fff}
.btn.primary:hover{background:#4338ca}
.btn.secondary{background:#334155;color:#f8fafc;}
.btn.secondary:hover{background:#475569;}
.btn:disabled{opacity:.45;cursor:not-allowed}

.status{min-height:22px;color:#94a3b8;font-size:12px;margin-top:9px}
.foot{margin-top:28px;color:#64748b;font-size:12px;text-align:center}

.small-actions{display:flex;gap:8px}
.small-actions button{border:0;background:transparent;color:#818cf8;font-size:12px;cursor:pointer;padding:2px}
.small-actions button:hover{text-decoration:underline}

.custom-file-upload {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #4f46e5;
    color: #fff;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid #4f46e5;
}
.file-input-hidden { display: none; }

/* Modal 弹窗样式 */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.modal-backdrop.hidden { display: none; }
.modal-content {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    padding: 20px;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.template-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.template-card {
    background: #1e293b;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.template-card.active, .template-card:hover { border-color: #4f46e5; background: #090d16; }
.card-desc { font-size: 11px; color: #94a3b8; margin: 4px 0; }
.card-tag { font-size: 10px; color: #818cf8; font-family: monospace; }
.modal-footer { margin-top: 20px; text-align: right; }

/* 实时预览 (Docx 白底拟真排版) */
.markdown-body h1 { font-size: 1.6rem; font-weight: bold; margin-bottom: 0.6rem; color: #2563eb; font-family: "Microsoft YaHei", sans-serif; }
.markdown-body h2 { font-size: 1.3rem; font-weight: bold; margin-top: 1.2rem; margin-bottom: 0.5rem; color: #1e293b; border-bottom: 1px solid #e2e8f0; padding-bottom: 4px; }
.markdown-body h3 { font-size: 1.1rem; font-weight: bold; margin-top: 1rem; color: #334155; }
.markdown-body p { margin-bottom: 0.8rem; line-height: 1.7; color: #334155; }
.markdown-body table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.markdown-body th, .markdown-body td { border: 1px solid #cbd5e1; padding: 8px 12px; text-align: left; }
.markdown-body th { background: #f1f5f9; color: #0f172a; font-weight: bold; }
.markdown-body pre { background: #f8fafc; padding: 12px; border-radius: 8px; border: 1px solid #e2e8f0; overflow-x: auto; font-family: "Consolas", monospace; color: #0f172a; }
.markdown-body blockquote { border-left: 4px solid #2563eb; padding-left: 12px; color: #64748b; margin: 1rem 0; background: #f8fafc; }