/* ═══════════════════════════════════════════
   COMFORT MODE — non-destructive density override
   Preserves every proportion of the original design.
   Only scales TEXT SIZES so the UI is readable
   without resorting to browser Ctrl+ zoom.

   Mechanism:
     html.comfort  →  base rem grows from 16px → 24px (1.5×)
                      → every rem-based font scales uniformly
                      → all paddings/widths in rem stay proportional
     Plus targeted px overrides for chrome that was hard-coded
     in pixels (inspector, schema dock, ctx menu, etc).
   ═══════════════════════════════════════════ */

/* ── Root rem bump: scales every rem-based size by 1.5× ── */
html.comfort { font-size: 24px; }

/* The body sets a sensible cascading baseline so children that
   inherit (vs declare explicit px) get a comfortable default. */
html.comfort body { font-size: 13px; }

/* ── Context menus (ctx-menu, tf-menu, tw-menu) ── */
html.comfort .ctx-menu,
html.comfort #ctx-menu,
html.comfort #table-filter-menu,
html.comfort #table-wires-menu { font-size: 13px; }
html.comfort .ctx-item,
html.comfort .tf-item,
html.comfort .tw-item { font-size: 12.5px; padding: 7px 13px; }

/* ── Inspector panel ── */
html.comfort #inspector { font-size: 13px; }
html.comfort #insp-header { font-size: 12px; }
html.comfort #insp-mode-badge { font-size: 10px; }
html.comfort #insp-empty { font-size: 13px; }
html.comfort .insp-key { font-size: 12px; }
html.comfort .insp-val,
html.comfort .insp-val-ro { font-size: 13px; }
html.comfort .insp-input { font-size: 13px; padding: 2px 6px; }
html.comfort .insp-select { font-size: 13px; padding: 2px 5px; }
html.comfort .insp-multi-header { font-size: 13px; }
html.comfort .insp-multi-section { font-size: 11px; }
html.comfort .dep-check-row { font-size: 12px; }
html.comfort .dep-check-row.is-group::after { font-size: 10px; }
html.comfort #insp-deps { font-size: 12px; }
html.comfort .lock-indicator { font-size: 12px; }

/* ── Schema dock + table view cells ── */
html.comfort #schema-dock-header,
html.comfort #focus-schema-dock-header { font-size: 12.5px; }
html.comfort #schema-dock-header .sdh-live,
html.comfort #focus-schema-dock-header .sdh-live { font-size: 10px; }
html.comfort #schema-row-labels .srl,
html.comfort #focus-schema-row-labels .srl { font-size: 10px; }
html.comfort .sc-cell,
html.comfort .tv-cell { font-size: 13px; }
html.comfort .sc-sub-cell,
html.comfort .tv-sub-cell { font-size: 10px; }
html.comfort .sc-sub-cell .sc-cls-text,
html.comfort .sc-cls-text { font-size: 11px; }
html.comfort .sc-sub-cell .sc-role-text,
html.comfort .sc-role-text { font-size: 9px; }
html.comfort .sc-group-cell,
html.comfort .tv-group-cell { font-size: 10px; }
html.comfort .sc-group-cell.sc-grouped,
html.comfort .tv-group-cell.sc-grouped { font-size: 10.5px; }
html.comfort .sc-data-cell,
html.comfort .tv-data-cell { font-size: 12px; }
html.comfort .sc-validation-icon { font-size: 11px; }

/* ── Table view header band ── */
html.comfort .row-count { font-size: 11px; }
html.comfort #table-header-dataset { font-size: 13px; }
html.comfort #table-wire-count { font-size: 11px; }
html.comfort #table-header-input { font-size: 12px; }

/* ── Logic Mapper sidecar header ── */
html.comfort #title { font-size: 14px; }
html.comfort #sidecar.focus-mode #title { font-size: 15px; }
html.comfort .hbtn { font-size: 12px; padding: 2px 5px; }
html.comfort #btn-auto-layout { font-size: 14px; }
html.comfort #dataset-bar .ds-label { font-size: 10px; }
html.comfort #dataset-bar .ds-value,
html.comfort #dataset-bar .ds-input { font-size: 12px; }
html.comfort .row-dataset { font-size: 11px; }
html.comfort .nd .col-btn { font-size: 10px; }

