/* ============================================================================
   Integration — Drafter inside SOLIDWORKS
   ----------------------------------------------------------------------------
   `sw-*` is a facsimile of SOLIDWORKS 2024 in its default LIGHT theme: Segoe UI at
   12px, Windows metrics, 1px hairlines, almost no radii. Like the nx-* layer in
   integration.css it deliberately does NOT read Drafter tokens — the literal hex
   values are the point.

   The Drafter panel inside the Task Pane is `dfi-*` and is styled by
   integration.css, shared with NX. Two things here keep the two from bleeding:

     1. The chrome's button/input reset is wrapped in :where() so it carries ZERO
        specificity. The panel lives INSIDE `.sw-app` (it is docked, not a separate
        window as in NX), and a plain `.sw-app button { font: inherit }` beat the
        design system's `.btn` on source order and stripped its type.
     2. `.sw-tp-content` re-opens text selection, which `.sw-app` turns off for
        the chrome.
   ========================================================================== */

.sw-app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #F0F0F0;
  color: #1F1F1F;
  font-family: "Segoe UI", Tahoma, "Helvetica Neue", Arial, sans-serif;
  font-size: 12px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
:where(.sw-app) :where(button, input) { font: inherit; color: inherit; }
.sw-icon, .sw-glyph, .sw-mini { display: block; flex: none; }
.sw-mini { width: 16px; height: 16px; }
.sw-caret { font-style: normal; font-size: 8px; line-height: 1; opacity: 0.75; }
body.sw-resizing, body.sw-resizing * { cursor: ew-resize !important; user-select: none !important; }

