* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 12px/1.4 system-ui, -apple-system, sans-serif;
  color: #222;
  background: #f2f2f2;
}
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.small { font-size: 11px; }
.muted { color: #777; }

#app { display: flex; flex-direction: column; height: 100%; }

/* toolbar */
#toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: #e9e9e9;
  border-bottom: 1px solid #c9c9c9;
  flex: 0 0 auto;
  user-select: none;
}
#toolbar label { display: inline-flex; align-items: center; gap: 4px; }
#toolbar .sep { width: 1px; height: 18px; background: #c9c9c9; margin: 0 4px; }
#zoom-label { min-width: 48px; text-align: center; }
#file-name { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* main split */
#main { display: flex; flex: 1 1 auto; min-height: 0; }

/* canvas area */
#wrap {
  position: relative; flex: 1 1 auto; min-width: 0; overflow: hidden;
  background:
    repeating-conic-gradient(#e4e4e4 0% 25%, #f4f4f4 0% 50%) 0 0 / 16px 16px;
}
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* force painted-geometry hit-testing even if the source disables pointer events;
   page-level CSS only — the copied markup itself is never modified */
#stage * { pointer-events: visiblePainted !important; }
#wrap.dimmed #stage > svg { opacity: 0.22; }
#overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

#dropzone {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: #f2f2f2;
}
#dropzone.hidden { display: none; }
#dropzone.dragging #drop-inner { border-color: #1a73e8; }
#drop-inner {
  border: 2px dashed #bbb; border-radius: 4px; padding: 32px 48px; text-align: center;
  background: #fafafa;
}
#drop-msg.error { color: #c5221f; }

/* side panel */
#side {
  flex: 0 0 380px; display: flex; flex-direction: column; min-height: 0;
  background: #fbfbfb; border-left: 1px solid #c9c9c9;
}
#side section { display: flex; flex-direction: column; min-height: 0; border-bottom: 1px solid #ddd; }
#side h2 {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: #555; margin: 0; padding: 6px 10px 4px;
  display: flex; align-items: center; justify-content: space-between;
  flex: 0 0 auto;
}
#analysis { flex: 0 0 auto; max-height: 30%; }
#stats { padding: 0 10px 4px; color: #444; flex: 0 0 auto; }
#findings { margin: 0; padding: 0 10px 8px 10px; list-style: none; overflow: auto; }
#findings li { padding: 2px 0 2px 16px; position: relative; font-size: 11px; }
#findings li::before { content: ''; position: absolute; left: 2px; top: 7px; width: 7px; height: 7px; border-radius: 50%; }
#findings li.warn::before { background: #e8a33d; }
#findings li.info::before { background: #9ac2f0; }

#treewrap { flex: 1 1 auto; }
#tree { overflow: auto; flex: 1 1 auto; padding: 2px 0 8px; font-size: 11px; }
.row { display: flex; align-items: baseline; gap: 5px; padding: 1px 8px 1px 0; cursor: default; white-space: nowrap; }
.row:hover, .row.hover { background: #dbe9fb; }
.row.selected { background: #fce8e6; }
.row.selected.hover { background: #f6d4d0; }
.chev { display: inline-block; width: 10px; text-align: center; color: #999; cursor: pointer; flex: 0 0 auto; }
.tag { font-weight: 600; }
.tag.cat-path   { color: #1a56a8; }
.tag.cat-shape  { color: #0b7285; }
.tag.cat-g      { color: #555; }
.tag.cat-text   { color: #7b2ff2; }
.tag.cat-image  { color: #d9640a; }
.tag.cat-use    { color: #12805c; }
.tag.cat-defs   { color: #999; }
.tag.cat-other  { color: #444; }
.eid { color: #a05a00; }
.attrs { color: #888; overflow: hidden; text-overflow: ellipsis; }
.swatch {
  display: inline-block; width: 9px; height: 9px; border: 1px solid #0003;
  vertical-align: baseline; flex: 0 0 auto; align-self: center;
}

#detail { flex: 0 0 auto; max-height: 34%; border-bottom: none; }
#detail-body { overflow: auto; padding: 0 10px 8px; }
#detail-body table { border-collapse: collapse; width: 100%; }
#detail-body td { padding: 1px 6px 1px 0; vertical-align: top; font-family: ui-monospace, Menlo, monospace; font-size: 11px; }
#detail-body td.k { color: #1a56a8; white-space: nowrap; }
#detail-body td.v { word-break: break-all; color: #333; }
#detail-body .sect { margin: 6px 0 2px; font-weight: 600; color: #555; }
#btn-copy { font-size: 10px; }

/* status bar */
#status {
  flex: 0 0 auto; display: flex; gap: 16px; align-items: center;
  padding: 3px 10px; background: #e9e9e9; border-top: 1px solid #c9c9c9;
  user-select: none; min-height: 22px;
}
#coords { min-width: 220px; color: #555; }
#crumb { color: #555; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#crumb .crumb-el { cursor: pointer; }
#crumb .crumb-el:hover { text-decoration: underline; }
#crumb .crumb-sep { color: #aaa; margin: 0 3px; }
