/* BoxCraft CAD — Studio & Packaging Engineering Stylesheet */
:root {
  --bg-page: #F1F4F8;
  --bg-panel: #FFFFFF;
  --bg-subtle: #F1F5F9;
  --bg-input: #F8FAFC;
  --border-color: #DCE3EC;
  --border-strong: #CBD5E1;
  --text-primary: #0F172A;
  --text-nav: #1E293B;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --text-unit: #64748B;
  --cut-red: #E11D48;
  --cut-red-hover: #BE123C;
  --crease-blue: #2563EB;
  --slate-dark: #1E293B;
  --slate-dark-hover: #0F172A;
  --fit-green-bg: #DCFCE7;
  --fit-green-text: #15803D;
  --navbar-h: 54px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans JP", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select {
  font-family: inherit;
}

/* Top Navigation Header */
.top-navbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  height: var(--navbar-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15.5px;
  letter-spacing: 0.04em;
  color: var(--text-nav);
  white-space: nowrap;
  flex-shrink: 0;
}

.brand-link svg {
  width: 27px;
  height: 27px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 5px rgba(15, 23, 42, 0.16));
}

.brand-link strong {
  font-weight: 800;
}

.brand-link span {
  font-weight: 500;
  color: var(--cut-red);
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 100%;
  overflow-x: auto;
  margin-left: 32px;
  margin-right: auto;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-tab-item {
  display: inline-flex;
  align-items: center;
  height: 100%;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  border-top: 2px solid transparent;
  padding: 0 2px;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.nav-tab-item:hover {
  color: var(--text-primary);
}

.nav-tab-item.active {
  color: var(--text-primary);
  font-weight: 600;
  border-bottom-color: var(--cut-red);
}

.nav-right-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.unit-pill {
  display: inline-flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 2px 6px;
  height: 28px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-nav);
}

.unit-pill .unit-sep {
  color: var(--border-strong);
  padding: 0 3px;
}

.unit-btn {
  border: none;
  background: transparent;
  padding: 2px 5px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
}

.unit-btn.active {
  color: var(--text-primary);
  background: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  border-left: 1px solid var(--border-color);
  padding-left: 12px;
  height: 24px;
}

.lang-link {
  padding: 2px 4px;
  border-radius: 4px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.14s, background 0.14s;
}

.lang-link:hover {
  color: var(--text-primary);
}

.lang-link.active {
  color: var(--cut-red);
  background: rgba(225, 29, 72, 0.08);
  font-weight: 700;
}

/* Main App Container */
.app-shell {
  max-width: 1560px;
  margin: 0 auto;
  padding: 16px 24px 48px;
}

/* CAD Studio Grid Layout (Sidebar 308px + Split Workspace) — Fixed natural studio proportions, NO 100vh stretch */
.cad-studio-grid {
  display: grid;
  grid-template-columns: 308px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

/* Left Parameter Sidebar */
.param-sidebar {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.param-groups {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 14px;
  padding: 14px 16px;
}

.param-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid #EEF2F6;
}

.param-group:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.3;
  color: var(--text-muted);
  margin: 0 0 2px;
}

.dim-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
}

.dim-row > label {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.25;
  color: var(--text-nav);
}

.input-with-unit {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 0 9px 0 8px;
  width: 118px;
  height: 32px;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: border-color 0.15s, background 0.15s;
}

.dim-row.is-compact .input-with-unit,
.dim-row.is-compact .grid-select {
  width: 112px;
}

.input-with-unit:focus-within {
  background: var(--bg-panel);
  border-color: var(--crease-blue);
}

.input-with-unit input {
  border: none;
  background: transparent;
  width: 100%;
  min-width: 0;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  outline: none;
  padding: 0 5px 0 0;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.unit-suffix-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-unit);
  user-select: none;
}

/* Internal / External Switch Row */
.mode-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
  margin-top: 2px;
  padding: 4px 8px;
  background: var(--bg-subtle);
  border-radius: 6px;
}

.mode-label-btn {
  border: none;
  background: none;
  padding: 0;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
}

.mode-label-btn.active {
  color: var(--text-primary);
  font-weight: 600;
}

.switch-pill {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #CBD5E1;
  border: none;
  position: relative;
  cursor: pointer;
  padding: 2px;
  transition: background 0.15s;
}

