* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0f1115; color: #e8ecf1; font-family: system-ui, sans-serif; }
#app { height: 100vh; max-width: none; padding: 0; margin: 0; }
button { font: inherit; color: inherit; }
.shell { display: grid; grid-template-columns: 220px 300px 1fr; height: 100%; }
.side, .list { background: #14171d; border-right: 1px solid #262b35; display: flex; flex-direction: column; min-height: 0; padding: 12px; gap: 8px; }
.side { overflow: auto; }
.brand { font-weight: 700; font-size: 1.1rem; padding: 4px 4px 10px; }
.nb-list { overflow: auto; display: flex; flex-direction: column; gap: 2px; max-height: 40%; flex-shrink: 0; }
.nb { display: flex; align-items: center; border-radius: 8px; }
.nb.active { background: #232a38; }
.nb-name { flex: 1; display: flex; justify-content: space-between; align-items: center; background: none; border: 0; padding: 8px 10px; cursor: pointer; text-align: left; }
.mini { background: none; border: 0; cursor: pointer; opacity: .6; padding: 4px 6px; }
.mini:hover { opacity: 1; }
.side-title { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: #6f7a8d; padding: 6px 4px 0; }
.tag-list { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; align-content: flex-start; overflow: auto; min-height: 40px; }
.tag-chip { background: #1a1e27; border: 1px solid #2d3443; border-radius: 999px; padding: 2px 10px; font-size: .8rem; cursor: pointer; }
.tag-chip:hover { border-color: #6d8cff; }
.tag-chip.on { background: #6d8cff33; border-color: #6d8cff; }
.tag-filter { font-size: .85rem; color: #9aa4b5; display: flex; align-items: center; gap: 4px; }
.small-text { font-size: .8rem; }
.side-foot { display: flex; flex-direction: column; gap: 4px; }
.row { display: flex; gap: 8px; }
.row select { flex: 1; }
.list-top { display: flex; flex-direction: column; gap: 8px; }
.notes { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.note { text-align: left; background: #1a1e27; border: 1px solid #262b35; border-radius: 10px; padding: 10px; cursor: pointer; }
.note:hover { border-color: #3a4256; }
.note.active { border-color: #6d8cff; background: #1e2433; }
.n-title { font-weight: 600; margin-bottom: 3px; }
.n-snip { font-size: .82rem; color: #9aa4b5; overflow: hidden; max-height: 2.6em; }
.n-meta { font-size: .72rem; color: #6f7a8d; margin-top: 4px; }
mark { background: #6d8cff55; color: #fff; border-radius: 2px; }
.editor { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.ed-wrap { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.ed-wrap[hidden], .empty[hidden] { display: none; }
.ed-top { display: flex; gap: 8px; padding: 12px 16px 4px; }
.title { flex: 1; font-size: 1.2rem; font-weight: 600; }
.ed-tools { display: flex; gap: 4px; padding: 4px 16px 8px; align-items: center; flex-wrap: wrap; }
.ed-tools .on { background: #232a38; border-color: #6d8cff; }
.spacer { flex: 1; }
.back-btn { display: none; }
.panes { flex: 1; display: grid; min-height: 0; border-top: 1px solid #262b35; }
.panes.split { grid-template-columns: 1fr 1fr; }
.panes.edit { grid-template-columns: 1fr; }
.panes.edit .preview-col { display: none; }
.panes.preview { grid-template-columns: 1fr; }
.panes.preview textarea { display: none; }
.status { padding: 6px 16px; font-size: .78rem; color: #8a94a6; border-top: 1px solid #262b35; background: #12151a; }
textarea { width: 100%; height: 100%; resize: none; background: #0c0e12; color: #dfe5ee; border: 0; border-right: 1px solid #262b35; padding: 16px; font: 14px/1.6 ui-monospace, Menlo, monospace; outline: none; }
.preview-col { overflow: auto; padding: 16px 20px; min-height: 0; }
.preview { line-height: 1.65; }
.preview h1, .preview h2, .preview h3 { border-bottom: 1px solid #262b35; padding-bottom: .2em; }
.preview code { background: #1f2430; padding: 2px 5px; border-radius: 4px; }
.preview pre { background: #1a1e27; padding: 12px; border-radius: 8px; overflow: auto; position: relative; }
.preview pre[data-lang]::before { content: attr(data-lang); position: absolute; top: 4px; right: 8px; font-size: .7rem; color: #6f7a8d; }
.preview pre code { background: none; padding: 0; }
.preview blockquote { margin: 1em 0; padding: 2px 14px; border-left: 3px solid #6d8cff; color: #b4bdcc; background: #161a22; }
.preview table { border-collapse: collapse; margin: 1em 0; }
.preview th, .preview td { border: 1px solid #2d3443; padding: 6px 12px; }
.preview th { background: #1a1e27; }
.preview a { color: #8fa8ff; }
.preview a.wiki { border-bottom: 1px dashed #8fa8ff; text-decoration: none; }
.preview a.wiki.missing { color: #e09b6b; border-color: #e09b6b; }
.preview hr { border: 0; border-top: 1px solid #2d3443; }
.preview ul, .preview ol { padding-left: 1.4em; }
.preview li.task { list-style: none; margin-left: -1.2em; }
.preview li.task input { cursor: pointer; margin-right: 4px; }
.preview li.task.done { color: #7d8799; text-decoration: line-through; }
.preview .tag { background: #6d8cff22; color: #9db4ff; border-radius: 4px; padding: 0 5px; cursor: pointer; }
.backlinks { margin-top: 24px; padding-top: 10px; border-top: 1px solid #262b35; display: flex; flex-direction: column; gap: 4px; font-size: .9rem; }
.backlinks h4 { margin: 8px 0 4px; color: #9aa4b5; }
.backlinks a { color: #8fa8ff; }
.backlinks a.missing-link { color: #e09b6b; }
.muted { color: #6f7a8d; }
.empty { margin: auto; color: #6f7a8d; padding: 24px; text-align: center; }
.empty.small { padding: 16px; font-size: .9rem; }
.overlay { position: fixed; inset: 0; background: #000a; z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.modal { width: min(560px, 92vw); max-height: 70vh; overflow: auto; display: flex; flex-direction: column; gap: 10px; background: #171b23; border: 1px solid #2d3443; border-radius: 12px; padding: 16px; }
.modal h3 { margin: 0; }
.hist-list, .sw-list { display: flex; flex-direction: column; gap: 6px; }
.hist-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 10px; background: #1a1e27; border: 1px solid #262b35; border-radius: 8px; }
.sw-item { text-align: left; background: #1a1e27; border: 1px solid #262b35; border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.sw-item:hover, .sw-item.on { border-color: #6d8cff; background: #1e2433; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side { border-right: 0; border-bottom: 1px solid #262b35; max-height: 38vh; }
  .list { border-right: 0; }
  .editor { display: none; position: fixed; inset: 0; background: #0f1115; z-index: 5; }
  body.show-editor .editor { display: flex; }
  .back-btn { display: inline-block; }
  .panes.split { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  textarea { border-right: 0; border-bottom: 1px solid #262b35; }
}
@media print {
  html, body, #app { height: auto !important; background: #fff !important; color: #000 !important; }
  .side, .list, .ed-top, .ed-tools, textarea, .backlinks, .status, .overlay, .empty, .fx-toast, .back-btn { display: none !important; }
  .shell, .editor, .ed-wrap, .panes { display: block !important; position: static !important; height: auto !important; border: 0 !important; }
  .preview-col { display: block !important; overflow: visible !important; padding: 0 !important; }
  .preview, .preview * { color: #000 !important; background: transparent !important; }
  .preview a { color: #000 !important; text-decoration: underline; }
  .preview pre, .preview code { border: 1px solid #ccc; white-space: pre-wrap; }
  .preview th, .preview td, .preview blockquote { border-color: #999 !important; }
  .preview pre, .preview table, .preview blockquote { break-inside: avoid; }
  .preview .tag { padding: 0; }
}
</parameter>
