/* App-specific layout and component styles for Topology Optimization & DfM Lab.
   All colours and typography roles are referenced via /design/xallace-ui.css tokens. */

body {
  overflow-x: clip;
}

.control-col {
  position: sticky;
  top: 14px;
}

.plate-canvas-main {
  height: 360px;
}

.plate-canvas-chart {
  height: 155px;
}

.plate-canvas-matrix {
  height: 225px;
}

.plate-canvas-hybrid {
  height: 295px;
}

/* Guided tour banner */
.tour-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 14px;
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
}

.tour-copy {
  flex: 1 1 320px;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
}

.tour-title {
  font-family: var(--font-sub);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.tour-body {
  flex: 1 0 100%;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-muted);
}

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

/* Visible keybinding bar under main FEA stage */
.kbd-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 7px 14px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-panel);
  font-family: var(--font-sub);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.kbd-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.kbd-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.kbd-item kbd {
  font-family: var(--font-mono);
  font-size: 0.69rem;
  color: var(--text-main);
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

.kbd-status {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
}

/* Controls helpers */
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.check-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

/* Tab 2: 4-way DfM Matrix */
.matrix-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.matrix-toolbar-left {
  flex: 1 1 280px;
  min-width: 0;
}

.matrix-toolbar-left .slider-note {
  margin-bottom: 0;
}

.matrix-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.matrix-grid .plate-card {
  margin-bottom: 0;
}

.matrix-table th,
.matrix-table td {
  padding: 7px 8px;
  white-space: nowrap;
}

.matrix-table thead th {
  font-family: var(--font-small);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

.matrix-table thead th:not(:first-child) {
  text-align: right;
}

/* Tab 3: Hybrid CNC Workflow */
.hybrid-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 14px;
  align-items: start;
}

.btf-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.btf-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.btf-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-sub);
  font-size: 0.74rem;
  color: var(--text-muted);
}

.btf-head strong {
  font-family: var(--font-mono);
  color: var(--text-main);
}

.btf-track {
  height: 9px;
  border-radius: 5px;
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  overflow: hidden;
  display: flex;
}

.btf-part {
  height: 100%;
  background: var(--st-ok);
}

.btf-waste {
  height: 100%;
  background: var(--accent);
}

.btf-waste.high {
  background: var(--st-fail);
}

/* Tab 4: Technical Notes */
.notes-sheet {
  max-width: 920px;
  margin: 0 auto;
}

@media (max-width: 1060px) {
  .control-col {
    position: static;
  }
  .hybrid-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 780px) {
  .matrix-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .plate-canvas-main {
    height: 270px;
  }
  .plate-canvas-chart {
    height: 140px;
  }
  .plate-canvas-matrix {
    height: 195px;
  }
  .plate-canvas-hybrid {
    height: 230px;
  }
  .kbd-bar {
    padding: 7px 10px;
  }
}
