:root {
  --bg: #f4f5f6; --panel: #fff; --line: #d6d9dc; --ink: #1d2125; --muted: #6b7279; --accent: #2a6f97;
  --accent-ink: #fff; --danger: #b3261e; --ok: #2e7d32; --warn: #a15c00; --sel: #ffe08a;
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
h2, h3, h4 { margin: .2em 0 .5em; } h2 { font-size: 18px; } h3 { font-size: 15px; } h4 { font-size: 13px; margin-top: 1em; }
button { font: inherit; padding: 4px 10px; border: 1px solid var(--line); background: #fbfbfc; border-radius: 4px; cursor: pointer; color: var(--ink); }
button:hover:not(:disabled) { border-color: #9aa1a8; } button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
input, select { font: inherit; padding: 4px 6px; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink); }
.muted { color: var(--muted); } .center { text-align: center; } .error { color: var(--danger); white-space: pre-line; }
.grow { flex: 1; } .row { display: flex; gap: 8px; align-items: center; margin: 6px 0; flex-wrap: wrap; } .sep { width: 12px; }
[hidden] { display: none !important; }

#navTop { display: flex; align-items: center; gap: 18px; padding: 8px 16px; background: #23292f; color: #e8eaec; }
#navTop .brand { font-weight: 700; letter-spacing: .5px; }
#navTop nav { display: flex; gap: 4px; flex: 1; }
#navTop nav a { color: #c9ced3; text-decoration: none; padding: 4px 10px; border-radius: 4px; }
#navTop nav a.active { background: #3a434c; color: #fff; }
#userBox { display: flex; gap: 8px; align-items: center; } #userBox button { padding: 2px 8px; }
body:not(.is-user) .reg, body:not(.is-admin) .adm { display: none !important; }

.view { display: none; padding: 12px 16px; flex: 1; min-height: 0; } .view.active { display: flex; flex-direction: column; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 16px; }
.auth { display: flex; gap: 16px; justify-content: center; margin-top: 30px; flex-wrap: wrap; }
.auth form { width: 300px; display: flex; flex-direction: column; gap: 10px; } .auth label { display: flex; flex-direction: column; gap: 3px; }
.bar { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }

table.grid { border-collapse: collapse; background: var(--panel); width: 100%; }
table.grid th, table.grid td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; white-space: nowrap; }
table.grid th { background: #eceef0; font-weight: 600; }
.storage { display: flex; align-items: center; gap: 8px; } #barStorage { width: 180px; height: 10px; background: #e3e6e8; border-radius: 5px; overflow: hidden; }
#barStorage div { height: 100%; width: 0; background: var(--accent); }

.toolbar { display: flex; gap: 4px; align-items: center; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px 6px 0 0; flex-wrap: wrap; }
.empty { text-align: center; padding: 60px 20px; background: var(--panel); border: 1px solid var(--line); border-top: 0; }
.editor { display: grid; grid-template-columns: 220px 1fr 260px; flex: 1; min-height: 0; border: 1px solid var(--line); border-top: 0; background: var(--panel); }
.editor aside { padding: 8px; overflow: auto; } .editor .left { border-right: 1px solid var(--line); } .editor .right { border-left: 1px solid var(--line); }
#txtMapSearch { width: 100%; }
#lstMaps { list-style: none; padding: 0; margin: 6px 0; } #lstMaps .cat { font-size: 11px; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
#lstMaps li.map { padding: 3px 6px; border-radius: 4px; cursor: pointer; } #lstMaps li.map:hover { background: #eef2f5; }
#lstMaps li.map small { display: block; color: var(--muted); font-size: 11px; }
.center { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tabs { display: flex; gap: 2px; padding: 6px 6px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { border-radius: 4px 4px 0 0; border-bottom: 0; } .tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tab .x { margin-left: 6px; opacity: .7; }
.pane { padding: 8px; overflow: auto; flex: 1; min-height: 0; }
.hex { font: 12.5px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace; white-space: pre; user-select: none; }
.hex .a { color: var(--muted); } .hex b { font-weight: normal; padding: 0 1px; cursor: pointer; border-radius: 2px; }
.hex b.ch { background: #ffd4cc; } .hex b.cur { outline: 2px solid var(--accent); } .hex b.hit { background: var(--sel); } .hex .asc { color: #555; }
.editbar input { width: 110px; }
.mapwrap { overflow: auto; max-height: 52vh; }
#tblMap { border-collapse: collapse; font: 12px ui-monospace, Consolas, monospace; user-select: none; }
#tblMap td, #tblMap th { border: 1px solid #fff; padding: 2px 5px; text-align: right; min-width: 46px; }
#tblMap th { background: #e7eaed; position: sticky; top: 0; } #tblMap th.yh { position: sticky; left: 0; }
#tblMap td.mod { outline: 2px solid #222; outline-offset: -2px; font-weight: 600; } #tblMap td.sel { box-shadow: inset 0 0 0 3px var(--sel); }
#plot3d { height: 340px; margin-top: 8px; }
details { margin-bottom: 8px; } summary { font-weight: 600; cursor: pointer; }
#pnlProperties dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; margin: 6px 0; font-size: 12.5px; } #pnlProperties dt { color: var(--muted); }
#pnlChanges, #pnlVersions { list-style: none; padding: 0; margin: 6px 0; font-size: 12.5px; max-height: 220px; overflow: auto; }
#pnlChanges li, #pnlVersions li { padding: 3px 0; border-bottom: 1px dashed var(--line); }
#barStatus { display: flex; gap: 18px; padding: 4px 10px; font-size: 12px; background: #e9ecee; border: 1px solid var(--line); border-top: 0; }
#barStatus .warn { color: var(--warn); } .ok { color: var(--ok); } .bad { color: var(--danger); }

.logs { display: flex; gap: 12px; height: calc(100vh - 70px); min-height: 480px; } .logs aside { width: 280px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px; overflow: auto; }
.logs > .grow { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px; display: flex; flex-direction: column; min-width: 0; }
#lstLogs, #lstChannels { list-style: none; padding: 0; margin: 4px 0 10px; }
#lstLogs li { padding: 5px; border-radius: 4px; cursor: pointer; } #lstLogs li.active { background: #e2ecf3; } #lstLogs li small { display: block; color: var(--muted); }
#lstChannels li label { display: flex; gap: 6px; align-items: center; font-size: 12.5px; }
#plotLog { flex: 1; min-height: 300px; }

.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px; } .kpi span { display: block; color: var(--muted); font-size: 12px; } .kpi b { font-size: 20px; }
#plotDisk { height: 260px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.usage { display: inline-block; width: 90px; height: 8px; background: #e3e6e8; border-radius: 4px; vertical-align: middle; margin-right: 6px; } .usage i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

dialog { border: 1px solid var(--line); border-radius: 8px; padding: 18px; max-width: 760px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(20, 24, 28, .35); }
.cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; } .cols label { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; } .cols .wide { grid-column: span 3; }
#dlgDelete label { display: flex; flex-direction: column; gap: 4px; } #txtPrompt { width: 100%; }
#txtReport table { border-collapse: collapse; width: 100%; font-size: 12.5px; } #txtReport td, #txtReport th { border-bottom: 1px solid var(--line); padding: 3px 6px; text-align: left; }
#toast { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 6px; z-index: 10; }
#toast div { background: #23292f; color: #fff; padding: 8px 12px; border-radius: 6px; max-width: 420px; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
#toast div.err { background: var(--danger); }
@media (max-width: 1000px) { .editor { grid-template-columns: 1fr; } .editor .left, .editor .right { border: 0; border-bottom: 1px solid var(--line); } .kpis { grid-template-columns: repeat(2, 1fr); } .logs { flex-direction: column; } .logs aside { width: auto; } }
