/* Global Styles */


/* light mode (your existing palette) */
:root[data-theme="light"] {
  --footer-height: 60px;
  --primary: #FE7F2D;
  --secondary: #233D4D;
  --color-gold: #FCCA46;
  --sky-blue: #5FA8D3;
  --light-gray: #E3E3E3;
  --color-off-white: #FAFAFA;
  --primary-blue: #1A5276;
  --background-light: #FAFAFA;
  --accent-red: #E74C3C;
  --interactive-cyan: #17A2B8;
  --button-green: #2ECC71;
  --cart-bg-gray: #EAEDED;
  --action-orange: #F39C12;
  --highlight-blue: #2980B9;
  --text-dark: #2C3E50;
  --text-light: #ffffff;
  --controls-bg: #f9f9f9;
  --controls-label: #333;
  --header-bg: rgb(231, 237, 244);
  --border-colour: #ccc;
  --footer-bg: #233D4D;
}

/* dark mode overrides */
:root[data-theme="dark"] {
  --footer-height: 60px;
  --primary: #FFA65C;
  --secondary: #1B263B;
  --sky-blue: #18335B;
  --light-gray: #3B3B3B;
  --background-light: #121212;
  --text-dark: #F1F1F1;
  --text-light: #F1F1F1;
  --highlight-blue: #4D85EE;
  --controls-bg: #3B3B3B;
  --controls-label: #E0E0E0;
  --header-bg: #3B3B3B;
  --border-colour: #000000;
  --footer-bg: #3B3B3B;
  /* …and any others you want to tweak… */
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
  font-family: Arial, sans-serif;
  display: flex;
  flex-direction: column;
}

.child-parts-panel {
  margin-top: 14px;
  background: none;
}

.child-parts-title {
  font-weight: 500;
  margin-bottom: 0px;
  font-size: 1.12rem;
  color: #222;
  padding-left: 2px;
}

.child-parts-grid {
  display: flex;
  flex-direction: column;
  /* groups stack vertically */
  gap: 5px;
  padding: 3px 0;
  overflow-y: auto;
  border-radius: 6px;
}

.child-group {
  width: 100%;
  /* always full width of container */
  display: flex;
  flex-direction: column;
  gap: 0.25em;
}

.child-group {
  margin-bottom: 5px;
}

.child-group-title {
  font-size: 0.9rem;
  font-weight: 300;
  color: #222;
  margin: 0;
  letter-spacing: .01em;
  padding-left: 2px;
}

.child-group-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  /* Optional for scrollable groups: */
  /* max-height: 300px; overflow-y: auto; */
}

.child-tile {
  background: #f5f5f5;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  padding: 5px;
  width: 150px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: transform .3s, box-shadow .3s, border-color .3s;
}

.child-tile:hover {
  background: #e0f7fa;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transform: scale(1.03);
}

.child-tile.active {
  background: #f4f6fc;
  color: black;
  border-color: var(--md3-swatch-selected-outline);
}

.child-tile.active .child-tile-label {
  color: var(--md3-swatch-label-selected);
  font-weight: 600;
}

.child-tile-img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
}

.child-tile-label {
  margin-top: 2px;
  font-size: 0.7rem;
  text-align: center;
  color: black;
  word-break: break-word;
}

.child-group-title-bar {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

.child-group-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 7px;
  background: #f7f7f7;
  box-shadow: 0 1px 6px #ccc2;
  margin-left: auto;
}

.child-group-desc {
  color: #888;
  font-size: 0.8em;
  margin-left: 5px;
}

.child-group-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 1em;
  padding: 5px;
}

/* Sections Panel Styles */
.sections-show-all-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: #f0f4f8;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.sections-show-all-container > span {
  font-size: 13px;
  color: #444;
  user-select: none;
}

.sections-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 5px;
}

/* Section Tile Styles */
.section-tile {
  width: 100px;
  min-height: 90px;
  justify-content: center;
}

.section-tile-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: white;
  background: #9e9e9e;
  margin-bottom: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: background 0.2s ease, transform 0.2s ease;
}

.section-tile:hover .section-tile-icon {
  transform: scale(1.08);
}

.section-tile.active .section-tile-icon {
  background: #2196F3;
}

.section-tile.show-all .section-tile-icon {
  background: #4CAF50;
}

.section-tile.active.show-all .section-tile-icon {
  background: #4CAF50;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.4);
}

.section-tile-count {
  font-size: 0.65rem;
  color: #888;
  margin-top: 2px;
}

.section-tile.active {
  border-color: #2196F3;
  background: #e3f2fd;
}

.section-tile.show-all {
  border-color: #4CAF50;
  background: #e8f5e9;
}

.icon-btn {
  background: none;
  border: none;
  padding: 0 4px;
  margin: 0;
  cursor: pointer;
  outline: none;
  display: inline-flex;
  align-items: center;
  /* Remove focus glow except on keyboard navigation: */
}

.icon-btn:focus-visible {
  outline: 2px solid #1976d2;
}

.material-symbols-outlined {
  font-size: 22px;
  vertical-align: middle;
  user-select: none;
  transition: color 0.15s;
}

.toolbar-button {
  background-color: var(--controls-bg);
  color: var(--controls-label)
}

#child-parts-panel {
  color: var(--controls-label);
}

.simple-header {
  height: 60px;
  background-color: var(--header-bg);
  color: var(--charcoal, #333333);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-family: 'Roboto', sans-serif;
  border-bottom: 2px solid var(--border-colour);
  position: relative;
  z-index: 999;
}

.simple-logo img {
  height: 40px;
}

.page-header-title {
  font-size: 1.5em;
  color: var(--controls-label)
}

.configurator-footer {
  height: var(--footer-height, 60px);
  width: 100%;
  background-color: var(--footer-bg);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 900;
  padding: 0 30px;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
}

.footer-left,
.footer-center,
.footer-right {
  display: flex;
  align-items: center;
}

.footer-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
}

.footer-project-name {
  font-size: 0.85rem;
  color: #fff;
  font-weight: normal;
  margin-bottom: 2px;
}

.footer-price {
  font-size: 1.2rem;
  color: #fff;
  font-weight: normal;
}

.footer-price.has-moq {
  background: #fff3cd;
  color: #856404;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid #ffc107;
}

.footer-center {
  flex: 1;
  justify-content: center;
  text-align: center;
}

.footer-left {
  flex: 0 0 auto;
  color: #fff;
  font-size: 18px;
  font-weight: 400;
}

.footer-right {
  gap: 12px;
}

.footer-button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 24px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.footer-button span.material-symbols-outlined {
  font-size: 20px;
}

.footer-button.outline {
  background-color: white;
  color: #333;
  border: 1px solid #ccc;
}

.footer-button.outline:hover {
  background-color: #f2f2f2;
}

.footer-button.filled {
  background-color: #E53935;
  color: white;
  border: none;
}

.footer-button.filled:hover {
  background-color: #d32f2f;
}

body {
  padding-bottom: var(--footer-height, 80px);
  /* Prevent content being hidden under footer */
}

.checkboxStyle1 {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.checkboxStyle1 input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 40px;
  height: 20px;
  background-color: #ccc;
  border-radius: 10px;
  position: relative;
  outline: none;
  transition: background-color 0.3s ease;
  cursor: pointer;
  margin-right: 10px;
}