/* ── Form inputs (general) ── */
html.comfort .opt-input { font-size: 13.5px; padding: 6px 10px; }

/* ── Generic <input type=text> that wasn't selector-scoped ── */
html.comfort input[type="text"]:not(.ds-input):not(.insp-input):not(.tv-data-cell),
html.comfort input[type="number"] { font-size: 13px; }

/* ── SVG node text — modest bump (these live in SVG user units,
       too much growth breaks node layout). ── */
html.comfort .nd .lbl { font-size: 6px; }
html.comfort .nd .nd-hdr-text { font-size: 5px; }
html.comfort .nd .nd-role-label { font-size: 5px; }
html.comfort .input-group-label { font-size: 5.2px; }
html.comfort .grp-plus-marker { font-size: 6.5px; }

/* ── Wire-state / wire-list side panels (project-mapper) ── */
html.comfort #wsp-title,
html.comfort #wlp-title { font-size: 12.5px; }
html.comfort .wsp-field-label,
html.comfort .wlp-field-label,
html.comfort .wsp-field-value,
html.comfort .wlp-field-value { font-size: inherit; }

/* ── Mode tabs (Focus / Table) — keep proportional with grown top bar ── */
html.comfort .mode-tab {
  font-size: 11.5px;
  height: 26px;
  padding: 2px 16px;
  letter-spacing: 0.05em;
}
html.comfort #top-bar-center { padding: 2px; gap: 3px; }

/* ── Bar buttons — give breathing room so center pill doesn't collide ── */
html.comfort .bar-btn { font-size: 12px; height: 26px; padding: 2px 7px; }
html.comfort #top-bar { min-height: 42px; }
html.comfort .hbtn { height: 24px; min-width: 24px; }

/* ── Reserve the center column for the Focus/Table pill so left/right
       side bars can't bleed under it. Right bar scrolls horizontally when
       there are too many buttons (it was already styled for this). ── */
html.comfort #top-bar-left,
html.comfort #top-bar-right {
  max-width: calc(50% - 72px);
}
html.comfort #top-bar-right { overflow-x: auto; }
html.comfort #top-bar-center { z-index: 5; }
#top-bar-right,
html.comfort #top-bar-right {
  scrollbar-width: none;
}
#top-bar-right::-webkit-scrollbar,
html.comfort #top-bar-right::-webkit-scrollbar {
  display: none;
}

/* ═══ FLOATING TOOLS CONTAINER (legacy mount point) ═══ */
.graftd-fb-tools {
  position: fixed;
  top: 52px;
  right: 12px;
  z-index: 99999;
  display: none;
  align-items: center;
  gap: 8px;
  font-family: var(--f);
  user-select: none;
  -webkit-user-select: none;
}
/* Comfort mode has a taller top bar (min-height 42px); nudge tools down so
   the pills still sit just under the bar rather than overlapping it. */
html.comfort .graftd-fb-tools { top: 58px; }

/* In Logic Mapper sidecar mode (dataset list view) the canvas isn't visible,
   so canvas tools (Rebalance, Fit to View) and the density toggle have no
   workspace to sit above — they were landing on top of the dataset list.
   Hide the whole bottom-right cluster until the user enters focus mode.
   On Central/Project there's no #sidecar, so :has() doesn't match and the
   tools stay visible. */
html:has(#sidecar):not(:has(#sidecar.focus-mode)) .graftd-fb-tools {
  display: none;
}

/* In Logic Mapper focus mode the Inspector panel sits on the right edge of
   the canvas. Docking tools at right:12px overlaps it. Move them near the
   dataset header; comfort-toggle.js refines the exact left edge from the
   live #dataset-bar width so the controls sit to its right. */
html:has(#sidecar.focus-mode) .graftd-fb-tools {
  right: auto;
  left: 12px;
}

/* Shared pill chrome — applied to floating canvas toolbar pieces.
   Variant B (refined): squarer corners, tighter padding, slightly stronger
   border. Reads as a Revit toolbar segment, not a SaaS pill. */
