/* Editable mode: the drawing beside the model (drawing-pane.js) and the edit strip of a double-clicked element (edit-in-place.js).
   Eddy 2026-11-22. Glass panes in the --rg-* colours of editable-glass.css, so they read in light and dark and in all six tones. */
.dwg-pane, .ip-bar { display: none; }
@media (min-width: 701px) {
  body.v8-revit { --dwg-w: calc((100vw - var(--rv-left) - 24px) * .46); }
  body.v8-revit.v8-dwg-open .layout,
  :root[data-rv-tone] body.v8-revit.v8-dwg-open .layout { right: calc(var(--dwg-w) + 16px) !important; }

  body.v8-revit.v8-dwg-open .dwg-pane:not([hidden]) {
    display: flex; flex-direction: column; position: fixed; right: 8px; width: var(--dwg-w); z-index: 19; box-sizing: border-box;
    --dwg-paper: var(--rg-canvas, #fff); --dwg-ink: var(--rv-text, #1d1d1f); --dwg-accent: var(--rg-a, #7a5a0c); --dwg-tint: rgba(122, 90, 12, .14);
    background: var(--rg-pane, rgba(255, 255, 255, .6)); border: 1px solid var(--rg-edge, rgba(255, 255, 255, .95)); border-radius: 14px; overflow: clip;
    backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4); box-shadow: var(--rg-shadow, 0 8px 24px rgba(0, 0, 0, .1));
    color: var(--rv-text, #1d1d1f); font: 12px var(--dv-font, Inter, system-ui, sans-serif);
  }
  :root[data-rv-dark] body.v8-revit .dwg-pane { --dwg-tint: rgba(243, 213, 140, .16); }
  .dwg-head, .dwg-tools { display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-bottom: 1px solid var(--rg-line, rgba(0, 0, 0, .1)); flex: none; min-width: 0; }
  .dwg-views { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .dwg-pane button { font: inherit; color: inherit; cursor: pointer; }
  .dwg-pane .dwg-chip { border: 0; border-radius: 999px; padding: 4px 11px; background: transparent; color: var(--rg-mute, #6e6e73) !important; white-space: nowrap; }
  .dwg-pane .dwg-chip[aria-pressed=true], .dwg-pane .dwg-chip[aria-pressed=true]:hover { background: var(--rg-sel, rgba(0, 0, 0, .06)); color: var(--rg-a, #7a5a0c) !important; font-weight: 600; }
  .dwg-level { flex: none; max-width: 120px; border: 1px solid var(--rg-line, rgba(0, 0, 0, .1)); border-radius: 8px; background: var(--rg-field, #fff); color: inherit; padding: 3px 6px; font: inherit; }
  .dwg-pane .dwg-icon { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 999px; background: transparent; }
  .dwg-icon svg { width: 16px; height: 16px; }
  .dwg-pane :is(.dwg-icon, .dwg-tool, .dwg-chip):hover:not([aria-pressed=true]) { background: var(--rg-soft, rgba(0, 0, 0, .055)); }
  .dwg-pane .dwg-tool { flex: none; display: flex; align-items: center; gap: 5px; border: 0; border-radius: 999px; padding: 4px 10px; background: transparent; }
  .dwg-tool svg { width: 15px; height: 15px; }
  .dwg-pane .dwg-tool[aria-pressed=true], .dwg-pane .dwg-tool[aria-pressed=true]:hover { background: var(--rg-a, #7a5a0c); color: var(--rg-on, #fff) !important; }
  .dwg-hint { flex: 1; min-width: 0; margin-left: 6px; color: var(--rg-mute, #6e6e73); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
  .dwg-stage { position: relative; flex: 1; min-height: 0; background: var(--dwg-paper); touch-action: none; cursor: grab; overflow: clip; }
  .dwg-stage:not([data-tool=select]) { cursor: crosshair; }
  .dwg-stage canvas, .dwg-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
  .dwg-svg { overflow: visible; pointer-events: none; }
  .dwg-svg .dwg-mark { pointer-events: auto; cursor: move; }
  .dwg-stage:not([data-tool=select]) .dwg-svg .dwg-mark { pointer-events: none; }
  .dwg-svg rect.dwg-hit { fill: transparent; stroke: none; }
  .dwg-svg line.dwg-hit { stroke: transparent; stroke-width: 12; stroke-linecap: round; }
  .dwg-mark.on line.dwg-hit { stroke: var(--dwg-tint); }
  .dwg-mark.on rect.dwg-hit { fill: var(--dwg-tint); }
  .dwg-mark.on :is(.dwg-stroke, .dwg-ext, .dwg-tick) { stroke: var(--dwg-accent); }
  .dwg-mark.on :is(.dwg-label, .dwg-text, .dwg-arrow) { fill: var(--dwg-accent); }
  .dwg-stroke, .dwg-ext, .dwg-tick { stroke: var(--dwg-ink); stroke-width: 1.2; fill: none; }
  .dwg-ext { stroke-width: .8; opacity: .8; }
  .dwg-tick { stroke-width: 1.6; }
  .dwg-arrow { fill: var(--dwg-ink); stroke: none; }
  .dwg-label, .dwg-text { fill: var(--dwg-ink); font: 500 12px var(--dv-font, Inter, system-ui, sans-serif); paint-order: stroke; stroke: var(--dwg-paper); stroke-width: 3px; stroke-linejoin: round; }
  .dwg-text { font-size: 13px; }
  .dwg-live :is(.dwg-stroke, .dwg-ext, .dwg-tick) { stroke: var(--dwg-accent); }
  .dwg-live .dwg-arrow { fill: var(--dwg-accent); }
  .dwg-live .dwg-label { fill: var(--dwg-accent); }
  .dwg-wall-point { pointer-events: all; cursor: grab; fill: var(--dwg-paper); stroke: var(--dwg-accent); stroke-width: 2; }
  .dwg-wall-point:hover { fill: var(--dwg-accent); }
  .dwg-pane .dwg-wall-type { flex: none; }
  .dwg-snap { fill: none; stroke: var(--dwg-accent); stroke-width: 1.5; }
  .dwg-pane .dwg-type { position: absolute; z-index: 2; transform: translate(6px, -50%); width: 220px; max-width: calc(100% - 16px); box-sizing: border-box; margin: 0; padding: 5px 9px; border-radius: 9px; border: 1px solid var(--dwg-accent);
    background: var(--rg-solid, #fff); color: var(--rv-text, #1d1d1f); font: 13px var(--dv-font, Inter, system-ui, sans-serif); box-shadow: var(--rg-shadow, 0 8px 24px rgba(0, 0, 0, .1)); }
  .dwg-toggle { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; }
  .dwg-toggle svg { width: 14px; height: 14px; }
  .dwg-toggle[aria-pressed=true] { background: var(--rg-sel, #fff); color: var(--rg-a, #7a5a0c) !important; font-weight: 600; }

  /* the chat pill stays over the model, not over the drawing (bar-layout.css puts it at the window's centre) */
  body.v8-bar-groups.v8-revit.v8-dwg-open:not(.v8-looking, .v8-page-open) #davinci-dock {
    left: calc(var(--rv-left) + 60px + (100vw - var(--rv-left) - var(--dwg-w) - 84px) / 2) !important; width: min(560px, calc(100vw - var(--rv-left) - var(--dwg-w) - 110px)) !important; }

  /* the edit strip at the top of the model */
  body.v8-revit.v8-in-place .ip-bar:not([hidden]) {
    display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px; position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 6;
    width: max-content; max-width: calc(100% - 170px); padding: 4px 6px 4px 14px; box-sizing: border-box; border-radius: 18px;
    background: var(--rg-solid, rgba(250, 250, 251, .95)); border: 1px solid var(--rg-edge, rgba(255, 255, 255, .95)); box-shadow: var(--rg-shadow, 0 8px 24px rgba(0, 0, 0, .1));
    backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4); color: var(--rv-text, #1d1d1f); font: 12px var(--dv-font, Inter, system-ui, sans-serif);
  }
  .ip-bar strong { white-space: nowrap; font-weight: 600; }
  .ip-bar em { font-style: normal; white-space: nowrap; color: var(--rg-mute, #6e6e73); margin: 0 8px 0 6px; }
  .ip-bar .ip-tool { flex: none; display: flex; align-items: center; gap: 5px; border: 0; border-radius: 999px; padding: 5px 10px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
  .ip-tool svg { width: 15px; height: 15px; }
  .ip-bar .ip-tool:hover:not(.ip-done) { background: var(--rg-soft, rgba(0, 0, 0, .055)); }
  .ip-bar .ip-tool.ip-done, .ip-bar .ip-tool.ip-done:hover { background: var(--rg-a, #7a5a0c); color: var(--rg-on, #fff); margin-left: 4px; }
  /* Docked layout (Eddy 2026-11-23 "display needs organisation"): nothing floats over the model. The edit strip is one flush row across the
     top of the model; the chat and the work pill sit in a band under the model (above the command line), and the model area gives that band up. */
  :root body.v8-revit { --dock-h: 58px; --dock-pill: 0px; }
  :root body.v8-revit:has(#v8-work-pill.on) { --dock-pill: 44px; }
  :root body.v8-revit:not(.v8-looking, .v8-page-open) .layout { bottom: calc(90px + var(--dock-h) + var(--dock-pill)) !important; }
  :root body.v8-revit.v8-bar-groups:not(.v8-looking, .v8-page-open) #davinci-dock:not(.open) {
    left: calc(var(--rv-left) + 12px) !important; right: 12px !important; width: auto !important; transform: none !important; bottom: 96px !important; }
  :root body.v8-revit.v8-bar-groups.v8-dwg-open:not(.v8-looking, .v8-page-open) #davinci-dock:not(.open) { right: calc(var(--dwg-w) + 24px) !important; }
  :root body.v8-revit.v8-bar-groups:not(.v8-looking, .v8-page-open) #v8-work-pill {
    left: calc(var(--rv-left) + 12px) !important; transform: none !important; width: min(520px, calc(100vw - var(--rv-left) - 24px)); bottom: calc(96px + var(--dock-h)) !important; }
  :root body.v8-revit.v8-in-place .ip-bar:not([hidden]) {
    top: 0; left: 0; right: 0; transform: none; width: auto; max-width: none; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none;
    border-radius: 0 0 12px 12px; border-top: 0; }
  body.v8-revit .v8-no-fields { grid-column: 1 / -1; margin: 2px 0 6px; font-size: 12px; line-height: 1.45; color: var(--rv-text, #252525); }
}