.checkboxStyle1 input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background-color: #fff;
  border-radius: 50%;
  transition: transform 0.3s ease;
}

.checkboxStyle1 input[type="checkbox"]:checked {
  background-color: #007bff;
}

.checkboxStyle1 input[type="checkbox"]:checked::before {
  transform: translateX(20px);
}

.checkboxStyle1 label {
  font-size: 16px;
  color: var(--controls-label);
  user-select: none;
}

.checkbox-cont1 {
  width: 100%;
  padding: 5px;
}

/* Header: Fixed height of 100px */
header {
  height: 60px;
  text-align: center;
  background: #eee;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  color: var(--primary);
  background-color: var(--secondary);
}

.page-header {
  font-size: 24px;
  font-weight: 500;
  width: 100%;
}

/*
#loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2000;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-ring {
  width: 100%;
  height: 100%;
  position: absolute;
  transform: rotate(-90deg);
}

.progress-ring__background,
.progress-ring__circle {
  r: 36;
  cx: 40;
  cy: 40;
}

.progress-ring__background {
  fill: none;
  stroke: #eee;
  stroke-width: 8;
}

.progress-ring__circle {
  fill: none;
  stroke: var(--highlight-blue, #4CAF50);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 226.2;
  stroke-dashoffset: 226.2;
  transition: stroke-dashoffset 0.3s ease;
}
  */
.my-custom-ar-button {
  position: fixed;
  top: 10px;
  left: 150px;
  z-index: 999;
  padding: 10px 15px;
  font-size: 16px;
  background-color: #0066ff;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.loader-text {
  position: absolute;
  font-size: 18px;
  font-weight: bold;
  color: #333;
  text-align: center;
  width: 100%;
  line-height: 80px;
  /* Matches container height */
  pointer-events: none;
}

.floating-toolbar {
  position: fixed;
  top: 70px;
  /* consistent top offset */
  left: 10px;
  z-index: 999;
  background-color: var(--controls-bg);
  border-radius: 50px;
  overflow: hidden;
}

.toolbar-button-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toolbar-button {
  all: unset;
  /* Reset all built-in styles */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--controls-bg);
  color: var(--controls-label);
  border: 1px solid #ccc;
  padding: 10px;
  border-radius: 6px;
  font-size: 24px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.toolbar-toggle {
  all: unset;
  display: none;
  align-items: center;
  justify-content: center;
  background-color: var(--controls-bg);
  color: var(--controls-label);
  padding: 10px;
  border-radius: 6px;
  font-size: 24px;
  cursor: pointer;
}


.toolbar-button:hover {
  transform: scale(1.05);
}

/* toolbar for zoom controls at bottom */
.zoom-toolbar {
  position: fixed;
  bottom: 80px;
  left: 35%;
  transform: translateX(-50%);
  z-index: 1000;
}

.zoom-toolbar .toolbar-button-list {
  flex-direction: row;
}

#zoom-window-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  display: none;
  z-index: 1600;
}

#zoom-rect {
  position: absolute;
  border: 1px dashed #000;
  background: rgba(0, 0, 0, 0.1);
  pointer-events: none;
}

.webxr-button {
  all: unset !important;
  display: block !important;
  position: static !important;
}


#ar-toggle-button {
  position: fixed !important;
  top: 70px !important;
  left: 10px !important;
  width: 46px !important;
  height: 46px !important;
  background: var(--highlight-blue, #4CAF50) !important;
  color: black !important;
  background: white !important;
  border: 1px solid #ccc !important;
  border-radius: 6px !important;
  padding: 10px !important;
  font-size: 24px !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
  font-size: 0 !important;
  /* hide original text */
  opacity: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 1100 !important;
  cursor: pointer !important;
}

#ar-toggle-button:hover {
  background: #f0f0f0 !important;
  transform: scale(1.05) !important;

}

/* Optional: icon inside the button */
#ar-toggle-button::before {
  content: "view_in_ar";
  font-family: 'Material Symbols Outlined';
  font-size: 28px;
  line-height: 1;
}


#viewer-overlay {
  position: absolute;
  top: 0px;
  /* below header */
  left: 0;
  width: 100%;
  height: calc(100vh - 60px);
  background-color: rgba(255, 255, 255, 1);
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease;
  pointer-events: auto;
}

#viewer-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* Main container: viewer and controls side-by-side */
#main-container {
  flex: 1;
  display: flex;
  flex-wrap: nowrap;
  height: calc(100vh - 60px - var(--footer-height, 60px));
  overflow: hidden;
}

/* Viewer container: fills remaining width (full height minus header) */
#viewer-container {
  position: relative;
  flex: 1 1 auto;
  min-width: 320px;
  height: calc(100vh - 60px - var(--footer-height, 60px));
  border: none;
  box-sizing: border-box;
  overflow: hidden;
}

/* Controls panel: fixed width of 350px, full height */
#controls {
  flex: 0 0 auto;
  width: 350px;
  height: calc(100vh - 60px - var(--footer-height, 60px));
  padding: 10px;
  box-sizing: border-box;
  overflow-y: auto;
  background: var(--controls-bg);
  border-left: 3px solid var(--border-colour);
  border-top: 1px solid var(--border-colour);
  display: block;
  position: static;
  /* not fixed on desktop */
}

/* BOM Panel wrapper */
#bom-panel {
  position: fixed;
  top: 60px;
  left: -450px;
  width: 450px;
  height: calc(100vh - 121px);
  background: #fff;
  border-right: 1px solid #ccc;
  box-shadow: none;
  transition: left 0.3s ease, box-shadow 0.3s ease;
  z-index: 50;
  display: flex;
  flex-direction: column;
  font-family: 'Roboto', sans-serif;
  overflow: visible;
}

#bom-panel.visible {
  left: 0;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
}

.bom-copy,
.bom-pin,
.bom-utilities {
  position: absolute;
  top: 12px;
  background: none;
  border: none;
  color: #444;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.bom-utilities {
  right: 132px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
}

.bom-utilities .material-symbols-outlined {
  font-size: 1.3rem;
}

.bom-copy {
  right: 92px;
}

.bom-pin {
  right: 52px;
  background: none;
  border: none;
  color: #444;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.bom-close,
.bom-copy,
.bom-pin,
.bom-utilities {
  transition: color 0.2s ease;
}

.bom-copy:focus-visible,
.bom-pin:focus-visible,
.bom-utilities:focus-visible {
  outline: 2px solid #2196f3;
  outline-offset: 2px;
}

.bom-copy .material-symbols-outlined,
.bom-pin .material-symbols-outlined {
  font-size: 1.5rem;
  transform: rotate(-35deg);
  transition: transform 0.2s ease, color 0.2s ease;
}

.bom-copy .material-symbols-outlined {
  transform: none;
}

body.bom-pinned .bom-pin {
  color: #000;
}

body.bom-pinned .bom-pin .material-symbols-outlined {
  transform: rotate(0deg);
}

/* Utilities side panel */
#utilities-panel {
  --utilities-panel-width: 450px;
  --utilities-panel-offset: 452px;
  position: fixed;
  top: 60px;
  left: 0;
  width: var(--utilities-panel-width);
  height: calc(100vh - 121px);
  background: #fff;
  border-right: 1px solid #ccc;
  box-shadow: none;
  transform: translateX(calc(-1 * var(--utilities-panel-offset)));
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  z-index: 60;
  display: flex;
  flex-direction: column;
  font-family: 'Roboto', sans-serif;
}