.gt-pill {
  display: flex;
  align-items: stretch;
  background: var(--menu);
  border: 1px solid var(--rl2);
  border-radius: 2px;
  padding: 2px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 14px var(--shade2), 0 0 0 1px var(--shade);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.comfort-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  background: var(--shell);
  border: 1px solid var(--rl2);
  border-radius: 2px;
  padding: 4px 8px 4px 10px;
  font-family: var(--f);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--p);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
  -webkit-appearance: none;
  appearance: none;
}
.comfort-toggle:hover {
  background: var(--hov);
  border-color: var(--cn);
  color: var(--p);
}
.comfort-toggle.is-open {
  background: var(--hov);
  border-color: var(--cn);
  color: var(--p);
}
.comfort-toggle:focus-visible {
  outline: 1px solid var(--focus);
  outline-offset: 1px;
}
.comfort-toggle .ct-prefix {
  font-size: 8.5px;
  color: var(--tt);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-family: var(--fm);
}
.comfort-toggle .ct-current { line-height: 1; }
.comfort-toggle .ct-caret {
  width: 8px;
  height: 8px;
  opacity: 0.55;
  transition: transform 0.18s ease, opacity 0.14s ease;
}
.comfort-toggle:hover .ct-caret,
.comfort-toggle.is-open .ct-caret { opacity: 0.9; }
.comfort-toggle.is-open .ct-caret { transform: translateY(1px); }

.comfort-toggle-menu {
  position: fixed;
  z-index: 100000;
  min-width: 160px;
  background: var(--menu);
  border: 1px solid var(--rl2);
  border-radius: 2px;
  box-shadow: 0 2px 12px var(--shade2);
  padding: 2px;
  font-family: var(--f);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--p);
  display: none;
}
.comfort-toggle-menu.is-open { display: block; }
.comfort-toggle-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: none;
  border-radius: 1px;
  padding: 6px 10px;
  font: inherit;
  color: var(--p);
  cursor: pointer;
  text-align: left;
}
.comfort-toggle-menu button:hover {
  background: var(--hov);
  color: var(--p);
}
.comfort-toggle-menu button.is-active {
  background: var(--menuh);
  color: var(--p);
}
.comfort-toggle-menu .ct-check {
  visibility: hidden;
  color: var(--p);
  font-size: 10px;
  font-weight: 700;
}
.comfort-toggle-menu button.is-active .ct-check { visibility: visible; }
.comfort-toggle-menu .ct-section {
  padding: 6px 10px 3px;
  font-family: var(--fm);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tt);
}
.comfort-toggle-menu .ct-sep {
  height: 1px;
  margin: 3px 0;
  background: var(--rl);
}
html.comfort .comfort-toggle { font-size: 12px; padding: 5px 9px 5px 11px; }
html.comfort .canvas-toolbar { font-size: 11px; }
html.comfort .canvas-toolbar button { font-size: 11px; }

/* ═══ CANVAS TOOLBAR ═══ */
.canvas-toolbar {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.04em;
  gap: 2px;
}
.canvas-toolbar button {
  background: transparent;
  color: var(--s);
  border: none;
  padding: 4px 10px 4px 8px;
  border-radius: 1px;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 0.14s ease, color 0.14s ease;
}
.canvas-toolbar button:hover {
  background: var(--hov);
  color: var(--p);
}
.canvas-toolbar button:active { background: var(--hov); }
.canvas-toolbar button:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}
.canvas-toolbar button:focus-visible {
  outline: 1px solid var(--focus);
  outline-offset: 1px;
}
.canvas-toolbar .ct-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  opacity: 0.85;
}
.canvas-toolbar button:hover .ct-icon { opacity: 1; }

/* The original Auto Layout button in Logic Mapper's header is hidden;
   its function is reachable from the canvas toolbar's Rebalance.
   Specificity stack matches host's `#sidecar.focus-mode #btn-auto-layout
   { display: flex !important; }` and beats it via the extra .gt-relocated
   class plus body-scope. */
body #sidecar.focus-mode #btn-auto-layout.gt-relocated,
body #btn-auto-layout.gt-relocated { display: none !important; }

/* ═══ VIEW NAVIGATOR — bottom-right CAD-style cluster ═══
   Mounts as a separate container `.graftd-view-nav` pinned to the bottom-
   right of the canvas viewport. NOT a peer of `.graftd-fb-tools` (the top-
   right Rebalance/Fit/Density strip remains untouched).

   Hidden on Logic Mapper's sidecar mode (no canvas visible) and on pages
   without a canvas — same logic as `.graftd-fb-tools`. */