/* ── Title bar: logo, menus, quick access, document title ──────────────────── */
.sw-titlebar {
  flex: none;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 8px;
  background: #F5F5F5;
  border-bottom: 1px solid #DCDCDC;
}
.sw-logo { display: inline-flex; align-items: center; gap: 3px; padding-right: 6px; }
.sw-logo svg { width: 26px; height: 16px; display: block; }
.sw-logo-word { font-size: 13px; letter-spacing: 0.2px; color: #D52B1E; font-weight: 400; }
.sw-logo-word b { font-weight: 800; }

.sw-menus { display: flex; align-items: center; height: 100%; }
.sw-menu-wrap { position: relative; height: 100%; display: flex; align-items: center; }
.sw-menu {
  height: 24px;
  padding: 0 7px;
  border: 1px solid transparent;
  background: transparent;
  cursor: default;
}
.sw-menu:hover, .sw-menu.is-open { background: #E5F1FB; border-color: #CCE4F7; }
.sw-menu-pin { display: inline-flex; padding: 0 4px; color: #6A6A6A; }

/* Menu popups — classic Windows menus, which is what SOLIDWORKS still draws. Submenus open on
   hover, from the item's right edge. */
.sw-popup {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 80;
  min-width: 232px;
  padding: 2px;
  background: #FCFCFC;
  border: 1px solid #C7C7C7;
  box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.2);
}
.sw-popup .sw-popup { display: none; top: -3px; left: 100%; }
.sw-popup-item { position: relative; }
.sw-popup-item.has-sub:hover > .sw-popup { display: block; }
.sw-popup-item > button {
  width: 100%;
  height: 24px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px 0 2px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  cursor: default;
  white-space: nowrap;
}
.sw-popup-item:hover > button { background: #E5F1FB; border-color: #CCE4F7; }
.sw-popup-item.is-disabled > button { color: #9A9A9A; }
.sw-popup-check { width: 14px; text-align: center; font-size: 11px; }
.sw-popup-ico { width: 18px; display: grid; place-items: center; color: #4A4A4A; }
.sw-popup-ico img { width: 12px; height: 14px; object-fit: contain; display: block; }
.sw-popup-label { flex: 1; padding-left: 4px; }
.sw-popup-arrow { font-size: 9px; color: #4A4A4A; }
.sw-popup-key { color: #6A6A6A; }
.sw-popup-sep { display: block; height: 1px; margin: 3px 4px 3px 28px; background: #DADADA; }

.sw-qa { display: flex; align-items: center; gap: 1px; padding-left: 4px; }
.sw-qa-btn {
  height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 0 3px;
  border: 1px solid transparent;
  background: transparent;
  color: #3A3A3A;
  cursor: default;
}
.sw-qa-btn:hover { background: #E5F1FB; border-color: #CCE4F7; }
.sw-qa-btn.is-disabled { opacity: 0.4; }
.sw-qa-sep { width: 1px; height: 16px; margin: 0 3px; background: #D0D0D0; }
.sw-doc-title {
  flex: 1;
  min-width: 0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #2A2A2A;
}
.sw-titlebar-right { display: flex; align-items: center; gap: 4px; height: 100%; }
.sw-search {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 196px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid #C9C9C9;
  background: #FFFFFF;
  color: #6A6A6A;
}
.sw-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 12px; }
.sw-tb-btn {
  height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 0 3px;
  border: 1px solid transparent;
  background: transparent;
  color: #3A3A3A;
  cursor: default;
}
.sw-tb-btn:hover { background: #E5F1FB; border-color: #CCE4F7; }
.sw-win { display: flex; align-self: stretch; margin-left: 6px; }
.sw-win-btn {
  width: 40px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: #2A2A2A;
  cursor: default;
}
.sw-win-btn:hover { background: #E5E5E5; }
.sw-win-btn.is-close:hover { background: #C42B1C; color: #FFFFFF; }

/* ── CommandManager ─────────────────────────────────────────────────────────
   Clipped from the right when the window narrows, never reflowed — same rule as NX. */
.sw-cmdmgr {
  flex: none;
  height: 70px;
  display: flex;
  align-items: stretch;
  padding: 2px 4px;
  background: #FAFAFA;
  overflow: hidden;
}
.sw-cm-group {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 1px;
  padding: 0 4px;
  border-right: 1px solid #DCDCDC;
}
.sw-cm-big {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 52px;
  height: 64px;
  padding: 3px 4px 0;
  border: 1px solid transparent;
  background: transparent;
  cursor: default;
}
.sw-cm-big:hover { background: #E5F1FB; border-color: #CCE4F7; }
.sw-cm-label { display: flex; flex-direction: column; align-items: center; font-size: 11px; line-height: 1.15; text-align: center; white-space: nowrap; color: #1F1F1F; }
.sw-cm-caret { position: absolute; right: 2px; top: 26px; }
.sw-cm-stack { display: flex; flex-direction: column; gap: 0; padding-top: 1px; }
.sw-cm-small {
  height: 21px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 6px 0 3px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 11px;
  white-space: nowrap;
  cursor: default;
}
.sw-cm-small:hover { background: #E5F1FB; border-color: #CCE4F7; }

/* ── Main: [work column | Task Pane] ──────────────────────────────────────── */
.sw-main { flex: 1; min-height: 0; display: flex; border-top: 1px solid #DCDCDC; }
.sw-work { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* CommandManager tabs and the heads-up view toolbar share one strip. */
.sw-tabsbar {
  flex: none;
  height: 26px;
  display: flex;
  align-items: stretch;
  background: #F0F0F0;
  border-bottom: 1px solid #D6D6D6;
}
.sw-cm-tabs { display: flex; align-items: flex-end; padding-left: 4px; min-width: 0; overflow: hidden; }
.sw-cm-tab {
  height: 24px;
  display: flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid transparent;
  border-bottom: 0;
  white-space: nowrap;
  color: #333333;
}
.sw-cm-tab:hover { background: #E8E8E8; }
.sw-cm-tab.is-active {
  background: #FFFFFF;
  border-color: #CFCFCF;
  font-weight: 600;
  color: #1F1F1F;
  margin-bottom: -1px;
  height: 25px;
}
.sw-headsup {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  overflow: hidden;
}
.sw-hu-btn {
  height: 22px;
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 0 3px;
  border: 1px solid transparent;
  background: transparent;
  cursor: default;
}
.sw-hu-btn:hover { background: #E5F1FB; border-color: #CCE4F7; }
.sw-hu-sep { width: 1px; height: 16px; margin: 0 3px; background: #D0D0D0; }

.sw-body { flex: 1; min-height: 0; display: flex; }

/* FeatureManager design tree */
.sw-fm {
  flex: none;
  width: 268px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #FFFFFF;
}
.sw-fm-tabs {
  flex: none;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 4px;
  border-bottom: 1px solid #E3E3E3;
  background: #F7F7F7;
}
.sw-fm-tab { width: 30px; height: 24px; display: grid; place-items: center; border: 1px solid transparent; }
.sw-fm-tab.is-active { background: #FFFFFF; border-color: #CFCFCF; }
.sw-fm-more { margin-left: auto; color: #6A6A6A; }
.sw-fm-filter { flex: none; height: 24px; display: flex; align-items: center; padding: 0 8px; border-bottom: 1px solid #EFEFEF; }
.sw-fm-tree { flex: 1; min-height: 0; overflow: auto; padding: 3px 0; }
.sw-tree-row {
  height: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding-right: 6px;
  white-space: nowrap;
}
.sw-tree-row:hover { background: #E5F1FB; }
.sw-tree-row.is-root .sw-tree-label { font-weight: 400; }
.sw-tree-exp { width: 9px; flex: none; font-size: 9px; color: #5A5A5A; text-align: center; }
.sw-tree-label { overflow: hidden; text-overflow: ellipsis; }
.sw-tree-row.is-suppressed { color: #A0A0A0; }
.sw-tree-row.is-suppressed .sw-mini { opacity: 0.55; filter: grayscale(1); }

.sw-splitter {
  flex: none;
  width: 6px;
  position: relative;
  background: #F0F0F0;
  border-left: 1px solid #DCDCDC;
  border-right: 1px solid #DCDCDC;
}
.sw-splitter-grip {
  position: absolute;
  top: 50%;
  left: -1px;
  width: 6px;
  height: 34px;
  margin-top: -17px;
  display: grid;
  place-items: center;
  background: #E3E3E3;
  color: #6A6A6A;
}

/* Graphics area — SOLIDWORKS' default light gradient, white at the top. */
.sw-graphics {
  flex: 1;
  min-width: 0;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #FFFFFF 0%, #F1F4F7 42%, #CDD6DF 100%);
}
.sw-graphics.is-drawing { background: #D8DCE0; }
/* Sized off the graphics area's width, capped by its height (the crop is ~1.53:1), so the
   part sits large and centred the way Zoom to Fit leaves it. */
.sw-model {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(78%, 108vh, 1000px);
  height: auto;
  transform: translate(-50%, -52%);
}
.sw-triad { position: absolute; left: 14px; bottom: 6px; display: flex; flex-direction: column; align-items: flex-start; }
.sw-triad svg { width: 62px; height: 62px; display: block; }
.sw-triad-label { font-size: 11px; color: #3A3A3A; padding-left: 4px; }

.sw-sheet-stage { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px 20px; }
.sw-sheet {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  filter: drop-shadow(2px 3px 0 rgba(0, 0, 0, 0.18));
}

/* Document tabs under the graphics area: Model / 3D Views / Motion Study, or Sheet1. */
.sw-doctabs {
  flex: none;
  height: 23px;
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding-left: 4px;
  background: #F0F0F0;
  border-top: 1px solid #D6D6D6;
}
.sw-doctabs-nav { display: flex; align-items: center; gap: 2px; height: 21px; padding: 0 6px 0 2px; color: #7A7A7A; }
.sw-doctab {
  height: 21px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid transparent;
  border-top: 0;
  background: transparent;
  color: #3A3A3A;
  cursor: default;
}
.sw-doctab:hover:not(.is-active) { background: #E8E8E8; }
.sw-doctab.is-active { background: #FFFFFF; border-color: #CFCFCF; font-weight: 600; color: #1F1F1F; margin-top: -1px; height: 22px; }
.sw-doctab-add { height: 21px; display: grid; place-items: center; padding: 0 6px; color: #5A5A5A; }

/* ── Task Pane ────────────────────────────────────────────────────────────── */
.sw-taskpane {
  flex: none;
  position: relative;
  display: flex;
  min-height: 0;
  background: #F0F0F0;
  border-left: 1px solid #CFCFCF;
}
.sw-taskpane.is-collapsed { width: auto; }
.sw-tp-resize { position: absolute; left: -4px; top: 0; bottom: 0; width: 7px; cursor: ew-resize; z-index: 4; }
.sw-tp-strip {
  flex: none;
  width: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
  background: #EDEDED;
  border-right: 1px solid #D6D6D6;
}
.sw-taskpane.is-collapsed .sw-tp-strip { border-right: 0; }
.sw-tp-tab {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  background: transparent;
  cursor: default;
}
.sw-tp-tab:hover { background: #E5F1FB; border-color: #CCE4F7; }
.sw-tp-tab.is-active { background: #FFFFFF; border-color: #BFBFBF; }
.sw-tp-tab img { width: 13px; height: 16px; object-fit: contain; display: block; }
.sw-tp-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sw-tp-head {
  flex: none;
  height: 26px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px;
  background: #E6E6E6;
  border-bottom: 1px solid #D0D0D0;
}
.sw-tp-headbtn {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  background: transparent;
  color: #4A4A4A;
  cursor: default;
}
button.sw-tp-headbtn:hover { background: #E5F1FB; border-color: #CCE4F7; }
.sw-tp-headbtn.is-pinned { color: #2F7FD1; }
.sw-tp-title { flex: 1; text-align: center; font-weight: 600; color: #3A3A3A; }

/* The Drafter page. `.dfi-surface` brings the panel's own ground and type (integration.css);
   this only makes it fill the pane and gives selection back to it. */
.sw-tp-content { flex: 1; min-height: 0; display: flex; flex-direction: column; user-select: text; position: relative; }
.sw-tp-content .dfi-body { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }

/* ── Status bar ───────────────────────────────────────────────────────────── */
.sw-statusbar {
  flex: none;
  height: 22px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  background: #F0F0F0;
  border-top: 1px solid #D6D6D6;
  color: #333333;
}
.sw-status-left { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sw-status-right { display: flex; align-items: center; }
.sw-status-cell { display: inline-flex; align-items: center; gap: 4px; padding: 0 10px; border-left: 1px solid #D6D6D6; }
.sw-status-units { font-weight: 600; }
