:root { --b:#e5e7eb; --muted:#6b7280; --gray100:#f3f4f6; }

.dgx-shell { font-family: system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif; max-width:1400px; margin:0 auto; }
.dgx-row { display:flex; gap:18px; align-items:flex-start; }

.panel { background:#fff; border:1px solid var(--b); border-radius:14px; box-shadow:0 1px 2px rgba(0,0,0,.04); }
.pad   { padding:10px; }

#hed-app button { padding:4px 8px; font-size:11px; line-height:1.1; border-radius:8px; cursor:pointer; }
.btn { border:1px solid #111; background:#fff; color:#000; }
.btn-dark { background:#111; color:#fff; border:1px solid #111; }

.hed-menu { flex:0 0 28%; max-width:28%; min-width:260px; }
.hed-head { display:flex; flex-direction:column; gap:6px; align-items:flex-start; margin-bottom:2px; }
.hed-title { margin:0; font-size:18px; }
.hed-fs-btns { display:flex; gap:6px; flex-wrap:wrap; }
.hed-subtle { margin:8px 0 10px; color:#6b7280; font-size:12px; }

.hed-status {
  display:none; margin:8px 0; padding:8px 10px; border-radius:8px;
  background:#fff3cd; border:1px solid #ffe08a; color:#7a5b00; font-size:12px;
}

.hed-uploader { border:2px dashed #d1d5db; border-radius:12px; padding:10px; text-align:center; background:#fff; margin-bottom:10px; }
.hed-uploader-note { font-size:11px; color:#777; margin:6px 0 0; }

.hed-block { margin-top:8px; }
.hed-block-title { font-weight:600; font-size:12px; }
.hed-label { display:block; font-size:12px; margin:6px 0 2px; }
.hed-select, .hed-input { width:100%; padding:6px; border:1px solid #d1d5db; border-radius:8px; font-size:12px; font-weight:400; }
.hed-range { width:100%; }
.hed-toggles { margin-top:8px; display:flex; gap:10px; align-items:center; font-size:12px; flex-wrap:wrap; }

.hed-acc { border:1px solid #e5e7eb; border-radius:10px; background:#fff; margin-top:12px; }
.hed-acc summary {
  list-style:none; cursor:pointer; padding:10px 12px; font-weight:600; font-size:12px; color:#374151; background:#f3f4f6; border-radius:10px;
  display:flex; align-items:center; justify-content:space-between;
}
.hed-acc summary::-webkit-details-marker { display:none; }
.hed-acc .hed-acc-body { border-top:1px dashed #e5e7eb; padding:10px 12px 12px; }
.hed-acc .caret { transition:transform .2s ease; color:#6b7280; }
.hed-acc[open] .caret { transform:rotate(90deg); }

.acc { border:1px solid var(--b); border-radius:10px; background:var(--gray100); }
.acc summary{
  list-style:none; cursor:pointer; padding:10px 12px; font-weight:600; font-size:13px;
  display:flex; align-items:center; justify-content:space-between; background:var(--gray100); border-radius:10px;
}
.acc summary::-webkit-details-marker{ display:none; }
.acc .caret{ transition:transform .2s ease; }
.acc[open] .caret{ transform:rotate(90deg); }
.acc .acc-body{ padding:10px 12px 12px; border-top:1px dashed var(--b); background:var(--gray100); border-radius:0 0 10px 10px; }

.hed-info { background:#fff; border:1px solid var(--b); border-radius:10px; padding:10px; font-size:12px; color:#444; line-height:1.6; }

.hed-actions { margin-top:12px; display:flex; gap:8px; flex-wrap:wrap; }
.hed-roi-list { font-size:12px; color:#444; margin-top:6px; max-height:160px; overflow:auto; border:1px solid #eee; border-radius:8px; padding:6px; }

#hed-tools{
  flex:0 0 64px; max-width:64px; min-width:54px; background:#ebefe7; border:1px solid var(--b); border-radius:14px; padding:8px;
  display:flex; flex-direction:column; align-items:center; gap:8px; height:auto; overflow:auto;
}
#hed-tools .tool-stack{ display:flex; flex-direction:column; gap:8px; width:100%; align-items:center; }
#hed-tools .tool-btn{
  display:inline-flex; align-items:center; justify-content:center; width:36px; aspect-ratio:1/1;
  border:1px solid #d4d4d4; background:#e5e5e5; border-radius:10px; cursor:pointer; font-size:16px; user-select:none;
}
#hed-tools .tool-btn.active{ background:#888; color:#ffe8b6; border-color:#ffe8b6; }
#hed-tools .tool-btn .icon{ width:20px; height:20px; display:block; }

.hed-right { flex:1 1 auto; max-width:72%; }
.hed-stage { position:relative; width:100%; max-width:100%; margin:0 auto; user-select:none; touch-action:none; background:#f9fafb; overflow:hidden; min-height:360px; }
.hed-layers { position:absolute; inset:0; transform-origin:0 0; }
.hed-layer { position:absolute; inset:0; width:100%; height:100%; }

.hed-handle { position:absolute; top:0; height:100%; width:2px; background:#111; cursor:ew-resize; touch-action:none; }
.hed-handle-dot { position:absolute; top:50%; transform:translate(-50%,-50%); left:0; width:20px; height:20px; border-radius:50%; background:#111; border:3px solid #fff; box-shadow:0 1px 2px rgba(0,0,0,.3); }

.hed-bottom-grid { display:grid; grid-template-columns: 1fr 1.15fr; gap:16px; align-items:start; }
@media (max-width:980px){ .hed-bottom-grid { grid-template-columns: 1fr; } }

.hed-view-row { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-bottom:10px; }
.hed-pan-label { font-size:12px; margin-left:auto; }
.hed-cropbox { border-top:1px dashed var(--b); padding-top:10px; }
.hed-croplab { font-weight:600; font-size:12px; margin-bottom:6px; }
.hed-cropbtns { display:flex; gap:8px; flex-wrap:wrap; }
.hed-crop-info { font-size:12px; color:#444; margin-top:6px; }

/* NEW: Drawbar is its own panel with slightly smaller text */
#hed-drawbar-panel { margin-bottom:14px; }
.hed-drawbar { display:flex; gap:8px; align-items:center; flex-wrap:wrap; font-size:11px; }
.hed-drawbar label { display:inline-flex; gap:6px; align-items:center; }
.hed-drawbar select, .hed-drawbar input[type="number"]{
  padding:4px 6px; border:1px solid #d1d5db; border-radius:8px; font-size:11px; min-width:56px; font-weight:400;
}
#hed-top-crop-apply { color:#000; } /* top Apply Crop text black */

/* View & Crop nuance */
#hed-acc-viewcrop .acc-body button{ background:#fff; color:#000; border:1px solid #111; }
#hed-acc-viewcrop #hed-zoom-toggle.active,
#hed-acc-viewcrop #hed-crop-apply{ background:#000; color:#fff; border-color:#000; }

/* Fullscreen (CSS) */
.hed-fs{
  position: fixed !important; inset: 0 !important; width: 100vw !important; height: 100vh !important; max-width: 100vw !important;
  margin: 0 !important; padding: 12px !important; z-index: 9999 !important; background: #fff !important;
}
.hed-fs > .dgx-row { height: calc(100vh - 24px); }
.hed-fs #hed-menu{ height:100%; overflow:auto; }
.hed-fs #hed-tools{ height:100%; }
.hed-fs #hed-right{ height:100%; display:flex; flex-direction:column; }
.hed-fs #hed-stage{ flex:0 0 auto; height:auto !important; min-height:0; }
.hed-fs #hed-layers, .hed-fs #hed-base, .hed-fs #hed-proc, .hed-fs #hed-crop, .hed-fs #hed-anno, .hed-fs #hed-roi { width:100% !important; height:100% !important; }

/* --- FIX: keep the stage tall enough in Expand (CSS) mode --- */
.hed-fs #hed-stage{
  /* restore a visible height so canvases can render */
  min-height: 360px !important;   /* same baseline as normal mode */
  /* keep height:auto so layout can grow if JS adjusts things */
  height: auto;                    /* no !important: don't fight future inline sizes */
}
