:root {
    --bg: #111827;
    --panel: #1f2937;
    --panel-2: #0f172a;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --accent: #3b82f6;
    --danger: #ef4444;
}
body.theme-light {
    --bg: #eef2ff;
    --panel: #ffffff;
    --panel-2: #f8fafc;
    --text: #111827;
    --muted: #475569;
    --accent: #2563eb;
    --danger: #dc2626;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: #93c5fd; }
.btn { background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 8px 12px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { opacity: .92; }
.btn-compact { padding: 6px 10px; font-size: 12px; }
.btn-secondary { background: #374151; }
body.theme-light .btn-secondary { background: #64748b; }
.btn-danger { background: var(--danger); }
.btn-sm { padding: 4px 8px; font-size: 12px; }
.hidden { display: none !important; }

.landing-body,.auth-body { min-height: 100vh; display: grid; place-items: center; }
.landing-wrap,.auth-card { background: var(--panel); padding: 32px; border-radius: 12px; width: min(520px, 92vw); }
.landing-body .landing-wrap { width: min(760px, 92vw); overflow: hidden; }
.landing-hero { display: block; width: calc(100% + 64px); height: auto; margin: -32px -32px 20px; }
.landing-actions { display: flex; gap: 10px; margin-top: 16px; }
.auth-card form { display: grid; gap: 8px; }
input,select,textarea { width: 100%; padding: 10px; border-radius: 6px; border: 1px solid #334155; background: #0b1220; color: var(--text); }
body.theme-light input,body.theme-light select,body.theme-light textarea { background: #fff; }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: auto; margin: 0; }
.alert { background: #7f1d1d; padding: 10px; border-radius: 6px; margin-bottom: 8px; }
.alert.success { background: #14532d; }

.dashboard-body { height: 100vh; height: 100dvh; overflow: hidden; }
#app { height: 100%; display: flex; flex-direction: column; }
.topbar { height: 64px; display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid #334155; }
.topbar .title { font-weight: 700; margin-right: 8px; }
.layout { flex: 1; display: flex; min-height: 0; }
.sidebar { width: 320px; min-width: 320px; border-right: 1px solid #334155; display: flex; flex-direction: column; background: var(--panel-2); }
.headings-panel { flex: 1; border-bottom: 1px solid #334155; min-height: 0; display: flex; flex-direction: column; }
.items-panel { flex: 2; min-height: 0; display: flex; flex-direction: column; }
.panel-header { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; padding: 8px; background: #111827; }
.panel-header h3 { margin: 0; font-size: 16px; }
body.theme-light .panel-header { background: #e2e8f0; }
.list { margin: 0; padding: 0; list-style: none; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.list li { padding: 10px; border-bottom: 1px solid #1e293b; cursor: pointer; }
.list li.active { background: #1d4ed8; color: #fff; }
.editor-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.mini-toolbar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: #0b1220; border-bottom: 1px solid #334155; flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; }
body.theme-light .mini-toolbar { background: #e2e8f0; }
.mini-toolbar select { width: auto; min-width: 110px; padding: 6px 8px; font-size: 12px; }
#modeIndicator { font-size: 13px; margin-right: 2px; }
#richActions { display: flex; gap: 4px; align-items: center; }
#statusMsg { color: var(--muted); font-size: 13px; padding: 6px 10px; height: 28px; }
.editor { flex: 1; background: #0b1220; color: var(--text); padding: 16px; overflow: auto; outline: none; }
body.theme-light .editor { background: #fff; }
#codeEditor { display: none; }
.CodeMirror { height: 100% !important; font-size: 14px; }
.settings-panel { position: fixed; top: 72px; right: 16px; width: 280px; background: var(--panel); border: 1px solid #334155; border-radius: 10px; padding: 12px; z-index: 100; }
.editor-wrap .tox-tinymce { flex: 1; min-height: 0; border: 0; }
.editor-wrap .tox-editor-container, .editor-wrap .tox-edit-area, .editor-wrap .tox-edit-area__iframe { height: 100% !important; }
.editor-lock-msg { display: none; flex: 1; padding: 16px; color: var(--muted); background: #0b1220; }
body.theme-light .editor-lock-msg { background: #fff; }
.todo-editor ul { list-style: none; padding-left: 0; }
.todo-editor li { display: flex; flex-direction: row; gap: 8px; align-items: center; margin-bottom: 8px; }
.todo-editor li.done span { text-decoration: line-through; opacity: .75; }
.todo-editor input[type="checkbox"] { width: auto; flex: 0 0 auto; margin: 0; order: 0; }
.todo-editor input[type="text"] { width: auto; flex: 1 1 auto; min-width: 0; padding: 6px 8px; order: 1; }

@media (max-width: 900px) {
    .sidebar { width: 280px; min-width: 280px; }
    .topbar { flex-wrap: wrap; height: auto; }
}
.list-hint { color: var(--muted); font-style: italic; cursor: default; }
.disabled-editor { opacity: .6; pointer-events: none; }
