/* 4VB G — the 4VB look (from 4VB Office): Russo One for plates and buttons, Poppins for text, Permanent Marker for the
   login title; office red #DF1F46 / #DC2046, green #00E85A, lime #E4FF9A, ink #141414, maroon shadow #5C343B. */
@font-face { font-family: 'Russo One'; src: url('/fonts/RussoOne-latin.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Poppins'; font-weight: 400; src: url('/fonts/Poppins-400-latin.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Poppins'; font-weight: 500; src: url('/fonts/Poppins-500-latin.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Permanent Marker'; src: url('/fonts/PermanentMarker-latin.woff2') format('woff2'); font-display: swap; }
:root { --red: #DF1F46; --red2: #DC2046; --green: #00E85A; --lime: #E4FF9A; --ink: #141414; --shadow: #5C343B; --paper: #E9E9E9; --card: #F4F5F6; --text: #1F2A24; }
html[data-theme="dark"] { --paper: #121212; --card: #1E1E1E; --text: #EEEEEE; }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--paper); color: var(--text); font-family: Poppins, system-ui, sans-serif; }
button { font: inherit; }
.plate { display: inline-block; background: var(--ink); color: var(--green); font: 400 30px 'Russo One', sans-serif; letter-spacing: .5px; padding: 8px 22px; border: 4px solid #F4F4F4; border-radius: 6px; }
.btn { font: 400 16px 'Russo One', sans-serif; letter-spacing: .5px; background: var(--ink); color: var(--green); border: 3px solid #FAFAFA; outline: 3px solid var(--ink); border-radius: 10px; padding: 10px 18px; cursor: pointer; box-shadow: 4px 5px 0 var(--shadow); }
.btn:hover { filter: brightness(1.2); } .btn:disabled { opacity: .5; }
.btn.red { background: var(--red); color: #fff; }
.page { max-width: 1100px; margin: 0 auto; padding: 22px 16px 60px; }
.head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--red2); padding: 12px 16px; border-radius: 8px 18px 8px 8px; box-shadow: 8px 9px 0 var(--shadow); margin-bottom: 22px; }
.head .sp { flex: 1; }
.frame { background: var(--red2); padding: 14px; border-radius: 10px; box-shadow: 10px 12px 0 var(--shadow); }
.sheet { background: var(--lime); border-radius: 6px; padding: 18px; min-height: 50vh; display: flex; flex-direction: column; gap: 14px; }
html[data-theme="dark"] .sheet { background: #1E1E1E; }
.row { display: flex; align-items: center; gap: 14px; background: linear-gradient(var(--card), #E3E7EA); padding: 14px 22px; clip-path: polygon(0 100%, 14px 14px, 22px 5px, 34px 0, calc(100% - 36px) 0, calc(100% - 28px) 5px, 100% calc(100% - 4px), calc(100% - 8px) 100%); }
.row b { flex: 1; font: 400 22px 'Russo One', sans-serif; color: #1F2A24; overflow-wrap: anywhere; }
.row small { color: #56636A; }
input, textarea { font: inherit; font-size: 16px; border: 3px solid var(--ink); border-radius: 10px; padding: 10px 12px; width: 100%; background: #fff; color: #141414; }
.gate { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--ink); }
.gate form { width: min(420px, 100%); background: var(--red); padding: 22px; border-radius: 18px 12px 18px 14px; box-shadow: 10px 12px 0 #000; display: flex; flex-direction: column; gap: 12px; }
.gate h1 { margin: 0 0 6px; font: 400 44px 'Permanent Marker', cursive; color: var(--lime); transform: rotate(-2deg); }
.msg { color: #fff; min-height: 1.2em; font-size: 14px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--green); padding: 12px 18px; border-radius: 10px; font: 400 15px 'Russo One', sans-serif; z-index: 100; box-shadow: 4px 5px 0 var(--shadow); }
@media (max-width: 600px) { .plate { font-size: 20px; padding: 6px 12px; } .row { flex-wrap: wrap; } .row b { font-size: 17px; flex-basis: 100%; } }

/* ── Galvania workspace (Obsidian layout, 4VB palette) ─────────────────────────────────────────── */
html[data-theme="dark"] { --bg0: #0f0f10; --bg1: #161618; --bg2: #1d1d20; --line: #2a2a2e; --tx: #dcddde; --tx2: #9a9ba0; --acc: #DF1F46; }
html[data-theme="light"] { --bg0: #f3f3f3; --bg1: #fafafa; --bg2: #ffffff; --line: #ddd; --tx: #222; --tx2: #666; --acc: #DC2046; }
.shell { height: 100vh; display: flex; flex-direction: column; background: var(--bg0); color: var(--tx); }
.topbar { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: var(--ink); border-bottom: 2px solid var(--acc); }
.plate.sm { font-size: 16px; padding: 3px 12px; border-width: 2px; }
.topsearch { max-width: 420px; padding: 6px 10px; border: 1px solid #333; background: #1a1a1a; color: #eee; border-radius: 6px; font-size: 14px; }
.sp { flex: 1; }
.tbtn { background: transparent; color: var(--tx2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; font-size: 13px; cursor: pointer; }
.topbar .tbtn { color: #ccc; border-color: #333; } .tbtn:hover { color: var(--tx); border-color: var(--acc); }
.panes { flex: 1; display: grid; grid-template-columns: 270px 1fr 280px; min-height: 0; }
.left, .right { background: var(--bg1); overflow: auto; border-right: 1px solid var(--line); font-size: 13.5px; }
.right { border-right: 0; border-left: 1px solid var(--line); padding: 8px 10px; }
.lhead { display: flex; align-items: center; gap: 6px; padding: 8px 10px 6px; color: var(--tx2); font: 400 12px 'Russo One'; letter-spacing: .8px; position: sticky; top: 0; background: var(--bg1); z-index: 1; }
.ibtn { background: none; border: 1px solid var(--line); color: var(--tx2); border-radius: 5px; font-size: 11px; padding: 2px 6px; cursor: pointer; } .ibtn:hover { color: var(--tx); border-color: var(--acc); }
.trow { display: flex; align-items: center; gap: 6px; padding: 3px 8px; cursor: pointer; white-space: nowrap; color: var(--tx); border-radius: 4px; margin: 0 4px; }
.trow:hover { background: var(--bg2); } .trow.on { background: rgba(223,31,70,.18); color: #fff; }
.trow.t-dir .tname { font-weight: 500; } .trow.archived { opacity: .45; }
.caret { width: 10px; color: var(--tx2); font-size: 10px; } .ticon { width: 14px; color: var(--tx2); font-size: 10px; text-align: center; }
.tname { overflow: hidden; text-overflow: ellipsis; }
.results { border-bottom: 1px solid var(--line); } .results:empty { display: none; }
.hit { display: block; padding: 5px 12px; cursor: pointer; color: var(--tx); text-decoration: none; } .hit:hover { background: var(--bg2); }
.hit small { display: block; color: var(--tx2); font-size: 12px; white-space: normal; }
.muted { color: var(--tx2); padding: 4px 12px; font-size: 13px; }
.center { display: flex; flex-direction: column; min-width: 0; background: var(--bg2); }
.tabbar { display: flex; gap: 2px; background: var(--bg1); border-bottom: 1px solid var(--line); overflow-x: auto; min-height: 34px; padding: 4px 4px 0; }
.tab { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 6px 6px 0 0; color: var(--tx2); cursor: pointer; font-size: 13px; white-space: nowrap; max-width: 220px; }
.tab span:first-child { overflow: hidden; text-overflow: ellipsis; } .tab.on { background: var(--bg2); color: var(--tx); box-shadow: inset 0 2px 0 var(--acc); }
.tab .x { opacity: .6; } .tab .x:hover { opacity: 1; color: var(--acc); } .tab.dirty .x { color: var(--lime); opacity: 1; }
.pane { flex: 1; overflow: auto; display: flex; flex-direction: column; }
.nhead { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg2); z-index: 2; }
.crumb { color: var(--tx2); font-size: 12.5px; } .savestate { color: var(--tx2); font-size: 12px; }
.nbody { flex: 1; display: flex; flex-direction: column; padding: 0; }
.editor { flex: 1; min-height: 70vh; border: 0; border-radius: 0; background: var(--bg2); color: var(--tx); font: 15px/1.65 ui-monospace, 'Cascadia Code', Consolas, monospace; padding: 24px max(24px, calc(50% - 380px)); resize: none; outline: none; tab-size: 4; }
.md { padding: 24px max(24px, calc(50% - 380px)) 80px; line-height: 1.7; font-size: 15.5px; overflow-wrap: anywhere; }
.md h1, .md h2, .md h3, .md h4 { line-height: 1.3; margin: 1.3em 0 .5em; } .md h1 { font-size: 1.9em; } .md h2 { font-size: 1.5em; } .md h3 { font-size: 1.25em; }
.md a { color: #ff5a78; } .md a.wl { color: #e8889a; text-decoration: none; border-bottom: 1px dotted; } .md a.wl.unresolved { color: var(--tx2); opacity: .7; }
.md a.tag, .right a.tag { background: rgba(223,31,70,.15); color: #ff8aa0; padding: 1px 7px; border-radius: 10px; text-decoration: none; font-size: .9em; margin-right: 4px; }
.md code { background: var(--bg1); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.md pre.code, pre.code { background: var(--bg1); padding: 12px 14px; border-radius: 8px; overflow: auto; font-size: 13px; line-height: 1.5; border: 1px solid var(--line); }
.md pre code { background: none; padding: 0; } .codenote { display: block; color: var(--lime); font-family: Poppins; font-size: 12px; margin-bottom: 6px; }
.md blockquote { border-left: 3px solid var(--acc); margin: 0; padding: 2px 16px; color: var(--tx2); }
.callout { border-left: 4px solid var(--acc); background: rgba(223,31,70,.08); border-radius: 6px; padding: 8px 14px; margin: 1em 0; } .ctitle { font-weight: 500; text-transform: capitalize; }
.md table { border-collapse: collapse; margin: 1em 0; } .md th, .md td { border: 1px solid var(--line); padding: 5px 10px; text-align: left; vertical-align: top; }
.md table.props { font-size: 13px; color: var(--tx2); margin-top: 0; } .md table.props th { font-weight: 500; width: 1%; white-space: nowrap; }
.md img.emb { max-width: 100%; border-radius: 6px; } .md li.task { list-style: none; margin-left: -1.3em; } .md hr { border: 0; border-top: 1px solid var(--line); }
.md mark { background: rgba(228,255,154,.35); color: inherit; }
img.full { max-width: 100%; margin: 20px auto; display: block; }
.rsec { margin-bottom: 18px; } .rtitle { font: 400 11.5px 'Russo One'; letter-spacing: .8px; color: var(--tx2); margin-bottom: 6px; }
.rlink { display: block; color: var(--tx); text-decoration: none; padding: 3px 4px; border-radius: 4px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rlink:hover { background: var(--bg2); color: #fff; } .rlink.unresolved { color: var(--tx2); font-style: italic; }
.welcome { margin: auto; text-align: center; color: var(--tx2); white-space: pre-line; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: start center; padding-top: 12vh; z-index: 50; }
.modal { width: min(460px, 92vw); background: var(--bg1); color: var(--tx); border: 2px solid var(--acc); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 12px; box-shadow: 8px 10px 0 #000; }
.modal.wide { width: min(640px, 94vw); } .mtitle { font: 400 18px 'Russo One'; } .mtext { color: var(--tx2); font-size: 14px; white-space: pre-line; max-height: 50vh; overflow: auto; }
.modal input { background: var(--bg2); color: var(--tx); border: 1px solid var(--line); } .mrow { display: flex; justify-content: flex-end; gap: 10px; } .modal .btn { font-size: 13px; padding: 6px 14px; box-shadow: 3px 3px 0 #000; }
.swlist { max-height: 50vh; overflow: auto; } .swrow { padding: 6px 10px; border-radius: 6px; cursor: pointer; } .swrow.on, .swrow:hover { background: rgba(223,31,70,.2); }
.swrow small { color: var(--tx2); margin-left: 10px; font-size: 12px; }
.ctx { position: fixed; background: var(--bg1); border: 1px solid var(--line); border-radius: 8px; padding: 4px; z-index: 60; min-width: 170px; box-shadow: 4px 6px 18px rgba(0,0,0,.5); }
.citem { padding: 6px 10px; border-radius: 5px; cursor: pointer; font-size: 13px; color: var(--tx); } .citem:hover { background: var(--bg2); } .citem.danger { color: #ff6b81; }
.board { position: relative; overflow: auto; flex: 1; background: radial-gradient(circle, #2a2a2e 1px, transparent 1px) 0 0 / 22px 22px; min-height: 70vh; }
.stage { position: relative; transform-origin: 0 0; margin: 20px; }
.cnode { position: absolute; border-radius: 8px; overflow: hidden; } .cnode.text, .cnode.file, .cnode.link { background: var(--bg1); border: 2px solid var(--c, #444); padding: 8px 12px; font-size: 13px; line-height: 1.5; overflow: auto; }
.cnode.group { border: 2px solid var(--c, #555); background: color-mix(in srgb, var(--c, #555) 8%, transparent); border-radius: 12px; }
.glabel { position: absolute; top: -28px; left: 0; font: 400 14px 'Russo One'; color: var(--c, #aaa); white-space: nowrap; }
.cnode img { width: 100%; height: 100%; object-fit: contain; } .cnode h1, .cnode h2, .cnode h3 { margin: .2em 0; } .cnode p { margin: .3em 0; }
.hint { color: var(--tx2); font-size: 12px; padding: 6px 16px; }
.graphbox { width: 94vw; height: 84vh; background: #101012; border: 2px solid var(--acc); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.gbar { display: flex; align-items: center; gap: 12px; padding: 8px 12px; color: var(--tx2); font: 400 13px 'Russo One'; height: 40px; } .gopt { font: 13px Poppins; display: flex; align-items: center; gap: 6px; } .gopt input { width: auto; }
@media (max-width: 900px) { .panes { grid-template-columns: 1fr; } .left, .right { display: none; } .topsearch { max-width: 160px; } }

.boardhost { position: fixed; inset: 0; z-index: 40; }

.gpage { flex: 1; min-height: 100%; } .pane.haspage .nbody { padding: 0; }
.panes.pagemode { grid-template-columns: 270px 1fr 0; } .panes.pagemode .right { display: none; }

/* backup panel */
.backup .bkbody { display: flex; flex-direction: column; gap: 10px; font-size: 14px; max-height: 60vh; overflow: auto; }
.bkline { display: flex; gap: 10px; align-items: flex-start; } .bkmark { font-size: 16px; line-height: 1.3; }
.bksub { color: var(--tx2); font-size: 13px; white-space: pre-line; word-break: break-all; }
.bklist { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--line); padding-top: 8px; }
.bkitem { color: var(--acc); font-size: 13px; text-decoration: none; } .bkitem:hover { text-decoration: underline; }

/* PIN sign-in */
.gate input.pin { text-align: center; letter-spacing: 12px; font-size: 26px; }
