.machining-container {
  max-width: 900px;
  margin: 0 auto;
}

.input-group select {
  width: 100%;
  height: 100%;
  border: none;
  background-color: var(--bg-app);
  padding: 22px 12px 4px 12px;
  font-size: 16px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  transition: background-color var(--transition-fast, 0.15s);
}

.input-group:focus-within select {
  background-color: var(--bg-surface);
}

.input-group select option {
  background-color: var(--bg-surface);
  color: var(--text-main);
  padding: 8px 12px;
}

.input-group:has(select)::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-30%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--text-muted);
  pointer-events: none;
}

.input-group .mach-tool-tabs {
  position: absolute;
  bottom: 4px;
  left: 12px;
  right: 12px;
  border: none;
  height: 30px;
}

.mach-top-bar {
  background: var(--bg-surface);
  border-radius: var(--radius-sm, 12px);
  border: 1px solid var(--border);
  padding: 12px 16px;
  margin-bottom: 12px;
}

.mach-machine-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.mach-machine-specs {
  display: flex;
  gap: 16px;
  padding-top: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}

.mach-machine-specs span {
  background: var(--bg-app);
  border-radius: 6px;
  padding: 3px 8px;
  white-space: nowrap;
}

.btn-icon {
  min-width: 32px;
  padding: 4px 8px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: var(--text-main);
}
.btn-icon:hover {
  background: var(--border);
}

.mach-tool-tabs {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.mach-tool-btn {
  flex: 1;
  padding: 8px 10px;
  border: none;
  background: var(--bg-app);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s;
  border-right: 1px solid var(--border);
}

.mach-tool-btn:last-child { border-right: none; }

.mach-tool-btn.active {
  background: var(--primary, #6C63FF);
  color: #fff;
}

.mach-tool-btn:hover:not(.active) {
  background: var(--border);
  color: var(--text-main);
}

.mach-bk-tabs {
  flex-wrap: wrap;
}

.mach-bk-btn {
  flex: 1;
  padding: 6px 8px;
  border: none;
  background: var(--bg-app);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s;
  border-right: 1px solid var(--border);
  white-space: nowrap;
  min-width: 50px;
}

.mach-bk-btn:last-child { border-right: none; }

.mach-bk-btn.active {
  background: var(--primary, #6C63FF);
  color: #fff;
}

.mach-bk-btn:hover:not(.active) {
  background: var(--border);
  color: var(--text-main);
}

.mach-geom-group { }

.mach-lock-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.mach-lock-group input {
  flex: 1;
  min-width: 0;
}

.mach-lock-btn {
  min-width: 32px;
  height: var(--input-height, 40px);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-app);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  transition: all 0.15s;
  color: var(--text-muted);
}

.mach-lock-btn.locked {
  background: rgba(108, 99, 255, 0.12);
  border-color: var(--primary, #6C63FF);
  color: var(--primary, #6C63FF);
}

.mach-lock-btn.unlocked {
  background: var(--bg-surface);
  border-color: var(--border);
  opacity: 0.5;
}

.mach-lock-btn:hover { opacity: 0.85; }

.mach-lock-group .btn-clear-input {
  margin-right: 0;
}

.mach-mat-info {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 10px;
  background: var(--bg-app);
  border-radius: 6px;
  line-height: 1.5;
}

.mach-mat-info span {
  font-weight: 600;
  color: var(--text-main);
}

.mach-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.mach-res-item {
  background: var(--bg-app);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
}

.mach-res-item .res-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}

.mach-res-item .res-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.mach-res-highlight {
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.08), rgba(0, 184, 148, 0.08));
  border: 1px solid rgba(108, 99, 255, 0.2);
}

.mach-gauge {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.mach-gauge-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.mach-gauge-bar {
  height: 8px;
  background: var(--bg-app);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}

.mach-gauge-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease, background 0.3s ease;
  background: var(--accent-circ, #00b894);
}

.mach-gauge-fill.warning { background: #f39c12; }
.mach-gauge-fill.danger { background: #e74c3c; }

.mach-gauge-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.mach-chart-container {
  width: 100%;
  overflow-x: auto;
}

.mach-chart-container svg {
  width: 100%;
  height: auto;
  min-height: 300px;
}

.mach-warning {
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.mach-warning-icon {
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1.3;
}

.mach-warning-ok {
  background: rgba(0, 184, 148, 0.1);
  border-left: 4px solid var(--accent-circ, #00b894);
  color: var(--text-main);
}

.mach-warning-caution {
  background: rgba(243, 156, 18, 0.1);
  border-left: 4px solid #f39c12;
  color: var(--text-main);
}

.mach-warning-critical {
  background: rgba(231, 76, 60, 0.1);
  border-left: 4px solid #e74c3c;
  color: var(--text-main);
}

.mach-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.mach-modal {
  background: var(--bg-surface);
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg, 0 12px 40px rgba(0,0,0,0.12));
  color: var(--text-main);
}

.mach-modal h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.mach-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mach-modal-body .input-group { margin-bottom: 0; }

.mach-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.mach-modal-actions button { margin: 0; }

@media (max-width: 600px) {
  .mach-results-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .mach-res-item .res-val {
    font-size: 16px;
  }
  .mach-gauges {
    flex-direction: column;
  }
  .mach-machine-specs {
    gap: 6px;
  }
  .mach-machine-specs span {
    font-size: 11px;
    padding: 2px 6px;
  }
  .mach-tool-btn {
    font-size: 11px;
    padding: 6px 8px;
  }
}
