:root { --bg: #f4f5f7; --panel: #fff; --line: #d5d9e0; --text: #1d2430; --dim: #667085; --acc: #b3261e; --sel: #fde8e6; --work: #8d95a3; --code: #fff; --kw: #0b3d91; --str: #8a3b00; --com: #2f7a3d; --num: #7a1fa2; }
@media (prefers-color-scheme: dark) { :root { --bg: #15181d; --panel: #1c2027; --line: #323843; --text: #e4e8ee; --dim: #97a1b0; --acc: #ff8a80; --sel: #43262a; --work: #3a414c; --code: #181b21; --kw: #8ab4f8; --str: #f0b27a; --com: #7fc68d; --num: #d7a6ee; } }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 13px/1.45 "Segoe UI", system-ui, sans-serif; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); padding: 4px 12px; }
button.ghost { background: none; }
button:hover { border-color: var(--dim); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: -1px; }
.dim { color: var(--dim); } .grow { flex: 1; } .hint { color: var(--dim); padding: 24px; margin: 0; }

body.ide { display: grid; grid-template: auto minmax(0, 1fr) / 250px minmax(0, 1fr) 320px; height: 100vh; }
header { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; padding: 7px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
header strong { color: var(--acc); letter-spacing: .02em; }
nav, aside { background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
nav { border-right: 1px solid var(--line); } aside { border-left: 1px solid var(--line); }
nav input { margin: 8px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); }
#units, #tree, #inspector { overflow: auto; flex: 1; min-height: 0; padding-bottom: 12px; }
main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tabs { display: flex; gap: 4px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); background: var(--panel); }
.tabs button[role=tab] { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 4px 8px; color: var(--dim); }
.tabs button.on { color: var(--text); border-color: var(--acc); }
.tabs label { display: flex; gap: 4px; align-items: center; margin-right: 6px; }
.pane { display: none; flex: 1; overflow: auto; min-height: 0; background: var(--work); }
.pane.on { display: block; }
#source { background: var(--code); }
.half { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.half + .half { border-top: 1px solid var(--line); flex: 1.3; }
h2 { font-size: 12px; margin: 0; padding: 8px 12px 4px; color: var(--dim); font-weight: 600; overflow-wrap: anywhere; }

.folder { padding: 8px 12px 2px; color: var(--dim); font-size: 12px; }
.row { display: block; width: 100%; text-align: left; border: 0; border-radius: 0; background: none; padding: 2px 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row:hover { background: var(--bg); } .row.sel { background: var(--sel); }
.row .dim { margin-left: 6px; font-size: 12px; }
.row.nv { font-style: italic; }

.sheet { position: relative; margin: 20px; box-shadow: 0 1px 3px #0005; background: #f0f0f0; }
.sheet img { display: block; }
.sheet .box { position: absolute; border: 0; padding: 0; border-radius: 0; background: none; cursor: default; }
.sheet .box:hover { box-shadow: inset 0 0 0 1px #1a73e8aa; }
.outlines .box { box-shadow: inset 0 0 0 1px #1a73e855; }
.sheet .box.sel { box-shadow: 0 0 0 2px #d93025; }
.sheet .nvc { position: absolute; width: 28px; height: 28px; padding: 0; border: 1px solid #888; border-radius: 2px; background: #fffffff0; color: #222; font: 9px/1 "Segoe UI", sans-serif; overflow: hidden; }
.sheet .nvc.sel { box-shadow: 0 0 0 2px #d93025; }
.noicons .nvc { display: none; }
.note { margin: 12px 20px 0; padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 5px; white-space: pre-wrap; }
.note.bad { border-color: var(--acc); }
.report { margin: 20px; } .report h3 { margin: 0 0 6px; font-size: 13px; color: #fff; } .report img { display: block; background: #fff; box-shadow: 0 1px 3px #0005; }

table { border-collapse: collapse; width: 100%; table-layout: fixed; }
td { border-bottom: 1px solid var(--line); padding: 2px 8px; vertical-align: top; overflow-wrap: anywhere; white-space: pre-wrap; }
td:first-child { width: 44%; color: var(--dim); } tr.own td:first-child { color: var(--text); }
td .clip { max-height: 160px; overflow: auto; }

.code { display: grid; grid-template-columns: auto 1fr; font: 13px/1.5 Consolas, "Cascadia Mono", monospace; tab-size: 2; min-width: max-content; }
.code pre { margin: 0; padding: 10px 14px; } .code .ln { color: var(--dim); text-align: right; user-select: none; border-right: 1px solid var(--line); }
.k { color: var(--kw); font-weight: 600; } .s { color: var(--str); } .c { color: var(--com); font-style: italic; } .n { color: var(--num); }

body.login { display: grid; place-items: center; min-height: 100vh; }
body.login form { display: grid; gap: 10px; width: min(320px, calc(100vw - 32px)); padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
body.login h1 { margin: 0 0 6px; font-size: 20px; color: var(--acc); }
body.login input { padding: 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); }
body.login p { margin: 0; color: var(--acc); min-height: 1.4em; }

.only-narrow { display: none; }
@media (max-width: 900px) {
  .only-narrow { display: block; }
  body.ide { grid-template: auto minmax(0, 1fr) minmax(0, 40vh) / minmax(0, 1fr); }
  nav { position: fixed; inset: 42px auto 0 0; width: min(290px, 85vw); z-index: 5; transform: translateX(-101%); }
  body.open nav { transform: none; box-shadow: 0 0 20px #0006; }
  aside { border-left: 0; border-top: 1px solid var(--line); flex-direction: row; }
  .half { min-width: 0; } .half + .half { border-top: 0; border-left: 1px solid var(--line); }
  .tabs { flex-wrap: wrap; } #status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