.switch-pill .switch-thumb {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25);
  transition: transform 0.15s;
}

.switch-pill.is-external {
  background: var(--slate-dark);
}

.switch-pill.is-external .switch-thumb {
  transform: translateX(16px);
}

/* Material Select & Quick Chips */
.cad-select {
  width: 100%;
  height: 34px;
  padding: 0 28px 0 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  background-color: var(--bg-input);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23475569' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  text-overflow: ellipsis;
}

.cad-select:focus {
  border-color: var(--crease-blue);
}

.dim-row .cad-select {
  width: 148px;
  flex-shrink: 0;
  font-size: 12px;
}

.dim-row .grid-select {
  width: 112px;
  height: 32px;
  padding: 0 10px;
  text-align: center;
  text-align-last: center;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background-color: var(--bg-input);
  border-color: var(--border-strong);
}

.thickness-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.thickness-chip {
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  height: 28px;
  padding: 0 4px;
  border-radius: 5px;
  cursor: pointer;
  text-align: center;
  transition: all 0.14s;
}

.thickness-chip:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.thickness-chip.active {
  background: var(--slate-dark);
  color: #FFFFFF;
  border-color: var(--slate-dark);
  font-weight: 600;
}

/* Laser Kerf Input with Friction Fit Badge */
.kerf-input-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  height: 34px;
  padding: 0 5px 0 10px;
}

.kerf-input-box:focus-within {
  background: var(--bg-panel);
  border-color: var(--crease-blue);
}