.graftd-view-nav {
  position: fixed;
  bottom: 14px;
  right: 14px;
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--f);
  user-select: none;
  -webkit-user-select: none;
}
html:has(#sidecar):not(:has(#sidecar.focus-mode)) .graftd-view-nav {
  display: none;
}

/* Live zoom percentage — read-only chip */
.graftd-view-nav .vn-zoom {
  background: var(--scrim);
  color: var(--s);
  padding: 4px 8px;
  border-radius: 2px;
  font-size: 10px;
  letter-spacing: 0.04em;
  font-family: var(--fm);
  min-width: 38px;
  text-align: center;
  border: 1px solid var(--rl);
}

/* Cluster — horizontal CAD-style strip of icon buttons */
.graftd-view-nav .vn-cluster {
  display: flex;
  flex-direction: row;
  align-items: center;
  background: var(--menu);
  border: 1px solid var(--rl2);
  border-radius: 2px;
  box-shadow: 0 4px 14px var(--shade2), 0 0 0 1px var(--shade);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  overflow: hidden;
}
.graftd-view-nav .vn-cluster button {
  background: transparent;
  border: none;
  color: var(--s);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
  border-right: 1px solid var(--rl);
  transition: background 0.12s ease, color 0.12s ease;
}
.graftd-view-nav .vn-cluster button.vn-text {
  width: auto;
  min-width: 0;
  gap: 6px;
  padding: 0 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.graftd-view-nav .vn-cluster button:last-child { border-right: none; }
.graftd-view-nav .vn-cluster button:hover {
  background: var(--hov);
  color: var(--p);
}
.graftd-view-nav .vn-cluster button:active {
  background: var(--hov);
}
.graftd-view-nav .vn-cluster button:disabled {
  opacity: 0.32;
  cursor: default;
  pointer-events: none;
}
.graftd-view-nav .vn-cluster button:focus-visible {
  outline: 1px solid var(--focus);
  outline-offset: -2px;
}
.graftd-view-nav .vn-cluster .vn-sep {
  width: 1px;
  height: 18px;
  background: var(--hov);
}
.graftd-view-nav .vn-cluster svg {
  width: 14px;
  height: 14px;
  opacity: 0.85;
}
.graftd-view-nav .vn-cluster button:hover svg { opacity: 1; }
.graftd-view-nav .vn-cluster .comfort-toggle {
  width: auto;
  height: 28px;
  min-width: 0;
  padding: 0 9px 0 10px;
  border: none;
  border-left: 1px solid var(--rl);
  border-radius: 0;
  background: transparent;
}
.graftd-view-nav .vn-cluster .comfort-toggle .ct-caret {
  width: 8px;
  height: 8px;
}

/* Appearance uses the same Options surface as the host application. */
.graftd-options-dialog { color: var(--p); background: var(--panel); border: 1px solid var(--rl2); border-radius: 2px; padding: 24px; width: min(400px, calc(100vw - 32px)); }
.graftd-options-dialog::backdrop { background: var(--scrim); }
.graftd-options-dialog h2 { margin: 0 0 20px; font: 500 18px var(--f); }
.appearance-close { float: right; border: 0; background: transparent; color: var(--s); cursor: pointer; font-size: 20px; }
.graftd-appearance { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--rl); }
.graftd-appearance h3 { font: 500 11px var(--fm); text-transform: uppercase; letter-spacing: .12em; color: var(--tt); margin: 0 0 12px; }
.appearance-theme { display: flex; align-items: center; gap: 8px; font: 13px var(--f); }
.appearance-theme > span { flex: 1; }
.appearance-theme button { color: var(--p); background: var(--panel); border: 1px solid var(--rl2); border-radius: 2px; padding: 6px 12px; cursor: pointer; font: inherit; }
.appearance-theme button[aria-pressed="true"] { color: var(--canvas); background: var(--p); border-color: var(--p); }

/* My Profile uses the same Light and Dark control. The section matches the
   other profile sections; the buttons stay the Options control. */
.profile-body .graftd-appearance {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.profile-body .graftd-appearance h3 {
  color: var(--tx2);
  font: 500 11px var(--fm);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 10px;
}
