:root{
  --bg0: #0b0f14;
  --bg1: #0f1620;
  --card: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.10);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.65);
}

*{ font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }

.app-body{
  background: radial-gradient(1200px 600px at 30% -10%, rgba(60,130,246,0.18), transparent 60%),
              radial-gradient(800px 500px at 90% 0%, rgba(255,193,7,0.10), transparent 55%),
              linear-gradient(180deg, var(--bg0), var(--bg1));
  color: var(--text);
  min-height: 100vh;
}

.app-nav{
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

/* .app-shell{
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: calc(100vh - 56px);
} */

@media (max-width: 992px){
  .app-shell{ grid-template-columns: 1fr; }
  .app-left{ display: none; }
}

/* .app-left{
  border-right: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(10px);
} */

.app-main{
  min-width: 0;
}

.app-toolbar{
  background: rgba(11,15,20,0.65);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border) !important;
  z-index: 10;
}

.card{
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
}

.text-secondary{ color: var(--muted) !important; }
.mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; }

.img-stage{
  width: 100%;
  aspect-ratio: 4 / 3;
  background: rgba(0,0,0,0.30);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  cursor: grab;
}
.img-stage:active{ cursor: grabbing; }

.pair-img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
}

.app-tree{
  overflow: auto;
  height: calc(100vh - 56px - 74px);
  padding-bottom: 24px;
}

.tree-node{ margin-left: 6px; }
.tree-header{
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 12px;
  cursor: pointer;
}
.tree-header:hover{
  background: rgba(255,255,255,0.06);
}
.tree-caret{
  width: 18px;
  display: inline-flex;
  justify-content: center;
  color: rgba(255,255,255,0.70);
}
.tree-title{
  font-size: 0.92rem;
  color: rgba(255,255,255,0.85);
}

.tree-children{
  margin-left: 18px;
  border-left: 1px dashed rgba(255,255,255,0.15);
  padding-left: 10px;
}

.tree-leaf{
  display: block;
  padding: 6px 10px;
  margin: 4px 0;
  border-radius: 12px;
  text-decoration: none;
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18);
}
.tree-leaf:hover{
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.18);
}
.tree-leaf.active{
  background: rgba(60,130,246,0.18);
  border-color: rgba(60,130,246,0.45);
  color: rgba(255,255,255,0.95);
}
.tree-status{
  margin-left: auto;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.80);
  background: rgba(255,255,255,0.06);
  white-space: nowrap;
}

.tree-status.complete{
  border-color: rgba(60, 200, 120, 0.55);
  background: rgba(60, 200, 120, 0.14);
}

.tree-status.incomplete{
  border-color: rgba(255, 193, 7, 0.45);
  background: rgba(255, 193, 7, 0.12);
}
.tree-leaf{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tree-leaf-text{
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaf-status{
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.80);
  background: rgba(255,255,255,0.06);
  white-space: nowrap;
  flex: 0 0 auto;
}

.leaf-status.visited{
  border-color: rgba(60, 200, 120, 0.55);
  background: rgba(60, 200, 120, 0.14);
}

.leaf-status.unvisited{
  border-color: rgba(255, 193, 7, 0.45);
  background: rgba(255, 193, 7, 0.12);
}

/* optional: subtle styling for visited rows */
.tree-leaf.is-visited{
  opacity: 0.92;
}

.app-shell{
  display: flex;
  height: calc(100vh - var(--topbar-h, 56px)); /* adjust if you have a top bar */
  min-height: 0;
}

/* Left panel */
.app-left{
  width: 340px;          /* default */
  min-width: 220px;      /* clamp */
  max-width: 85vw;      /* clamp */
  flex: 0 0 auto;
  min-height: 0;
}

/* The draggable bar */
.splitter{
  width: 8px;
  cursor: col-resize;
  flex: 0 0 auto;
  position: relative;
}

/* Make it easy to grab (a visible line) */
.splitter::before{
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 2px;
  height: 100%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.10);
}

.splitter:hover::before{
  background: rgba(255,255,255,0.25);
}

/* Right panel */
.app-main{
  flex: 1 1 auto;
  min-width: 0;          /* important so it can shrink properly */
  min-height: 0;
}

/* During drag, prevent selecting text/images */
body.resizing,
body.resizing *{
  user-select: none !important;
  cursor: col-resize !important;
}

.result-badge{
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.90);
  min-width: 220px;
  text-align: center;
}

.result-badge.is-violation{
  background: rgba(220, 53, 69, 0.20);
  border-color: rgba(220, 53, 69, 0.55);
}

.result-badge.is-suspected{
  background: rgba(255, 193, 7, 0.18);
  border-color: rgba(255, 193, 7, 0.55);
}

.result-badge.is-none{
  opacity: 0.75;
}
