:root { --bg: #f6f6f4; --panel: #fff; --border: #e3e2de; --text: #222; --muted: #777; --accent: #2d6cdf; --danger: #b3261e; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; font: 15px/1.5 system-ui, sans-serif; color: var(--text); background: var(--bg); }
a { color: inherit; }
#sidebar { flex: none; width: 15rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; padding: 1.25rem 1rem; background: var(--panel); border-right: 1px solid var(--border); }
#sidebar .brand { font-weight: 700; font-size: 1.1rem; text-decoration: none; padding: 0 .6rem; }
#sidebar > h2 { margin: 0; padding: 0 .6rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
#sidebar ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
#sidebar li a { display: block; padding: .35rem .6rem; border-radius: 6px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sidebar li a:hover { background: var(--bg); }
#sidebar li a.active { background: var(--accent); color: #fff; }
#sidebar li.dragging { opacity: .4; }
#sidebar .spacer { flex: 1; }
#sidebar a.settings { padding: .35rem .6rem; border-radius: 6px; text-decoration: none; }
#sidebar a.settings:hover { background: var(--bg); }
#sidebar a.settings.active { background: var(--accent); color: #fff; }
body > main { flex: 1; min-width: 0; padding: 2rem 2.5rem; }
body > main > .content { max-width: 60rem; margin: 0 auto; }
#title { margin: 0 0 1.25rem; font-size: 1.5rem; }
.empty { color: var(--muted); }
.error { white-space: pre-wrap; overflow-wrap: anywhere; color: #b3261e; margin: .5rem 0; }
.loading { color: var(--muted); }
[hidden] { display: none !important; }
table { border-collapse: collapse; width: 100%; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; }
th, td { text-align: left; padding: .35rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; font-family: ui-monospace, monospace; font-size: 13px; }
tr:last-child td { border-bottom: none; }
th.sortable { cursor: pointer; user-select: none; }
th[data-sort="asc"]::after { content: " ↑"; color: var(--muted); }
th[data-sort="desc"]::after { content: " ↓"; color: var(--muted); }
textarea { width: 100%; min-height: 12rem; padding: .5rem; font-family: ui-monospace, monospace; font-size: 13px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); }
.code-editor { height: 16rem; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; resize: vertical; background: var(--panel); }
.code-editor > .code-editor-host { flex: 1; min-height: 0; }
.code-editor > .code-editor-host:empty { display: none; }
.code-editor > textarea { flex: 1; min-height: 0; border: 0; border-radius: 0; resize: none; }
.vim-status { flex: none; padding: .1rem .5rem; font: 12px/1.6 ui-monospace, monospace; color: var(--muted); border-top: 1px solid var(--border); white-space: nowrap; overflow: hidden; }
.vim-status > span + span { margin-left: .75rem; }
.vim-status input { width: 50%; padding: 0; font: inherit; color: var(--text); border: 0; outline: none; background: transparent; }
input[type=text] { width: 100%; padding: .4rem .5rem; font: inherit; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); }
label { display: block; margin-top: .75rem; font-weight: 600; }
button { padding: .4rem .8rem; font: inherit; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); cursor: pointer; }
button:hover { background: var(--bg); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: #fff; background: var(--danger); border-color: var(--danger); margin-right: auto; }
button.danger:hover { filter: brightness(1.08); }
#settings-button { position: fixed; top: 1rem; right: 1rem; padding: .4rem; line-height: 0; color: var(--muted); border-radius: 50%; }
#settings-button:hover { color: var(--text); }
#settings-button svg { width: 1.25rem; height: 1.25rem; }
#settings, #new-view { width: min(60rem, 90vw); }
#settings .code-editor { height: 60vh; }
dialog { width: min(40rem, 90vw); border: 1px solid var(--border); border-radius: 8px; padding: 1.25rem 1.5rem; }
dialog::backdrop { background: rgba(0, 0, 0, .3); }
dialog h2 { margin-top: 0; }
menu { display: flex; justify-content: flex-end; gap: .5rem; padding: 0; margin: 1rem 0 0; }