.kerf-input-left {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.kerf-input-left input {
  border: none;
  background: transparent;
  width: 40px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  outline: none;
  padding: 0;
  -moz-appearance: textfield;
}

.kerf-badge {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--fit-green-bg);
  color: var(--fit-green-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.kerf-badge[data-tone="info"] {
  background: #DBEAFE;
  color: #1D4ED8;
}

.kerf-badge[data-tone="warning"] {
  background: #FEF3C7;
  color: #B45309;
}

.kerf-badge[data-tone="neutral"] {
  background: #E2E8F0;
  color: #475569;
}

/* CTA Export Buttons */
.export-cta-stack {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding: 12px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: #FAFBFD;
  border-radius: 0 0 8px 8px;
}

.btn-export {
  width: 100%;
  height: 35px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.14s ease;
}

.btn-export svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn-export:active {
  transform: translateY(1px);
}

.btn-export-svg {
  background: var(--cut-red);
  color: #FFFFFF;
  border: 1px solid #BE123C;
  box-shadow: 0 1px 2px rgba(225, 29, 72, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-export-svg:hover {
  background: var(--cut-red-hover);
}

.btn-export-dxf {
  background: var(--slate-dark);
  color: #FFFFFF;
  border: 1px solid #0F172A;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-export-dxf:hover {
  background: var(--slate-dark-hover);
}

.btn-export-pdf {
  background: #FFFFFF;
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.btn-export-pdf:hover {
  background: var(--bg-subtle);
  border-color: var(--text-secondary);
}

/* Right Split CAD Workspace */
.cad-workspace-card {
  background: #F8FAFC;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  display: grid;
  grid-template-columns: 44.5% minmax(0, 1fr);
  min-height: 620px;
  overflow: hidden;
  min-width: 0;
}

.workspace-pane-3d {
  position: relative;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse 75% 60% at 50% 50%, #FFFFFF 0%, #F9FAFC 55%, #F1F5F9 100%);
  min-width: 0;
}

.iso-viewport-box {
  position: relative;
  flex: 1;
  min-height: 0;
}

.iso-svg-canvas {
  position: absolute;
  inset: 24px 16px 20px;
  width: calc(100% - 32px);
  height: calc(100% - 44px);
  display: block;
  overflow: visible;
}

.viewport-tools {
  position: absolute;
  left: 14px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 2;
}

.viewport-select,
.btn-mini-tool {
  height: 28px;
  border: 1px solid var(--border-strong);
  background-color: rgba(255, 255, 255, 0.94);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  border-radius: 5px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.viewport-select {
  padding: 0 24px 0 9px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2364748B' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  max-width: 200px;
}

.btn-mini-tool {
  padding: 0 10px;
}

.btn-mini-tool.active,
.btn-mini-tool:hover,
.viewport-select:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.btn-mini-tool.active {
  background: var(--slate-dark);
  color: #FFFFFF;
  border-color: var(--slate-dark);
}

.workspace-pane-2d {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.workspace-pane-2d::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border-color);
}

.dieline-viewport-box {
  position: relative;
  flex: 1;
  min-height: 0;
}

.dieline-svg-canvas {
  position: absolute;
  inset: 18px 18px 14px 6px;
  width: calc(100% - 24px);
  height: calc(100% - 32px);
  display: block;
}

.workspace-status-bar {
  border-top: 1px solid var(--border-color);
  background: #F1F5F9;
  height: 38px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  text-align: center;
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.workspace-status-bar strong {
  font-weight: 600;
  color: var(--text-primary);
  margin-left: 0.35em;
}

.workspace-status-bar .status-panels strong {
  margin: 0 0.3em 0 0;
}

.workspace-status-bar span.sep {
  color: var(--border-strong);
  margin: 0 10px;
}

/* ===== Below-the-Fold McMaster-Carr Style CAD Template Explorer & Cut-List Reference ===== */
.cad-explorer-card {
  margin-top: 18px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
  overflow: hidden;
}

.cad-explorer-header {
  padding: 12px 18px;
  background: #F8FAFC;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.cad-explorer-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cad-explorer-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.cad-count-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--cut-red);
  background: rgba(225, 29, 72, 0.08);
  border: 1px solid rgba(225, 29, 72, 0.22);
  padding: 2px 8px;
  border-radius: 4px;
}

.cad-spec-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: 4px;
}

.cad-explorer-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cad-filter-tabs {
  display: inline-flex;
  align-items: center;
  background: #EEF2F6;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
  flex-wrap: wrap;
}

/* Native CAD Material & Hardware BOM Strip */
.cad-bom-strip {
  margin-top: 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.cad-bom-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.cad-bom-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.cad-bom-hook {
  font-size: 11.5px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--cut-red);
}

.cad-bom-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.cad-bom-card {
  background: var(--bg-input);
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cad-bom-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cad-bom-kicker {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cad-bom-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cad-bom-sub {
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cad-bom-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.cad-bom-btn {
  height: 27px;
  padding: 0 10px;
  border-radius: 5px;
  background: #FFFFFF;
  border: 1px solid var(--border-strong);
  color: var(--text-nav);
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.cad-bom-btn:hover {
  border-color: var(--slate-dark);
  color: var(--text-primary);
}

.cad-bom-btn-primary {
  background: var(--slate-dark);
  border-color: var(--slate-dark);
  color: #FFFFFF;
}

.cad-bom-btn-primary:hover {
  background: var(--cut-red);
  border-color: var(--cut-red);
  color: #FFFFFF;
}

@media (max-width: 980px) {
  .cad-bom-grid {
    grid-template-columns: 1fr;
  }
}

.cad-filter-btn {
  height: 26px;
  padding: 0 10px;
  border: none;
  border-radius: 4px;
  background: transparent;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.cad-filter-btn:hover {
  color: var(--text-primary);
}

.cad-filter-btn.active {
  background: #FFFFFF;
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.cad-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.cad-search-wrap svg {
  position: absolute;
  left: 9px;
  width: 13px;
  height: 13px;
  color: var(--text-muted);
  pointer-events: none;
}

.cad-search-input {
  height: 30px;
  width: 215px;
  padding: 0 10px 0 28px;
  background: #FFFFFF;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-primary);
  outline: none;
}

.cad-search-input:focus {
  border-color: var(--crease-blue);
}

.cad-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.cad-explorer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.cad-explorer-table th {
  padding: 8px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: #F4F7FA;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.cad-explorer-table td {
  padding: 8px 14px;
  border-bottom: 1px solid #EEF2F6;
  color: var(--text-secondary);
  white-space: nowrap;
}

.cad-explorer-table tbody tr:hover {
  background: #F8FAFC;
}

.cad-explorer-table tbody tr.is-current-preset {
  background: #FFF1F2;
}

.cad-table-wrap[data-collapsed="true"] tr.cad-row-extra {
  display: none;
}

.cad-explorer-table tbody tr.filtered-out {
  display: none !important;
}

.gen-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.03em;
}

.gen-badge.gen-finger-box {
  background: #FFE4E6;
  color: #BE123C;
  border: 1px solid #FECDD3;
}

.gen-badge.gen-tuck-box {
  background: #DBEAFE;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}

.gen-badge.gen-divider-tray {
  background: #FEF3C7;
  color: #B45309;
  border: 1px solid #FDE68A;
}

.gen-badge.gen-polygon-box {
  background: #DCFCE7;
  color: #15803D;
  border: 1px solid #BBF7D0;
}

.cad-row-link {
  font-weight: 600;
  color: var(--text-primary);
  transition: color 0.14s;
}

.cad-row-link:hover {
  color: var(--cut-red);
}

.dim-mode-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 5px;
}

.cad-row-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 8px;
  border-radius: 4px;
  background: #F8FAFC;
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
  transition: all 0.14s;
}

.cad-row-action:hover {
  background: var(--slate-dark);
  color: #FFFFFF;
  border-color: var(--slate-dark);
}

.cad-explorer-footer {
  padding: 10px 18px;
  background: #F8FAFC;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cad-explorer-status {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
}

.cad-toggle-all-btn {
  height: 28px;
  padding: 0 12px;
  border-radius: 5px;
  background: #FFFFFF;
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s;
}

.cad-toggle-all-btn:hover {
  background: var(--slate-dark);
  color: #FFFFFF;
  border-color: var(--slate-dark);
}

/* 2-Column Cut-List Schedule & Engineering Reference */
.cad-bottom-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
  align-items: start;
}

.engineering-section {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px 18px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.engineering-section h1 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--text-primary);
}

.engineering-section .intro-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 0 0 14px;
  line-height: 1.55;
}

.engineering-section h2 {
  font-size: 13.5px;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pane-legend-row {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 2.5px;
  margin-right: 5px;
  vertical-align: middle;
}

.schedule-table-wrap {
  overflow-x: auto;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.schedule-table th,
.schedule-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #EEF2F6;
  text-align: left;
  white-space: nowrap;
}

.schedule-table th {
  background: #F4F7FA;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-color);
}

.mono-cell {
  font-family: var(--font-mono);
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

details.faq-item {
  padding: 10px 14px;
  background: #F8FAFC;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

details.faq-item[open] {
  background: #FFFFFF;
  border-color: var(--border-strong);
}

summary.faq-q {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

summary.faq-q::-webkit-details-marker {
  display: none;
}

summary.faq-q::after {
  content: "+";
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-muted);
}

details.faq-item[open] summary.faq-q::after {
  content: "−";
  color: var(--cut-red);
}

.faq-item p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid #EEF2F6;
  line-height: 1.6;
}

.site-footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Responsive Breakpoints */
@media (max-width: 1120px) {
  .top-navbar {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 16px 0;
  }
  .nav-tabs {
    order: 3;
    width: 100%;
    margin: 0;
    height: 40px;
  }
  .nav-right-controls {
    margin-left: auto;
  }
  .cad-studio-grid,
  .cad-bottom-grid {
    grid-template-columns: 1fr;
  }
  .cad-workspace-card {
    grid-template-columns: 1fr;
  }
  .workspace-pane-3d,
  .workspace-pane-2d {
    min-height: 440px;
  }
  .workspace-pane-2d {
    border-top: 1px solid var(--border-color);
  }
  .workspace-pane-2d::before {
    display: none;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 12px 12px 32px;
  }
  .lang-switcher {
    border-left: none;
    padding-left: 0;
  }
  .workspace-status-bar {
    height: auto;
    padding: 8px 12px;
    white-space: normal;
  }
  .cad-search-input {
    width: 100%;
  }
}

@media print {
  .top-navbar,
  .param-sidebar,
  .cad-explorer-card,
  .faq-section,
  .viewport-tools,
  .btn-mini-tool {
    display: none !important;
  }
  .cad-studio-grid {
    display: block;
  }
  .cad-workspace-card {
    border: 1px solid #000;
  }
  .workspace-pane-3d,
  .workspace-pane-2d {
    min-height: 420px;
  }
}