#utilities-panel.is-visible {
  transform: translateX(0);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.12);
}

.utilities-panel__header .bom-close {
  position: absolute;
  top: 12px;
  right: 16px;
}

/* Docking debug side panel */
#docking-debug-panel {
  --docking-debug-panel-width: 420px;
  --docking-debug-panel-offset: calc(var(--docking-debug-panel-width) + 2px);
  position: fixed;
  top: 60px;
  left: 0;
  width: var(--docking-debug-panel-width);
  height: calc(100vh - 121px);
  background: rgba(12, 16, 24, 0.96);
  color: #e8f4ff;
  box-shadow: none;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(6px);
  transform: translateX(calc(-1 * var(--docking-debug-panel-offset)));
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  z-index: 70;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#docking-debug-panel.is-visible {
  transform: translateX(0);
  box-shadow: 2px 0 18px rgba(0, 0, 0, 0.45);
}

.docking-debug-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.docking-debug-panel__info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 70%;
}

.docking-debug-heading {
  font-size: 13px;
  letter-spacing: 0.02em;
  margin: 0;
}

.docking-debug-summary {
  font-size: 11px;
  opacity: 0.8;
  min-height: 14px;
}

.docking-debug-toggle-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  opacity: 0.85;
  cursor: pointer;
  user-select: none;
}

.docking-debug-toggle-row input {
  width: 14px;
  height: 14px;
}

.docking-debug-status {
  font-size: 10px;
  opacity: 0.7;
}

.docking-debug-panel__actions {
  display: flex;
  gap: 6px;
}

.docking-debug-button {
  background: transparent;
  color: #8ec7ff;
  border: 1px solid rgba(142, 199, 255, 0.4);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11px;
  cursor: pointer;
}

.docking-debug-button--danger {
  color: #ffb3b3;
  border-color: rgba(255, 179, 179, 0.4);
}

.docking-debug-panel__content {
  padding: 10px 12px 12px 12px;
  overflow-y: auto;
  font-family: 'Fira Code', 'Courier New', monospace;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1 1 auto;
}

@media (max-width: 720px) {
  #docking-debug-panel {
    width: 100%;
    --docking-debug-panel-offset: 100%;
  }
}

.utilities-panel__tabs {
  display: flex;
  border-bottom: 1px solid #e0e0e0;
  background: #fafafa;
  flex-shrink: 0;
}

.utilities-panel__tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #666;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}

.utilities-panel__tab:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #333;
}

.utilities-panel__tab.is-active {
  color: #6750a4;
  border-bottom-color: #6750a4;
  background: transparent;
}

.utilities-panel__tab .material-symbols-outlined {
  font-size: 20px;
}

.utilities-panel__content {
  padding: 16px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.utilities-tab-content {
  display: none;
}

.utilities-tab-content.is-active {
  display: block;
}

.utilities-section+.utilities-section {
  margin-top: 24px;
}

.utilities-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.utilities-section__header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 500;
  color: #1f2937;
}

.utilities-section__header .utilities-capture-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.utilities-section__header .utilities-capture-btn .material-symbols-outlined {
  font-size: 1.2rem;
}

.utilities-section__header .utilities-capture-btn.is-loading {
  opacity: 0.7;
  pointer-events: none;
}

.utilities-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  flex-wrap: wrap;
}

.utilities-control label {
  flex: 1 1 160px;
  margin: 0;
  font-weight: 300;
  color: #1f2937;
}

.utilities-control__input {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 200px;
  justify-content: flex-end;
}


.utilities-control__input .slider-control,
.utilities-control__input .utilities-slider-host {
  flex: 1 1 220px;
}

.utilities-slider-host {
  display: flex;
  flex: 1 1 220px;
  min-width: 0;
}

.utilities-slider-host.md3-slider {
  align-items: center;
  gap: 12px;
}

.utilities-slider-host .styled-slider {
  flex: 1 1 auto;
}


.utilities-control input[type="range"] {
  width: 100%;
  max-width: 220px;
}

.utilities-control__value {
  min-width: 48px;
  text-align: right;
  color: #475569;
  font-variant-numeric: tabular-nums;
}

.utilities-control input[type="color"] {
  flex: 0 0 auto;
}

.utilities-screenshot-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.utilities-screenshot-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.utilities-screenshot-card figure {
  margin: 0;
  position: relative;
  padding-top: 56%;
  background: #f8fafc;
}

.utilities-screenshot-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.utilities-screenshot-card footer {
  padding: 8px 10px;
  font-size: 0.75rem;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.utilities-screenshot-card a {
  color: inherit;
  text-decoration: none;
}

.utilities-screenshot-card a:hover,
.utilities-screenshot-card a:focus {
  text-decoration: underline;
}

.utilities-screenshot-delete {
  border: none;
  background: none;
  color: #ef4444;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
}

.utilities-screenshot-delete:hover,
.utilities-screenshot-delete:focus {
  text-decoration: underline;
}

.utilities-screenshot-delete[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  text-decoration: none;
}

.utilities-empty-state {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: #64748b;
}

.utilities-empty-state[hidden] {
  display: none;
}

.utilities-status {
  margin-bottom: 12px;
  font-size: 0.85rem;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
  color: #1f2937;
  border: 1px solid #e2e8f0;
}

.utilities-status[data-variant="error"] {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
}

.utilities-status[data-variant="success"] {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #047857;
}

.utilities-status[hidden] {
  display: none;
}

/* Status row with badge and toggle button */
.utilities-control__status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 200px;
  justify-content: flex-end;
}

/* Status badge for enabled/disabled states */
.utilities-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #d1d5db;
}

.utilities-status-badge--enabled {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #6ee7b7;
}

.utilities-status-badge--disabled {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

/* Utilities hint text */
.utilities-hint {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.4;
}

.utilities-hint-inline {
  font-weight: 400;
  color: #9ca3af;
  font-size: 0.85em;
}

/* Segmented button for binary choices */
.utilities-segmented-btn {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #d1d5db;
  background: #f9fafb;
}

.utilities-segmented-btn__option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.utilities-segmented-btn__option:not(:last-child) {
  border-right: 1px solid #d1d5db;
}

.utilities-segmented-btn__option:hover:not(.is-active) {
  background: #f3f4f6;
  color: #374151;
}

.utilities-segmented-btn__option.is-active {
  background: #6750a4;
  color: #fff;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.utilities-segmented-btn__option .material-symbols-outlined {
  font-size: 18px;
}

/* Dark theme overrides for status badge */
:root[data-theme="dark"] .utilities-status-badge--enabled {
  background: #064e3b;
  color: #6ee7b7;
  border-color: #047857;
}

:root[data-theme="dark"] .utilities-status-badge--disabled {
  background: #7f1d1d;
  color: #fca5a5;
  border-color: #b91c1c;
}

:root[data-theme="dark"] .utilities-hint {
  color: #94a3b8;
}

body.utilities-open .floating-toolbar {
  left: calc(10px + var(--utilities-panel-width, 450px));
}

@media (min-width: 769px) {
  body.bom-open .floating-toolbar {
    left: 460px;
  }

  body.bom-pinned #main-container,
  body.bom-pinned .configurator-footer {
    margin-left: 450px;
    width: calc(100vw - 450px);
    max-width: calc(100vw - 450px);
    box-sizing: border-box;
    transition: margin-left 0.3s ease, width 0.3s ease;
  }

  body.bom-pinned.utilities-open #main-container,
  body.bom-pinned.utilities-open .configurator-footer {
    margin-left: var(--utilities-panel-width, 450px);
    width: calc(100vw - var(--utilities-panel-width, 450px));
    max-width: calc(100vw - var(--utilities-panel-width, 450px));
  }

  body.bom-pinned #viewer-container {

    flex: 1 1 auto;

  }
}

