:root {
    --bg: #0f1220;
    --panel: #171b2e;
    --panel-2: #1f2540;
    --line: #2a3155;
    --text: #e8ebf5;
    --muted: #9aa3c4;
    --primary: #5b8cff;
    --primary-2: #3b6fe0;
    --ok: #36d399;
    --warn: #f7b955;
    --danger: #f87272;
    --radius: 14px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: radial-gradient(1200px 600px at 70% -10%, var(--panel-2), transparent), var(--bg);
    color: var(--text);
}

.app { max-width: 1280px; margin: 0 auto; padding: 18px; }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; background: var(--panel);
    border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
    width: 42px; height: 42px; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--primary), #8a5bff); border-radius: 12px;
    font-size: 22px; color: #fff;
}
.topbar h1 { font-size: 18px; margin: 0; }
.sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.tabs { display: flex; gap: 8px; }
.tab {
    background: transparent; color: var(--muted); border: 1px solid var(--line);
    padding: 8px 16px; border-radius: 10px; cursor: pointer; font-size: 14px;
}
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.layout { display: grid; grid-template-columns: 380px 1fr; gap: 18px; align-items: start; }
.panel {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 18px;
}

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
textarea, input, select {
    width: 100%; background: var(--panel-2); color: var(--text);
    border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
    font-size: 14px; outline: none; font-family: inherit;
}
textarea:focus, input:focus, select:focus { border-color: var(--primary); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn {
    background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
    padding: 10px 16px; border-radius: 10px; cursor: pointer; font-size: 14px;
    text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: var(--primary); }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); border: none; width: 100%; justify-content: center; font-weight: 600; padding: 13px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.hint { margin-top: 10px; font-size: 13px; min-height: 18px; color: var(--muted); }
.hint.err { color: var(--danger); }
.hint.ok { color: var(--ok); }
.hint.warn { color: var(--warn); }

.preview-panel { min-height: 520px; display: flex; flex-direction: column; }
.preview-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.nav { display: flex; align-items: center; gap: 10px; }
.nav #pageInfo { color: var(--muted); font-size: 13px; min-width: 60px; text-align: center; }
.actions { display: flex; gap: 8px; }

.stage {
    flex: 1; background: #0b0e1a; border: 1px solid var(--line);
    border-radius: 12px; display: grid; place-items: center; padding: 24px; min-height: 440px;
}
.empty { text-align: center; color: var(--muted); }
.empty .big { font-size: 48px; margin-bottom: 8px; }
.muted { color: var(--muted); font-size: 12px; }

/* 幻灯片渲染（16:9） */
.slide-render {
    width: 100%; max-width: 880px; aspect-ratio: 16 / 9;
    border-radius: 10px; overflow: hidden; position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,.45); font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}
.slide-render .s-bg { position: absolute; inset: 0; }
.s-content { position: relative; height: 100%; padding: 6% 7%; display: flex; flex-direction: column; }
.s-content.center { align-items: center; justify-content: center; text-align: center; }
.s-bar { width: 14px; height: 78px; border-radius: 4px; margin-bottom: 12px; }
.s-title { font-weight: 800; line-height: 1.15; }
.s-sub { margin-top: 14px; opacity: .85; }
.s-bullets { margin-top: 28px; display: grid; gap: 16px; }
.s-bullets.two { grid-template-columns: 1fr 1fr; gap: 30px; }
.s-bullet { display: flex; gap: 12px; font-size: 19px; line-height: 1.5; }
.s-bullet .dot { flex: none; width: 12px; height: 12px; border-radius: 50%; margin-top: 9px; }

/* 历史抽屉 */
.drawer {
    position: fixed; top: 0; right: 0; height: 100%; width: 360px; max-width: 90vw;
    background: var(--panel); border-left: 1px solid var(--line);
    transform: translateX(100%); transition: transform .25s ease; z-index: 50;
    display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 16px; margin: 0; }
.history-list { overflow: auto; padding: 12px; display: grid; gap: 10px; }
.h-item { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; }
.h-item:hover { border-color: var(--primary); }
.h-item .t { font-weight: 600; font-size: 14px; }
.h-item .m { color: var(--muted); font-size: 12px; margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }

@media (max-width: 920px) {
    .layout { grid-template-columns: 1fr; }
}

/* 需求文档上传 */
.uploader { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.uploader .file-name { font-size: 12px; max-width: 100%; word-break: break-all; }
.doc-preview {
    margin-top: 10px; background: var(--panel-2); border: 1px solid var(--line);
    border-radius: 10px; padding: 10px 12px;
}
.doc-preview .doc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.doc-preview pre {
    margin: 0; max-height: 200px; overflow: auto; white-space: pre-wrap; word-break: break-word;
    font-size: 12px; line-height: 1.6; color: var(--body); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.link {
    background: none; border: none; color: var(--primary); cursor: pointer;
    font-size: 12px; padding: 0; text-decoration: underline;
}
