:root {
  --bg: #0f1117;
  --bg2: #1a1d27;
  --bg3: #252836;
  --border: #2e3347;
  --text: #e8eaf0;
  --text2: #8b90a0;
  --accent: #4f8ef7;
  --green: #34c78a;
  --amber: #f0a030;
  --red: #e05555;
  --purple: #9b7ff4;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; padding: 16px; min-height: 100vh; }

.topbar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; gap: 8px; }
.app-title { font-size: 16px; font-weight: 600; }
.save-badge { font-size: 11px; color: var(--green); margin-top: 3px; }
.prog-pill { background: var(--bg3); border-radius: 20px; padding: 4px 12px; font-size: 12px; color: var(--text2); white-space: nowrap; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 14px; }
.stat { background: var(--bg2); border-radius: var(--radius); padding: 10px 6px; text-align: center; border: 1px solid var(--border); }
.stat-n { font-size: 22px; font-weight: 600; line-height: 1; }
.stat-l { font-size: 10px; color: var(--text2); margin-top: 3px; text-transform: uppercase; letter-spacing: .04em; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { padding: 5px 13px; border-radius: 20px; font-size: 12px; font-weight: 500; border: 1px solid var(--border); background: transparent; color: var(--text2); cursor: pointer; transition: all .15s; }
.tab.sel { background: var(--accent); color: #fff; border-color: var(--accent); }

.dots { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); cursor: pointer; transition: background .2s; flex-shrink: 0; }
.dot.active { background: var(--accent); }
.dot.done { background: var(--green); }

.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.q-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.q-text { font-size: 14px; line-height: 1.6; flex: 1; }
.q-badge { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; white-space: nowrap; flex-shrink: 0; }
.ba { background: #1a3a6a; color: #7eb8f7; }
.bb { background: #3d2a0a; color: #f5b254; }
.bc { background: #0f3020; color: #4dd49a; }
.bs { background: #2d1f5e; color: #c0a8ff; }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 400px) { .fields { grid-template-columns: 1fr; } }
.field label { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text2); margin-bottom: 4px; }
.field label span { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.field textarea { width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-family: var(--font); font-size: 13px; line-height: 1.5; padding: 8px 10px; resize: none; height: 68px; appearance: none; -webkit-appearance: none; }
.field textarea:focus { outline: none; border-color: var(--accent); }
.field textarea::placeholder { color: var(--text2); }

.nav { display: flex; justify-content: space-between; margin-top: 12px; gap: 8px; }
.btn { background: var(--bg3); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 9px 16px; font-size: 13px; font-family: var(--font); cursor: pointer; transition: opacity .15s; }
.btn:active { opacity: .7; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: transparent; border-color: var(--red); color: var(--red); }

.confirm { background: var(--bg3); border: 1px solid var(--red); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; display: none; }
.confirm.show { display: block; }
.confirm p { font-size: 14px; margin-bottom: 10px; line-height: 1.5; }
.confirm-btns { display: flex; gap: 8px; }

hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

.ai-title { font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.ai-title::before { content: '✦'; color: var(--accent); }
.ai-box { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; font-size: 13px; line-height: 1.7; min-height: 56px; white-space: pre-wrap; color: var(--text); }
.ai-box.loading { color: var(--text2); font-style: italic; }
.ai-row { display: flex; gap: 8px; margin-top: 8px; }
.ai-row input { flex: 1; background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-family: var(--font); font-size: 13px; padding: 9px 12px; min-width: 0; appearance: none; -webkit-appearance: none; }
.ai-row input:focus { outline: none; border-color: var(--accent); }
.ai-row input::placeholder { color: var(--text2); }

.export-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.export-header span { font-size: 13px; font-weight: 600; color: var(--text2); }
.export-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.export-out { width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-family: monospace; font-size: 12px; padding: 10px 12px; height: 140px; resize: vertical; }