body.bom-pinned #bom-panel {
  left: 0;
}

.bom-wrapper-embedded {
  top: 0px !important;
  height: calc(100vh - 61px) !important;
}

.controls-panel-embedded {
  height: calc(100vh - 20px - var(--footer-height, 6px)) !important;
}

/* Drawings Panel wrapper */
#drawings-panel {
  position: fixed;
  top: 60px;
  left: -610px;
  width: 600px;
  height: calc(100vh - 121px);
  background: #fff;
  border-right: 1px solid #ccc;
  box-shadow: none;
  visibility: hidden;
  transition: left 0.3s ease, box-shadow 0.3s ease, visibility 0s 0.3s;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  font-family: 'Roboto', sans-serif;
}

#drawings-panel.visible {
  left: 0;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  visibility: visible;
  transition: left 0.3s ease, box-shadow 0.3s ease, visibility 0s 0s;
}

.drawings-content {
  padding: 10px;
  overflow-y: auto;
}

.drawings-section {
  margin-bottom: 10px;
}

.drawing-border {
  border: 2px solid #000;
  aspect-ratio: 297 / 210;
  /* A4 landscape */
  width: 100%;
  max-width: 1000px;
  margin: 0 auto 10px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0px;
  position: relative;
}

.drawing-border svg {
  flex: 1;
  width: 100%;
  height: auto;
}

.drawing-info {
  border-top: 2px solid #000;
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.drawing-disclaimer {
  font-size: 12px;
  text-align: center;
  padding: 4px 0;
  color: red;
}

.drawing-info-item {
  flex: 1 1 calc(20% - 4px);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding: 10px;
  box-sizing: border-box;
  border-right: 2px solid black;
}

.drawing-info-item:nth-child(5n) {
  border-right: none;
  max-width: 150px;
}

.drawing-info-item:nth-child(4n) {
  max-width: 150px;
}

.hole-legend {
  position: absolute;
  top: 0px;
  right: 0px;
  z-index: 10;
  background: #fff;
  margin: 0;
  border-left: 2px solid #000;
  border-bottom: 2px solid #000;
  border-top: none;
  border-right: none;
  border-collapse: collapse;
  font-size: 10px;
}

.hole-legend th,
.hole-legend td {
  border: 2px solid #000;
  padding: 2px 4px;
}

.hole-legend tr:first-child th,
.hole-legend tr:first-child td {
  border-top: none;
}

.hole-legend th:last-child,
.hole-legend td:last-child {
  border-right: none;
}

.drawings-header {
  font-weight: 400;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawing-actions {
  display: flex;
  gap: 6px;
}

.drawing-actions span {
  cursor: pointer;
}

.drawing-edit-icon {
  font-size: 18px;
  color: #666;
  transition: color 0.2s;
}

.drawing-edit-icon:hover {
  color: #1976d2;
}

.drawing-name-input {
  font: inherit;
  font-size: 14px;
  padding: 2px 6px;
  border: 1px solid #1976d2;
  border-radius: 4px;
  outline: none;
  width: 200px;
  max-width: 60%;
}

.drawing-desc-item {
  display: flex !important;
  align-items: center;
  gap: 4px;
}

.drawing-desc-edit {
  font-size: 14px;
  flex-shrink: 0;
}

.drawing-desc-input {
  font-size: 12px;
  width: 140px;
}

.drawing-bom-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  margin-top: 6px;
  font-size: 12px;
  background: #f5f5f5;
  border: 1px dashed #bbb;
  border-radius: 6px;
}

.drawing-bom-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

.drawing-bom-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.drawing-bom-price {
  align-items: center;
  gap: 4px;
  font-size: 12px;
  white-space: nowrap;
}

.drawing-price-input {
  width: 80px;
  padding: 2px 6px;
  font: inherit;
  font-size: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  outline: none;
}

.drawing-price-input:focus {
  border-color: #1976d2;
}

.drawing-bom-supplier {
  align-items: center;
  font-size: 12px;
  color: #555;
  white-space: nowrap;
}

.hole-grid {
  font-size: 0.85rem;
}

.hole-grid-row {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr 1fr;
  align-items: center;
  cursor: pointer;
  padding: 5px 0px;
}

.hole-grid-header {
  background-color: #ececec;
  font-weight: 400;
}

.hole-grid-cell {
  padding: 4px 8px;
  text-align: center;
}

.hole-grid-row:hover {
  background-color: #f5faff;
}

.hole-grid-section summary {
  background-color: #ececec;
  padding: 4px 8px;
  cursor: pointer;
  font-weight: 500;
  margin-top: 10px;
}

.hole-grid-section summary:hover {
  background-color: #f5faff;
}

.hole-letter {
  /* 1) remove the default padding */
  padding: 0;
  margin: auto;

  /* 2) force a square */
  width: 32px;
  /* adjust diameter to taste */
  height: 32px;
  border-radius: 50%;

  /* 3) center the text inside */
  display: flex;
  align-items: center;
  justify-content: center;

  /* preserve your dynamic BG and text color */
  font-weight: 500;
  color: #fff;
}

/* --- Simple dimension styles used in drawing previews --- */
.dim-line {
  stroke: #333;
  stroke-width: 1;
  fill: none;
}

.dim-text {
  fill: #333;
  font-size: 10px;
  font-family: monospace;
}


/* BOM Header Section */
.bom-header {
  padding: 10px;
  border-bottom: 1px solid #ddd;
  background: #f9f9f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bom-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.bom-actions .bom-utilities,
.bom-actions .bom-copy,
.bom-actions .bom-pin,
.bom-actions .bom-close {
  position: static;
  top: auto;
  right: auto;
}

.bom-actions .bom-copy,
.bom-actions .bom-pin,
.bom-actions .bom-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #eef2ff;
  color: #374151;
  border: 1px solid #d7dfe9;
}

.bom-actions .bom-close {
  font-size: 1.2rem;
  text-decoration: none;
  line-height: 1;
}

.bom-actions .bom-utilities {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #d7dfe9;
  background: #f3f6fd;
  color: #1f2937;
}

.bom-debug-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid #1e74ff;
  background: #0d6efd;
  color: #fff;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

.bom-debug-toggle .material-symbols-outlined {
  font-size: 1.2rem;
}

.bom-title {
  font-size: 1.2em;
  font-weight: 500;
  margin-bottom: 0px;
}

.bom-subtitle {
  font-size: 0.95em;
  color: #444;
}

.bom-view-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0px;
}

.bom-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #d0d0d0;
  background: #fff;
  color: #333;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.bom-view-btn .material-symbols-outlined {
  font-size: 18px;
}

.bom-view-btn:hover {
  background: #f4f4f4;
}

.bom-view-btn.is-active {
  background: #410f9f;
  border-color: #410f9f;
  color: #fff;
}

