/* dumphacker — public hex editor (/hex). Vanilla CSS, pairs with public/js/hexeditor.js */
.hx { --row-h: 22px; --diff-bg: #fde68a; --diff-fg: #78350f; --mod-bg: #bfdbfe; --mod-fg: #1e3a8a;
      --sel-bg: #c7d2fe; --cur-bg: #1d4ed8; --cur-fg: #fff; --find-bg: #a7f3d0;
      font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
      color: #0f172a; display: flex; flex-direction: column; height: 100%; min-height: 0; }
.hx * { box-sizing: border-box; }
.hx button { font: inherit; cursor: pointer; }

/* ---------- toolbar ---------- */
.hx-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; background: #fff;
          border-bottom: 1px solid #e2e8f0; position: relative; z-index: 5; }
.hx-bar .sep { width: 1px; height: 22px; background: #e2e8f0; margin: 0 4px; }
.hx-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border-radius: 8px; border: 1px solid #cbd5e1;
          background: #fff; color: #0f172a; font-size: 13px; font-weight: 600; white-space: nowrap; }
.hx-btn:hover { background: #f1f5f9; }
.hx-btn:disabled { opacity: .45; cursor: default; }
.hx-btn.primary { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.hx-btn.primary:hover { background: #1e40af; }
.hx-btn.on { background: #ecfdf5; border-color: #34d399; color: #065f46; }
.hx-btn.off { background: #fff1f2; border-color: #fda4af; color: #9f1239; }
.hx-btn .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.hx-btn.icon { padding: 0 9px; }
.hx-count { font-size: 13px; color: #475569; white-space: nowrap; }
.hx-count b { color: #0f172a; }
.hx-menu { position: relative; }
.hx-menu-list { position: absolute; top: 36px; left: 0; min-width: 230px; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
                box-shadow: 0 10px 30px rgba(15,23,42,.12); padding: 6px; display: none; z-index: 20; }
.hx-menu.open .hx-menu-list { display: block; }
.hx-menu-list button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 7px; font-size: 13px; }
.hx-menu-list button:hover { background: #f1f5f9; }
.hx-menu-list button small { display: block; color: #64748b; font-weight: 400; }
.hx-menu-list hr { border: 0; border-top: 1px solid #e2e8f0; margin: 5px 0; }

/* ---------- popover forms (go to / find / fill) ---------- */
.hx-pop { display: none; align-items: center; gap: 6px; flex-wrap: wrap; width: 100%; padding: 8px 10px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.hx-pop.open { display: flex; }
.hx-pop label { font-size: 12px; color: #475569; font-weight: 600; }
.hx-pop input[type=text] { height: 32px; padding: 0 10px; border: 1px solid #cbd5e1; border-radius: 8px; font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; min-width: 180px; }
.hx-pop input[type=text]:focus { outline: 2px solid #93c5fd; border-color: #60a5fa; }
.hx-pop .hint { font-size: 12px; color: #64748b; }
.hx-pop .msg { font-size: 12px; color: #9f1239; font-weight: 600; }
.hx-pop select { height: 32px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 13px; padding: 0 6px; background: #fff; }

/* ---------- main area ---------- */
.hx-main { display: flex; flex: 1; min-height: 0; }
.hx-panes { display: flex; flex: 1; min-width: 0; overflow-x: auto; overflow-y: hidden; }
.hx-pane { display: flex; flex-direction: column; flex: 1 0 0; min-width: 640px; border-right: 1px solid #e2e8f0; background: #fff; }
.hx-pane:last-child { border-right: 0; }
.hx-pane-head { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid #e2e8f0; background: #f8fafc; font-size: 12px; min-height: 40px; }
.hx-tag { font-weight: 800; font-size: 11px; width: 22px; height: 22px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.hx-pane-name { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hx-pane-meta { color: #64748b; white-space: nowrap; }
.hx-pane-meta code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; }
.hx-badge { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.hx-badge.ok { background: #d1fae5; color: #065f46; }
.hx-badge.wait { background: #e2e8f0; color: #334155; }
.hx-badge.fail { background: #fee2e2; color: #991b1b; }
.hx-badge.mod { background: #dbeafe; color: #1e3a8a; }
.hx-pane-head .grow { flex: 1; min-width: 0; }
.hx-xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 6px; }

.hx-view { flex: 1; min-height: 0; overflow: auto; position: relative; outline: none;
           font: 13px/var(--row-h) ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; background: #fff; }
.hx-view:focus { box-shadow: inset 0 0 0 2px #bfdbfe; }
.hx-spacer { width: 1px; }
.hx-rows { position: absolute; top: 0; left: 0; right: 0; will-change: transform; }
.hx-row { display: flex; height: var(--row-h); white-space: nowrap; padding-left: 10px; }
.hx-row:hover { background: #f8fafc; }
.hx-off { color: #64748b; width: 10ch; flex: none; user-select: none; }
.hx-hex { display: flex; flex: none; }
.hx-asc { display: flex; flex: none; margin-left: 16px; color: #334155; }
.hb { display: inline-block; width: 2ch; text-align: center; border-radius: 3px; cursor: text; margin-right: 1ch; }
.hb.g8 { margin-right: 2ch; }
.hb.w16 { margin-right: 0; }
.hb.w16o { margin-right: 1ch; }
.ab { display: inline-block; width: 1ch; text-align: center; border-radius: 2px; cursor: text; }
.hb.d, .ab.d { background: var(--diff-bg); color: var(--diff-fg); }
.hb.m, .ab.m { background: var(--mod-bg); color: var(--mod-fg); font-weight: 700; }
.hb.f, .ab.f { background: var(--find-bg); }
.hb.s, .ab.s { background: var(--sel-bg); color: #1e1b4b; }
.hb.c, .ab.c { background: var(--cur-bg); color: var(--cur-fg); }
.hb.c.half { box-shadow: inset 0 0 0 2px #f59e0b; }
.hx-view.col-asc .hb.c { background: #93c5fd; color: #1e3a8a; }
.hx-view:not(.col-asc) .ab.c { background: #93c5fd; color: #1e3a8a; }
.hx-row.pastend .hb, .hx-row.pastend .ab { color: #cbd5e1; cursor: default; }
.hx-empty { padding: 40px 20px; color: #64748b; font-size: 13px; }

/* drop zone (no files yet) */
.hx-drop { flex: 1; display: flex; align-items: center; justify-content: center; padding: 30px; }
.hx-drop-box { max-width: 560px; width: 100%; border: 2px dashed #cbd5e1; border-radius: 18px; padding: 40px 28px; text-align: center; background: #fff; transition: .15s; }
.hx-drop-box.over, .hx.dragover .hx-drop-box { border-color: #2563eb; background: #eff6ff; }
.hx-drop-box h2 { margin: 0 0 6px; font-size: 20px; font-weight: 800; }
.hx-drop-box p { margin: 0 0 16px; color: #64748b; font-size: 14px; }
.hx-drop-box .fine { font-size: 12px; color: #94a3b8; margin-top: 14px; }
.hx-drop-box .fine b { color: #64748b; }
.hx-drop-overlay { position: absolute; inset: 0; background: rgba(37,99,235,.08); border: 3px dashed #2563eb; display: none; z-index: 30; pointer-events: none; }
.hx.dragover .hx-drop-overlay { display: block; }

/* ---------- side panel ---------- */
.hx-side { width: 300px; flex: none; border-left: 1px solid #e2e8f0; background: #f8fafc; overflow-y: auto; font-size: 12px; }
.hx-side.hidden { display: none; }
.hx-sec { padding: 10px 12px; border-bottom: 1px solid #e2e8f0; }
.hx-sec h3 { margin: 0 0 6px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #64748b; display: flex; align-items: center; gap: 6px; }
.hx-sec h3 .hx-xs { margin-left: auto; }
.hx-kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; }
.hx-kv span { color: #64748b; }
.hx-kv code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: #0f172a; word-break: break-all; }
.hx-kv code.dim { color: #94a3b8; }
.hx-regions { max-height: 46vh; overflow: auto; margin: 6px -4px 0; }
.hx-region { display: grid; grid-template-columns: 9ch 1fr; gap: 0 8px; align-items: baseline; width: 100%; padding: 5px 6px; border: 0; background: none; text-align: left; border-radius: 6px;
             font: 12px ui-monospace, Menlo, Consolas, monospace; color: #0f172a; }
.hx-region:hover { background: #e2e8f0; }
.hx-region.cur { background: #fde68a; }
.hx-region .ab2 { color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; grid-column: 1 / -1; font-size: 11px; }
.hx-region .ab2 b { color: #78350f; font-weight: 600; }
.hx-note { color: #64748b; font-size: 11px; margin-top: 6px; }
.hx-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 6px; }
.hx-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }

/* ---------- status bar ---------- */
.hx-status { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center; padding: 5px 12px; background: #0f172a; color: #cbd5e1; font-size: 12px; min-height: 30px; }
.hx-status b { color: #fff; font-weight: 600; font-family: ui-monospace, Menlo, Consolas, monospace; }
.hx-status .right { margin-left: auto; color: #94a3b8; }
.hx-toast { position: fixed; left: 50%; bottom: 48px; transform: translateX(-50%); background: #0f172a; color: #fff; padding: 9px 14px; border-radius: 10px; font-size: 13px; z-index: 50; opacity: 0; transition: .2s; pointer-events: none; }
.hx-toast.show { opacity: 1; }

@media (max-width: 760px) {
  .hx-side { position: absolute; right: 0; top: 0; bottom: 0; z-index: 10; box-shadow: -8px 0 24px rgba(15,23,42,.15); }
  .hx-main { position: relative; }
  .hx-pane { min-width: 560px; }
  .hx-btn { height: 34px; }
}