.bom-view-btn:focus-visible {
  outline: 2px solid #410f9f;
  outline-offset: 2px;
}

.bom-view {
  display: none;
  margin-top: 8px;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.bom-view.is-active {
  display: block;
}

.bom-view[hidden] {
  display: none !important;
}

.bom-actions {
  display: flex;
  justify-content: center;
  padding: 16px 0;
  margin-top: 8px;
}

/* BOM Build Quantity Section */
.bom-qty-section {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  border-bottom: 1px solid #e9ecef;
}

.bom-qty-field {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.bom-qty-field label {
  font-size: 11px;
  font-weight: 500;
  color: #6c757d;
  font-style: italic;
  white-space: nowrap;
}

.bom-qty-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bom-qty-controls .md3-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
}

.bom-qty-controls input[type="number"] {
  width: 45px;
  text-align: center;
  padding: 4px 2px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
  height: 32px;
}

.bom-qty-controls input[type="number"]::-webkit-inner-spin-button,
.bom-qty-controls input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.bom-qty-totals {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
}

.bom-price-column {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
}

.bom-price-label {
  font-size: 9px;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.2;
}

.bom-total-price {
  font-size: 18px;
  font-weight: 600;
  color: #212529;
  line-height: 1.2;
}

/* MOQ indicator states - Band colors */
/* Band 1: 1-30% of MOQ - RED (highest price, 60% markup) */
.bom-moq-indicator.moq-band-1 {
  background: #f8d7da;
  border-color: #dc3545;
  color: #721c24;
}

/* Band 2: 31-99% of MOQ - ORANGE (medium price, 30% markup) */
.bom-moq-indicator.moq-band-2 {
  background: #fff3cd;
  border-color: #ffc107;
  color: #856404;
}

/* Band 3: MOQ or more - GREEN (base price, no markup) */
.bom-moq-indicator.moq-band-3,
.bom-moq-indicator.moq-met {
  background: #d4edda;
  border-color: #28a745;
  color: #155724;
}

/* Stacked view band colors */
.bom-stacked-metric.bom-moq-indicator.moq-band-1 {
  background: #f8d7da;
  border-color: #dc3545;
}

.bom-stacked-metric.bom-moq-indicator.moq-band-1 .bom-stacked-metric-label,
.bom-stacked-metric.bom-moq-indicator.moq-band-1 .bom-stacked-metric-value {
  color: #721c24;
}

.bom-stacked-metric.bom-moq-indicator.moq-band-2 {
  background: #fff3cd;
  border-color: #ffc107;
}

.bom-stacked-metric.bom-moq-indicator.moq-band-2 .bom-stacked-metric-label,
.bom-stacked-metric.bom-moq-indicator.moq-band-2 .bom-stacked-metric-value {
  color: #856404;
}

.bom-stacked-metric.bom-moq-indicator.moq-band-3,
.bom-stacked-metric.bom-moq-indicator.moq-met {
  background: #d4edda;
  border-color: #28a745;
}

.bom-stacked-metric.bom-moq-indicator.moq-band-3 .bom-stacked-metric-label,
.bom-stacked-metric.bom-moq-indicator.moq-band-3 .bom-stacked-metric-value,
.bom-stacked-metric.bom-moq-indicator.moq-met .bom-stacked-metric-label,
.bom-stacked-metric.bom-moq-indicator.moq-met .bom-stacked-metric-value {
  color: #155724;
}

/* MOQ Legend/Key */
.moq-legend {
  display: none;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 12px 0;
  font-size: 12px;
}

.moq-legend.visible {
  display: block;
}

.moq-legend-title {
  font-weight: 600;
  margin-bottom: 8px;
  color: #495057;
  display: flex;
  align-items: center;
  gap: 6px;
}

.moq-legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.moq-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.moq-legend-color {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid;
  flex-shrink: 0;
}

.moq-legend-color.band-1 {
  background: #f8d7da;
  border-color: #dc3545;
}

.moq-legend-color.band-2 {
  background: #fff3cd;
  border-color: #ffc107;
}

.moq-legend-color.band-3 {
  background: #d4edda;
  border-color: #28a745;
}

.moq-legend-text {
  color: #495057;
  line-height: 1.3;
}

.moq-legend-text strong {
  display: block;
  font-size: 11px;
  color: #212529;
}

.moq-legend-text span {
  font-size: 10px;
  color: #6c757d;
}

/* Fittings section */
.fittings-section {
  background: #f0f4f8;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  padding: 12px;
  margin: 10px 0;
  font-size: 12px;
}

.fittings-section-title {
  font-weight: 600;
  margin-bottom: 8px;
  color: #495057;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.fittings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.fittings-table th {
  text-align: left;
  padding: 4px 6px;
  border-bottom: 1px solid #c0c8d0;
  color: #495057;
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.fittings-table td {
  padding: 3px 6px;
  border-bottom: 1px solid #e4e8ec;
  color: #333;
}

.fittings-table tr:last-child td {
  border-bottom: none;
}

#bom-stacked-view,
#bom-tile-view {
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  padding: 0 10px 10px;
}

#bom-stacked-view.is-active {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bom-stacked-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  background: #fff;
  font-size: 12px;
  color: #424242;
}

.bom-stacked-row.is-surcharge {
  background: #fbf7ff;
  border-color: #d9c5ff;
}

.bom-stacked-primary {
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.bom-stacked-code {
  font-weight: 600;
  color: #333;
  word-break: break-word;
}

.bom-stacked-description {
  color: #555;
  line-height: 1.4;
  word-break: break-word;
}

.bom-stacked-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-left: auto;
  align-items: center;
  justify-content: flex-end;
}

.bom-stacked-metric {
  display: flex;
  flex-direction: column;
  min-width: 72px;
  text-align: right;
}

.bom-stacked-metric-label {
  font-size: 11px;
  color: #757575;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.bom-stacked-metric-value {
  font-weight: 600;
  color: #333;
}

.bom-moq-indicator {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 4px;
  padding: 2px 6px;
  color: #856404;
  font-size: 11px;
  font-weight: 500;
}

.bom-stacked-metric.bom-moq-indicator {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 4px;
  padding: 4px 8px;
}

.bom-stacked-metric.bom-moq-indicator .bom-stacked-metric-label {
  color: #856404;
}

.bom-stacked-metric.bom-moq-indicator .bom-stacked-metric-value {
  color: #856404;
}

/* MOQ Split Display - Shows MOQ threshold alongside project contribution */
.moq-split-display {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.moq-project-contribution {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #e0f2fe;
  border: 1px solid #0ea5e9;
  color: #0369a1;
  cursor: help;
}

/* Darker theme for dark mode */
body.dark-mode .moq-project-contribution {
  background: #0c4a6e;
  border-color: #0ea5e9;
  color: #bae6fd;
}

/* Stacked view project contribution metric */
.moq-project-contribution-metric {
  background: #e0f2fe !important;
  border: 1px solid #0ea5e9 !important;
}

.moq-project-contribution-metric .bom-stacked-metric-label,
.moq-project-contribution-metric .bom-stacked-metric-value {
  color: #0369a1 !important;
}

body.dark-mode .moq-project-contribution-metric {
  background: #0c4a6e !important;
  border-color: #0ea5e9 !important;
}

body.dark-mode .moq-project-contribution-metric .bom-stacked-metric-label,
body.dark-mode .moq-project-contribution-metric .bom-stacked-metric-value {
  color: #bae6fd !important;
}

.bom-stacked-total {
  margin-top: 4px;
  padding: 12px 16px;
  border-radius: 10px;
  background: #f3f0ff;
  color: #2f1a73;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
}

#bom-tile-view.is-active {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bom-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.bom-tile {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 220px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.bom-tile-image {
  height: 150px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bom-tile-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.bom-tile-body {
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
}

.bom-tile-code {
  font-weight: 600;
  color: #333;
  word-break: break-word;
}

.bom-tile-description {
  font-size: 12px;
  color: #555;
  line-height: 1.4;
  min-height: 36px;
}

.bom-tile-meta {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: #333;
}

.bom-tile-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.bom-tile-summary {
  padding: 12px 16px;
  border-radius: 10px;
  background: #f3f0ff;
  color: #2f1a73;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
}

.bom-placeholder,
.bom-empty-state {
  padding: 16px;
  text-align: center;
  color: #6d6d6d;
  font-size: 0.95em;
  border: 1px dashed #d0d0d0;
  border-radius: 10px;
  background: #fafafa;
}

.bom-empty-state {
  margin-top: 8px;
}

#fittings-header {
  margin-top: 20px;
}

/* Close link */
.bom-close {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 0.9em;
  color: #333;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
}

.bom-close:hover {
  text-decoration: underline;
}

/* BOM Table */
#bom-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  overflow-y: auto;
}

#bom-table thead {
  background: #f1f1f1;
  font-size: 0.85em;
  font-weight: normal;
  text-transform: uppercase;
}

#bom-table tbody {
  display: block;
  overflow-y: auto;
  max-height: calc(100vh - 180px);
  /* subtract header height */
  width: 100%;
  color: #616161;
}

#bom-table thead tr,
#bom-table tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

#bom-table th,
#bom-table td {
  border-bottom: 1px solid #ccc;
  padding: 8px 2px;
  font-size: 12px;
  text-align: left;
}

#bom-table th {
  font-weight: 200 !important;
  /* override with !important */
  font-size: 0.85em;
  text-transform: uppercase;
  color: #333;
  background: #f9f9f9;
  padding: 8px 2px;
}

/* Fittings table mirrors BOM table styling */
#fittings-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

#fittings-table thead {
  background: #f1f1f1;
  font-size: 0.85em;
  font-weight: normal;
  text-transform: uppercase;
}

#fittings-table tbody {
  display: block;
  overflow-y: auto;
  max-height: calc(100vh - 180px);
  width: 100%;
  color: #616161;
}

#fittings-table thead tr,
#fittings-table tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

#fittings-table th,
#fittings-table td {
  border-bottom: 1px solid #ccc;
  padding: 8px 2px;
  font-size: 12px;
  text-align: left;
}

#fittings-table th {
  font-weight: 200 !important;
  font-size: 0.85em;
  text-transform: uppercase;
  color: #333;
  background: #f9f9f9;
  padding: 8px 2px;
}

/* Container for the color select buttons */
.center-text {
  text-align: center !important;
}

.color-select-group {
  width: 100%;
  margin-top: 8px;
  margin-bottom: 0;
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
}

.color-group-label {
  display: block;
  /* forces label to its own row */
  font-weight: 300;
  font-size: 0.8em;
  margin: 5px 0 5px 0;
  /* space above/below label */
  color: var(--controls-label);
  width: 100%;
}

.color-select-row {
  display: flex;
  flex-direction: row;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}

/* Individual color select button */
.color-select-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  /* Makes the button round */
  border: 2px solid transparent;
  box-sizing: border-box;
  cursor: pointer;
  background: #fff;
  /* fallback background */
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
  box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.2);
}

:root[data-theme="dark"] .color-select-button {
  box-shadow: 0 0 3px 3px rgba(255, 255, 255, 0.4);
}

/* Hover effect for the button */
.color-select-button:hover {
  transform: scale(1.1);
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.3);
}

.visible-parts {
  font-size: 1.2rem;
  color: var(--controls-label);
}

/* Active state for the button */
.color-select-button.active {
  border-color: #007bff;
  /* Change this to your preferred active border color */
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.3);
}

.parts-list {
  width: 100%;
  overflow-y: auto;
  color: var(--controls-label);

  padding: 8px 0;
}

.parts-list .item {
  margin: 0px 0px;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 6px 0px;
}

.parts-list .item:hover {
  background: var(--border-colour);
}

.visible-parts-comment {
  font-size: 0.7rem;
  color: var(--controls-label);
  margin-top: 2px;
  margin-bottom: 4px;
  font-style: normal;
}

/* Image inside the color select button */
.color-select-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  /* Matches the button's round shape */
  object-fit: cover;
  display: block;
}

.color-select-button.round,
.color-select-img.round {
  border-radius: 50%;
}

/* square override */
.color-select-button.square,
.color-select-img.square {
  border-radius: 0;
}


.color-hidden,
.md3-swatch-tile.color-hidden,
.color-select-button-wrap.color-hidden {
  display: none !important;
}



.control-wrapper {
  margin-bottom: 5px;
  border-bottom: 1px solid var(--border-colour);
  padding-bottom: 10px;
}

.control-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 5px;
}

.control-label {
  margin-right: 10px;
  color: var(--controls-label);
  font-size: 0.9rem;
}

.value-display {
  font-size: 14px;
  color: var(--highlight-blue);
}

.range-details {
  font-size: 12px;
  color: var(--controls-label);
  margin-top: 4px;
  display: none;
}

/* Slider with increment buttons */
.slider-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.slider-inc-btn {
  width: 30px;
  height: 24px;
  background: #eee;
  border: 1px solid #ccc;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.slider-inc-btn:hover {
  background: #ddd;
}


/* Improved Range Slider Styling — visual handled by md3-slider */
.styled-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  outline: none;
}

.styled-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--accent-color, #1a1a1a);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.styled-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.styled-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--accent-color, #1a1a1a);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.styled-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.styled-number {
  width: 80px;
  padding: 4px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Improved Color Picker Styling */
.styled-color {
  -webkit-appearance: none;
  appearance: none;
  width: 40px;
  height: 40px;
  border: 1px solid #ccc;
  border-radius: 25px;
  cursor: pointer;
  padding: 0;
}

.styled-color::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 5px;
}

.styled-color::-webkit-color-swatch {
  border: none;
  border-radius: 5px;
}

.thumbnail-select {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}


.thumbnail-icon,
.thumbnail-icon-text {
  margin-bottom: 6px;
}

.thumbnail-icon {
  width: 50px;
  height: 50px;
  object-fit: contain;
}

.thumbnail-icon-text {
  font-size: 30px;
}

.thumbnail-label {
  font-size: 13px;
  line-height: 1.2;
}

.slider-button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.slider-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.slider-input-group input[type="number"] {
  width: 80px;
  padding: 4px;
}

.slider-apply-btn {
  padding: 6px 12px;
  background: #eee;
  border: 1px solid #ccc;
  cursor: pointer;
}

.slider-apply-btn:hover {
  background: #ddd;
}

.slider-button {
  padding: 6px 12px;
  background: #eee;
  border: 1px solid #ccc;
  border-radius: 0px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s, transform 0.2s;
}

.slider-button:hover {
  background: #ddd;
  transform: translateY(-1px);
}

.slider-button.active {
  background: #2196f3;
  color: white;
  border-color: #2196f3;
}


@media (max-width: 768px) {

  /* --- Main Layout Overrides --- */
  body:not(.compact-embed) #main-container {
    flex-direction: column;
    display: block;
    /* Ensure it stacks block-level */
  }

  /* 1. Force the container height */
  body:not(.compact-embed) #viewer-container {
    width: 100% !important;
    /* 100vh - (Header 60 + Footer 60 + Controls 250) = 370px space needed */
    height: calc(100vh - 370px) !important;
    min-height: 200px;
    flex: none !important;
    position: relative;
    /* Ensure canvas positions absolute relative to this */
    overflow: hidden !important;
  }

  /* 2. FORCE the canvas to fit the container, ignoring Three.js inline styles */
  body:not(.compact-embed) #viewer-container canvas {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    outline: none;
  }

  /* 3. Ensure controls take the exact remaining space */
  body:not(.compact-embed) #controls {
    position: fixed !important;
    bottom: 60px !important;
    /* Sits on top of footer */
    left: 0 !important;
    width: 100% !important;
    height: 250px !important;
    z-index: 999;
  }

  /* --- Panels & Utilities --- */
  body:not(.compact-embed) #utilities-panel {
    --utilities-panel-width: 100vw;
    --utilities-panel-offset: 100vw;
    left: 0;
    width: 100vw;
    height: calc(100vh - 60px);
    transform: translateX(calc(-1 * var(--utilities-panel-offset)));
    border-right: none;
  }

  body:not(.compact-embed) #utilities-panel.is-visible {
    transform: translateX(0);
    z-index: 1000;
  }

  body:not(.compact-embed) .utilities-panel__content {
    padding-bottom: 80px;
  }

  body:not(.compact-embed).utilities-open .floating-toolbar {
    left: 10px;
  }

  body:not(.compact-embed) .bom-utilities {
    right: 96px;
    font-size: 0.8rem;
  }

  /* --- Components --- */
  body:not(.compact-embed) .thumbnail-icon {
    width: 60px;
    height: 60px;
  }

  body:not(.compact-embed) .checkboxStyle1 input[type="checkbox"] {
    width: 80px;
    height: 40px;
    border-radius: 20px;
  }

  body:not(.compact-embed) .checkboxStyle1 input[type="checkbox"]::before {
    top: 2px;
    left: 2px;
    width: 36px;
    height: 36px;
  }

  body:not(.compact-embed) .checkboxStyle1 input[type="checkbox"]:checked::before {
    transform: translateX(39px);
  }

  body:not(.compact-embed) .checkbox-cont1 {
    max-width: 200px;
    align-content: center;
  }

  /* --- Footer --- */
  body:not(.compact-embed) .configurator-footer {
    flex-direction: row;
    height: var(--footer-height, 60px);
    padding: 0 10px;
    font-size: 12px;
    justify-content: space-between;
    gap: 0;
  }

  body:not(.compact-embed) .footer-center {
    display: none;
  }

  body:not(.compact-embed) .footer-left {
    font-size: 16px;
    font-weight: normal;
  }

  body:not(.compact-embed) .footer-button {
    padding: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    /* hide text */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  }

  body:not(.compact-embed) .footer-button span.material-symbols-outlined {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    font-size: 26px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    text-align: center;
    padding-left: 6px;
  }

  body:not(.compact-embed) .footer-right {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  /* --- Controls Container --- */
  body:not(.compact-embed) #controls-container {
    display: flex;
    flex-direction: row;
    gap: 16px;
    padding: 0 10px;
    min-width: max-content;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  body:not(.compact-embed) .control-wrapper {
    flex: 0 0 auto;
    min-width: 90vw;
    border: none;
    border-right: none;
    padding: 0 10px;
    scroll-snap-align: start;
  }

  body:not(.compact-embed) .control-top-row {
    flex-direction: column;
    align-items: flex-start;
  }

  body:not(.compact-embed) .control-label {
    font-size: 14px;
    margin-bottom: 4px;
  }

  body:not(.compact-embed) .value-display {
    font-size: 16px;
    align-self: center;
    text-align: center;
    margin-top: 4px;
  }

  body:not(.compact-embed) .range-details {
    display: none;
  }

  /* --- Sliders & Inputs --- */
  body:not(.compact-embed) .slider-control {
    gap: 4px;
  }

  body:not(.compact-embed) .slider-inc-btn {
    width: 34px;
    height: 34px;
  }

  body:not(.compact-embed) .styled-slider {
    width: 100%;
    height: 30px;
    border-radius: 20px;
  }

  body:not(.compact-embed) .styled-slider::-webkit-slider-thumb {
    width: 30px;
    height: 30px;
  }

  body:not(.compact-embed) .styled-color {
    width: 40px;
  }

  body:not(.compact-embed) .thumbnail-select {
    overflow-x: auto;
    padding-bottom: 10px;
  }

  body:not(.compact-embed) .configItem img {
    width: 80px;
    height: 80px;
  }

  /* --- Color Selection Groups --- */
  body:not(.compact-embed) .color-select-group {
    margin-top: 3px;
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    width: 100%;
    scroll-snap-type: x mandatory;
    gap: 32px;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
    min-height: 90px;
  }

  body:not(.compact-embed) .color-group-label {
    font-size: 0.8em;
    font-weight: 300;
    margin: 4px 0 4px 0;
    width: 100%;
  }

  body:not(.compact-embed) .color-select-row {
    display: flex;
    flex-direction: row;
    gap: 10px;
    justify-content: flex-start;
    width: 100%;
    margin-bottom: 18px;
  }

  body:not(.compact-embed) .color-select-tab {
    max-width: 100vw;
    scroll-snap-align: start;
    padding-right: 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  /* --- Parts List --- */
  body:not(.compact-embed) .parts-list {
    position: fixed;
    top: 100px;
    right: 10px;
    width: 140px;
    background-color: white;
    border: 2px solid var(--border-colour);
    padding: 10px;
    font-size: 0.6rem;
    max-height: 100px;
    overflow-y: auto;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  }

  body:not(.compact-embed) .parts-list .item {
    font-size: 0.6rem;
    padding: 3px 0px;
    margin: 0px;
    color: var(--controls-label);
  }

  body:not(.compact-embed) .visible-parts {
    font-size: 0.9rem;
    color: var(--controls-label);
  }

  body:not(.compact-embed) .visible-parts-comment {
    color: var(--controls-label);
  }

  body:not(.compact-embed) #visiblePartsPanel {
    color: var(--controls-label);
    background-color: var(--controls-bg);
    display: none;
  }

  /* --- Zoom & Other --- */
  body:not(.compact-embed) .zoom-toolbar {
    position: fixed;
    bottom: 240px;
    left: 50%;
    transform: translateX(-50%);
  }

  /* Slider display fixes for mobile */
  body:not(.compact-embed) #controls div:not(.slider-container):not(.slider-display):not(.slider-label) {
    margin-bottom: 0px !important;
  }

  body:not(.compact-embed) .slider-display {
    margin-bottom: 0px;
  }

  body:not(.compact-embed) .slider-image {
    width: 40px;
    height: 40px;
  }

  body:not(.compact-embed) .slider-label {
    margin-top: 0px;
    font-size: 0.7rem;
  }

  body:not(.compact-embed) .bomIcons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 10px;
  }

  body:not(.compact-embed) .bomIcons .excel-export-btn,
  body:not(.compact-embed) .bomIcons .pdf-export-btn {
    background: none;
    padding: 0;
    margin: 0;
    box-shadow: none;
    border: none;
  }

  body:not(.compact-embed) .bomIcons img {
    width: 22px;
    height: 22px;
    display: block;
  }

  .control-label,
  .md3-switch-label {
    color: white;
  }
}


/* ---------------- Pill Slider Styles ---------------- */
:root {
  --component-width: 80%;
  --label-width: 80px;
  --component-gap: 24px;
  --track-height: 2px;
  --pill-height: 40px;
  --pill-padding: 0 16px;
  --pill-bg: #fff;
  --pill-border: #ccc;
  --pill-radius: 999px;
  --pill-color: #333;
  --btn-size: 32px;
  --btn-border: #ccc;
  --btn-color: #333;
  --accent: #ff5722;
  --gap: 16px;
  --drag-size: 20px;
  --float-bg: #fff;
  --float-shadow: rgba(60, 92, 249, 0.25);
}

.slider-component {
  display: flex;
  align-items: center;
  width: var(--component-width);
  gap: var(--component-gap);
}

.slider-label {
  width: var(--label-width);
  flex-shrink: 0;
}

.slider-bar-wrap {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  height: var(--pill-height);
  display: flex;
  align-items: center;
  user-select: none;
}

.slider-rail {
  position: absolute;
  left: 0;
  right: 0;
  height: var(--track-height);
  background: #ccc;
  border-radius: var(--track-height);
}

.slider-rail-fill {
  position: absolute;
  left: 0;
  height: var(--track-height);
  background: var(--accent);
  border-radius: var(--track-height);
  width: 50%;
  transition: width 0.1s;
}

.slider-snap {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.slider-btn {
  position: absolute;
  top: 50%;
  width: var(--btn-size);
  height: var(--btn-size);
  border-radius: 50%;
  border: 2px solid var(--btn-border);
  background: #fff;
  color: var(--btn-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity .15s, border-color .15s, color .15s;
  z-index: 3;
}

.slider-bar-wrap:hover .slider-btn {
  opacity: 1;
  border-color: var(--accent);
  color: var(--accent);
}

.slider-btn.dec {
  left: calc(var(--pos) - (var(--pill-width)/2) - var(--btn-size) - var(--gap) - 2px);
}

.slider-btn.inc {
  left: calc(var(--pos) + (var(--pill-width)/2) + var(--gap) + 2px);
}

.slider-pill {
  position: absolute;
  top: 50%;
  left: var(--pos);
  transform: translate(-50%, -50%);
  height: var(--pill-height);
  padding: var(--pill-padding);
  background: var(--pill-bg);
  border: 2px solid var(--pill-border);
  border-radius: var(--pill-radius);
  color: var(--pill-color);
  font-weight: bold;
  cursor: grab;
  transition:
    border-color .2s,
    color .2s,
    width .2s,
    padding .2s,
    border-radius .2s,
    background .2s;
  z-index: 2;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slider-bar-wrap:hover .slider-pill {
  border-color: var(--accent);
  color: var(--accent);
}

.slider-bar-wrap.dragging .slider-btn {
  opacity: 0 !important;
  pointer-events: none;
}

.slider-bar-wrap.dragging .slider-pill {
  width: var(--drag-size);
  height: var(--drag-size);
  padding: 0;
  border-radius: 50%;
  cursor: grabbing;
}

.slider-value-float {
  position: fixed;
  pointer-events: none;
  transform: translate(-50%, -100%);
  background: var(--float-bg);
  color: var(--accent);
  font-weight: bold;
  border-radius: 8px;
  box-shadow: 0 4px 16px var(--float-shadow);
  padding: 4px 12px;
  z-index: 10;
  animation: popUp .15s cubic-bezier(.65, 1.6, .54, .97);
}

@keyframes popUp {
  from {
    opacity: 0;
    transform: translate(-50%, -80%) scale(.85);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -100%) scale(1);
  }
}

#controls {
  margin: 10px;
  background-color: white;
  border-radius: 20px;
  width: 400px;
  height: calc(100vh - 80px - var(--footer-height, 60px));
  padding: 20px;
  border-left: none;
  border-top: none;


}

#main-container {
  background-color: #f0f0f0;
}

#viewer-container {
  border: none;
}

.floating-toolbar {
  position: fixed;
  top: 70px;
  /* consistent top offset */
  left: 10px;
  z-index: 49;
  background-color: var(--controls-bg);
  border-radius: 50px;
  overflow: hidden;
}

.toolbar-toggle {
  all: unset;
  display: none;
  align-items: center;
  justify-content: center;
  background-color: var(--controls-bg);
  color: var(--controls-label);
  padding: 10px;
  border-radius: 6px;
  font-size: 24px;
  cursor: pointer;
}

.toolbar-button-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* remove gaps between toolbar buttons in the floating toolbar */
.floating-toolbar .toolbar-button-list {
  gap: 0;
}

.toolbar-button {
  all: unset;
  /* Reset all built-in styles */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--controls-bg);
  color: var(--controls-label);
  padding: 10px;
  border-radius: 6px;
  font-size: 24px;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

/* square buttons inside floating toolbar so outer container radii form panel */
.floating-toolbar .toolbar-button {
  border-radius: 0;
}

.floating-toolbar {
  overflow: visible;
}

.toolbar-button-item {
  position: relative;
  display: block;
}

@media (min-width: 769px) {
  .floating-toolbar .toolbar-toggle {
    display: none;
  }
}

.print-modal {

  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.print-modal.visible {
  display: flex;
}

.print-modal .print-content {
  position: relative;
  background: #fff;
  width: min(100vw, calc(100vh * 297 / 210));
  height: min(100vh, calc(100vw * 210 / 297));
  aspect-ratio: 297 / 210;
}

.print-modal .print-area {
  width: 100%;
  height: 100%;
}

.print-modal .drawing-border {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
}

.modal-print-btn,
.modal-close-btn {
  position: absolute;
  top: 10px;
  background: #fff;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.modal-print-btn {
  right: 10px;
}

.modal-close-btn {
  right: 60px;
}

.modal-print-btn .material-symbols-outlined,
.modal-close-btn .material-symbols-outlined {
  font-size: 24px;
}

#printModalBtn,
#closePrintModalBtn {
  z-index: 1000;
}

@media print {

  #printModalBtn,
  #closePrintModalBtn {
    display: none;
  }

  body * {
    visibility: hidden;
  }

  #printModal,
  #printModal * {
    visibility: visible;
  }

  #printModal .modal-print-btn,
  #printModal .modal-close-btn {
    visibility: hidden;
  }

  #printModal .print-content,
  #printModal .drawing-border {
    width: 297mm;
    height: 210mm;
  }

  .print-modal {
    background: transparent;
  }
}

@media print {
  body.print-page * {
    visibility: visible;
  }

  body.print-page {
    margin: 0;
  }

  body.print-page .drawing-border {
    width: 297mm;
    height: 210mm;
    max-width: none;
    aspect-ratio: auto;
  }
}

@page {
  size: A4 landscape;
  margin: 0;
}